GetOptionalInputShape

Description

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

Prototype

const Shape *GetOptionalInputShape(const size_t ir_index) const

Parameters

Parameter

Input/Output

Description

ir_index

Input

Input index in the operator IR prototype definition, starting from 0.

Returns

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

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

Restrictions

None

Example

ge::graphStatus InferShapeForXXX(InferShapeContext *context) {
  auto in_shape = context->GetOptionalInputShape(2);
  // ...
}