InferShape4Reduce
Description
Infers an output tensor's shape. It is the InferShape for Reduce operators.
Prototype
ge::graphStatus InferShape4Reduce(gert::InferShapeContext *context)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
context |
Input |
inferShape context passed by GE. |
Return Value
Return type: ge::graphStatus.
- ge::GRAPH_SUCCESS: inferShape succeeded.
- ge::GRAPH_FAIL: inferShape failed.
Constraints
None.
Example
The following sample code is for reference only. Do not copy and run it.
1 2 3 4 5 6 7 8 | // Apply inferShape to the IsFinite operator. The procedure follows the same process as Reduce operators, allowing direct reuse. ge::graphStatus InferShape4IsFinite(gert::InferShapeContext* context) { return Ops::Base::InferShape4Reduce(context); } // Register the IsFinite operator and its shape inference function with GE. IMPL_OP_INFERSHAPE(IsFinite).InferShape(InferShape4IsFinite); } |
Parent topic: infershape