Function: get_output_dims

C Prototype

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

Python Function

dims, ret = acl.mdl.get_output_dims(model_desc, index)

Function Usage

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

  • Static-shape: This API is used to obtain the shape of the output tensors of a model.
  • This API is used to obtain the maximum shape profile in the dynamic batch/image size scenario.

Input Description

model_desc: int, pointer address of the data of the aclmdlDesc type.

Call acl.mdl.create_desc to create data of the aclmdlDesc type in advance.

index: int, sequence number of the input to be obtained, starting from 0.

Return Value

dims: dict, maximum supported combinations for dynamic-batch or dynamic-size scenarios based on the dictionary array. For details, see aclmdlIODims.

dims = {
        "name": xxx, #tensor name
"dimCount": xxx, #Number of dimensions in shape
"dims": [xx, xx, xx] # dimension information
        }
  • If the length of the tensor name is greater than 127, when dims["name"] is output, pyACL converts the tensor name to the acl_modelId_${id}_input_${index}_${random character string} format and establishes a mapping between the converted name and the original name, you can call acl.mdl.get_tensor_real_name to transfer the converted name and obtain the original name. (If the original name is passed to the API, the original name is obtained.)
    NOTE:

    If the name of the converted tensor conflicts with the name of an existing tensor in the model, _${random string} is added to the end of the converted name. Otherwise, no random string is added.

  • If the length of the tensor name is no longer than 127 characters, the tensor name is output when dims["name"] is output.

ret: int, error code.

Restrictions

None