GetInputShapeRange

Description

Obtains the pointer to the input shape range based on the operator input index. The input index refers to the actual index after operator instantiation, not the index in the prototype definition.

Prototype

const Range<Shape> *GetInputShapeRange(const size_t index) const

Parameters

Parameter

Input/Output

Description

index

Input

Operator input index, starting from 0.

Returns

Pointer to the input shape range. If index is invalid, a null pointer is returned.

Restrictions

None

Example

const auto infer_shape_range_func = [](gert::InferShapeRangeContext *context) -> graphStatus {
  auto input_shape_range = context->GetInputShapeRange(0U);
  auto output_shape_range = context->GetOutputShapeRange(0U);
  output_shape_range->SetMin(const_cast<gert::Shape *>(input_shape_range->GetMin()));
  output_shape_range->SetMax(const_cast<gert::Shape *>(input_shape_range->GetMax()));
  return GRAPH_SUCCESS;
};