aclopInferShape

Description

Infers the output shape of an operator based on the input shape and other necessary arguments.

Restrictions

Prototype

aclError aclopInferShape(const char *opType,

int numInputs,

aclTensorDesc *inputDesc[],

aclDataBuffer *inputs[],

int numOutputs,

aclTensorDesc *outputDesc[],

aclopAttr *attr)

Parameters

Parameter

Input/Output

Description

opType

Input

Pointer to the operator type name.

numInputs

Input

Number of input tensors.

inputDesc

Input

Pointer array of the input tensor description.

Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance.

The array length is consistent with numInputs.

inputs

Input

Pointer array of the input tensors.

Call aclCreateDataBuffer to create data of the aclDataBuffer type in advance.

Determine the memory allocation method based on the app run mode. If the app runs on the host, allocate host memory. If the app runs on the device, allocate device memory. For details about the memory allocation API, see Memory Management.

numOutputs

Input

Number of output tensors.

outputDesc

Output

Pointer array of the output tensor description.

Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance.

The array length is consistent with numOutputs.

attr

Input

Operator attributes.

Returns

0 on success; else, failure.

See Also

For the API call example, see Executing a Dynamic-Shape Operator (No Operator Selector Registered).