Function: get_cur_output_dims

C Prototype

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

Python Function

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

Function Usage

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

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 output whose Dims is to be obtained, indexing starting at 0.

Return Value

dims: dict, actual shape.

  • 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

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