InferShape

Description

Registers the InferShape function of an operator.

You need to write a function of the InferShapeKernelFunc type for the operator and use this API to register the function.

The InferShapeKernelFunc type is defined as follows:

using InferShapeKernelFunc = UINT32 (*)(InferShapeContext *);

The InferShape function prototype is definite. It accepts an input of the InferShapeContext type. In this context, you can obtain the input and output shape pointers (input, output, and attribute information in the operator prototype definition). If InferShape is successful, ge::GRAPH_SUCCESS is returned. If the derivation fails, other values are returned. If the derivation fails, the execution process ends and exits.

Prototype

OpImplRegisterV2 &InferShape(InferShapeKernelFunc infer_shape_func)

Parameters

Parameter

Input/Output

Description

infer_shape_func

Input

User-defined InferShape function to be registered, which is of the InferShapeKernelFunc type.

Returns

OpImplRegisterV2 object of the operator, where the InferShape function infer_shape_func is registered.

Restrictions

None