aclmdlCreateAndGetOpDesc
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Description
Obtains the description of an operator, including the operator name, input tensor description, and output tensor description. If the specified operator cannot be found, an error is returned. This API does not support the dynamic shape scenario.
For example, if an AI Core error is reported during network inference, you can call this API to obtain the description of the error operator and then perform further troubleshooting.
- Define and implement the exception callback function fn (of the aclrtExceptionInfoCallback type). For details about the callback function prototype, see .
The key steps for implementing the callback function are as follows:
- Call , , and in the exception callback function fn to obtain the device ID, stream ID, and task ID, respectively.
- Call aclmdlCreateAndGetOpDesc in fn to obtain the operator description.
- Call aclGetTensorDescByIndex in fn to obtain the input/output tensor description of the operator.
- In the exception callback function fn, call the following APIs to obtain the tensor description for further analysis.
For example, call aclGetTensorDescAddress to obtain the tensor data address, call aclGetTensorDescType to obtain the data type in the tensor description, call aclGetTensorDescFormat to obtain the tensor format, call aclGetTensorDescNumDims to obtain the tensor dimension count, and call aclGetTensorDescDimV2 to obtain the size of a specified dimension.
- Call to set the exception callback function.
- Run model inference.
If an AI Core error is reported, the callback function fn is triggered to obtain the operator information for further troubleshooting.
Prototype
aclError aclmdlCreateAndGetOpDesc(uint32_t deviceId, uint32_t streamId, uint32_t taskId, char *opName, size_t opNameLen, aclTensorDesc **inputDesc, size_t *numInputs, aclTensorDesc **outputDesc, size_t *numOutputs)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
deviceId |
Input |
Device ID. Call to obtain the device ID in the exception information as an input. |
|
streamId |
Input |
Stream ID. Call to obtain the stream ID in the exception information as an input. |
|
taskId |
Input |
Task ID. Call to obtain the task ID in the exception information as an input. |
|
opName |
Output |
Pointer to the operator name string. |
|
opNameLen |
Input |
Length of the operator name string. If the specified length is shorter than the actual length of the operator name, an error is returned. |
|
inputDesc |
Output |
Pointer to the description of all input tensors of the operator, pointing to the start address of a contiguous memory space. |
|
numInputs |
Output |
Pointer to the number of inputs. |
|
outputDesc |
Output |
Pointer to the description of all output tensors of the operator, pointing to the start address of a contiguous memory space. |
|
numOutputs |
Output |
Pointer to the number of outputs. |
Returns
0 on success; else, failure. For details, see aclError.