InferShape4Broadcast

Description

Infers an output tensor's shape. It is the InferShape for Broadcast operators.

Prototype

ge::graphStatus InferShape4Broadcast(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 Broadcast operators, allowing direct reuse.
ge::graphStatus InferShape4IsFinite(gert::InferShapeContext* context) {

    return Ops::Base::InferShape4Broadcast(context);
}
// Register the IsFinite operator and its shape inference function with GE.
IMPL_OP_INFERSHAPE(IsFinite).InferShape(InferShape4IsFinite);
}