GetOptionalInputFormat

Function Usage

Obtains the pointer to an optional input format based on the input index in the operator prototype definition.

Prototype

1
StorageFormat *GetOptionalInputFormat(const size_t ir_index)

Parameters

Parameter

Input/Output

Description

ir_index

Input

Index in the IR prototype definition, starting from 0.

Returns

Pointer to the input format. If the ir_index is invalid or the input is not instantiated, a null pointer is returned.

For details about the definition of the StorageFormat type, see StorageFormat.

Constraints

None

Examples

1
2
3
4
5
ge::graphStatus InferFormatForXXX(InferFormatContext *context) {
  const auto format = context->GetOptionalInputFormat(0);        // Obtain the format of input 0.
  GE_ASSERT_NOTNULL(format);
  // ...
}