GetRequiredInputShape

Function Usage

Obtains the pointer to a required input shape based on the input index in the operator prototype definition.

Prototype

1
const Shape *GetRequiredInputShape(const size_t ir_index) const

Parameters

Parameter

Input/Output

Description

ir_index

Input

Index in the IR prototype definition, starting from 0.

Returns

Input shape pointer. If the ir_index is invalid, a null pointer is returned.

For details about the definition of the shape type, see Shape.

Examples

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