aclopInferShape
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Infers the output shape of an operator based on the input shape and other necessary arguments.
- If the accurate output shape of the operator can be inferred, the accurate output shape is returned.
- If the accurate output shape of the operator cannot be inferred, but the range of the output shape can be obtained, the dynamic dimension in the tensor description is set to –1 in the output parameter outputDesc. In this scenario, you can call aclGetTensorDescDimRange to obtain the size range of the specified dimension from the tensor description.
- (Reserved) If the accurate output shape and shape range cannot be obtained, the runtime dimension in the tensor description is set to –2 in the output parameter outputDesc.
Prototype
1 2 3 4 5 6 7 |
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 operator input tensor description. For details about the type definition, see aclTensorDesc. Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. The array length must be consistent with numInputs. |
|
inputs |
Input |
Pointer array of the operator input tensor. For details about the type definition, see aclDataBuffer. Call aclCreateDataBuffer to create data of the aclDataBuffer type in advance. In In In Ctrl CPU open form, allocate device memory for storing the input tensor data of the operator. |
|
numOutputs |
Input |
Number of output tensors. |
|
outputDesc |
Output |
Pointer array of the operator output tensor description. For details about the type definition, see aclTensorDesc. Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. The array length must be consistent with numOutputs. |
|
attr |
Input |
Operator attribute. For details about the type definition, see aclopAttr. |
Returns
0 on success; else, failure. For details, see aclError.
Restrictions
- For a required input, optional input, or required output, use the exact name defined in the operator IR prototypes.
- For a dynamic input or dynamic output, use the exact name defined in the operator IR prototypes with a sequence number suffix. Dynamic inputs/outputs are indexed starting at 0.
For example, if an operator has two inputs (the first one is a required input x, the second one is a dynamic input y, including two inputs) and one required output z, the code for calling the aclSetTensorDescName API is as follows:
aclSetTensorDescName(inputTensorDesc[0], "x"); aclSetTensorDescName(inputTensorDesc[1], "y0"); aclSetTensorDescName(inputTensorDesc[2], "y1"); aclSetTensorDescName(outputTensorDesc[0], "z");