InferShape

Applicable Products

All processors

Header File/Library File

  • Header file: #include <graph/custom_op.h>
  • Library file: libgraph.so

Function Usage

Shape inference function. It obtains the input tensor shape information through the shape inference context, infers and sets the output tensor shape, and is used for shape inference in graph build.

Prototype

1
virtual graphStatus InferShape(gert::InferShapeContext *ctx) = 0

Parameters

Parameter

Input/Output

Description

ctx

Input

Shape inference context. You can obtain the input tensor shape and set the output tensor shape based on the context.

Returns

Parameter

Type

Description

-

graphStatus

GRAPH_SUCCESS(0): success.

Other values: failure.

Restrictions

None