aclmdlGetCurOutputDims

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function Usage

Obtains the actual tensor dimension information of an output tensor based on the model description.

Prototype

1
aclError aclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims)

Parameters

Parameter

Input/Output

Description

modelDesc

Input

Pointer to data of the aclmdlDesc type.

Call aclmdlCreateDesc to create data of the aclmdlDesc type in advance.

index

Input

Index of the output whose dimension is to be obtained, indexed from 0.

dims

Output

Pointer to the actual dimension information. For details about the type definition, see aclmdlIODims.

If the length of a tensor name exceeds 127, the system replaces it with the format acl_modelId_${id}_output_${index}_${random string} when outputting dims.name. If the converted name conflicts with an existing tensor name, a random string (_${random string}) is appended; otherwise, no random string is added. The system also maintains a mapping between the converted and original names. You can call aclmdlGetTensorRealName to retrieve the original name by passing the converted one (or simply pass the original name to get it back unchanged). For a tensor name that has a length of 127 or fewer, dims.name directly reflects the original tensor name.

Returns

0 on success; else, failure. For details, see aclError.

Restrictions

Currently, this API can be used to obtain the dimension information of the model output tensors only in the following scenarios:

  • Dynamic batch size, dynamic image size, or dynamic dimensions (ND format only) setting through model conversion: If aclmdlSetDynamicBatchSize, aclmdlSetDynamicHWSize, or aclmdlSetInputDynamicDims has been called, this API outputs the actual dimension information of the specified output tensor. In other cases, this API outputs the maximum dimension profile.
  • In the static-shape scenario, this API is used to obtain the dimension information of the output tensor of a model.