INFER_SHAPE

Function Usage

Runs the InferShape function of a specified operator to infer the output shape.

Prototype

INFER_SHAPE(KERNEL_NAME, op_args...)

The following are associated APIs called by the preceding macro definitions:

OP_INPUT(x...)

OP_OUTPUT(x...)

OP_ATTR(x...)

OP_WORKSPACE(x...)

OP_OUTSHAPE(x...)

OP_OPTION(x...)

OP_EMPTY_ARG

OP_MODE(x...)

Parameters

Parameter

Input/Output

Description

KERNEL_NAME

Input

Operator name, for example, Add.

op_args...

Input

Operator arguments, including OP_INPUT, OP_OUTPUT, and OP_ATTR.

Constraints

If the operator requires INFER_SHAPE, this macro must be called before ADD_TO_LAUNCHER_LIST_AICORE.

Example

1
2
// Call INFER_SHAPE to infer the input shape of the batchmatmul operator. BatchMatMulV3 is the operator name, OP_INPUT is the operator input parameter, OP_OUTPUT is the operator output parameter, and OP_ATTR is the operator attribute parameter.
INFER_SHAPE(BatchMatMulV3, OP_INPUT(x1, x2, bias, nullptr), OP_OUTPUT(bmmOut), OP_ATTR(adjX1, adjX2, offsetX, opImplModeEnum));