aclmdlGetCurOutputDims

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

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

Prototype

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 dimensions to obtain, indexed from 0.

dims

Output

Pointer to the actual dimension information.

If the length of the original tensor name is less than or equal to 127, the original tensor name is retained in the output dims.name. If the length of the original tensor name is greater than 127, the system converts the tensor name into the format of "acl_modelId_${id}_output_${index}_${random string}" in the output dims.name. If the name of the converted tensor conflicts with that of an existing tensor in the model, the converted tensor name is suffixed with another random string, formatted as _${random string}. In addition, a mapping between the converted tensor name and the original tensor name is created, which allows you to obtain the original name by passing the converted name to the aclmdlGetTensorRealName call. (If the original name is passed to the API call, the original name is returned.)

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.