GetOptionalInputDataType

Description

Obtains the data type of an optional input based on the input index in the operator prototype definition.

Prototype

ge::DataType GetOptionalInputDataType(const size_t ir_index) const

Parameters

Parameter

Input/Output

Description

ir_index

Input

Index of the optional input in the operator IR prototype definition, starting from 0.

Returns

Data type of a specified input. If the input ir_index is invalid or the input is not instantiated, DT_UNDEFINED is returned.

Restrictions

None

Example

ge::graphStatus InferDataTypeForXXX(InferDataTypeContext *context) {
  auto data_type = context->GetOptionalInputDataType(1);
  ...
}