GetOutputShapeRange
Function Usage
Obtains the pointer to an output shape range based on the operator output index. The output index refers to the actual index after operator instantiation, not the index in the prototype definition.
Prototype
1 | Range<Shape> *GetOutputShapeRange(const size_t index) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
index |
Input |
Operator output index, starting from 0. |
Returns
Pointer to the output shape range. If the index is invalid, a null pointer is returned.
Constraints
None
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ge::graphStatus InferShapeRangeForXXX(gert::InferShapeRangeContext *context) { const auto x_shape_range = context->GetInputShapeRange(0); if (x_shape_range == nullptr) { // Defensive coding } const auto min_shape = x_shape_range->GetMin(); const auto max_shape = x_shape_range->GetMax(); auto y_shape_range = context->GetOutputShapeRange(0); if (y_shape_range == nullptr) { // Defensive coding } if (y_shape_range->GetMin() == nullptr || y_shape_range->GetMax() == nullptr) { // Defensive coding } // Shape range inference logic } |
Parent topic: InferShapeRangeContext