Function: get_cur_output_dims

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Runtime shape information supported by a model based on the model description.

Prototype

  • C Prototype
    1
    aclError aclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclIODims *dims)
    
  • Python Function
    1
    dims, ret = acl.mdl.get_cur_output_dims(model_desc, index)
    

Parameter Description

Parameter

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, index of the output whose dimensions to obtain, indexed from 0.

Return Value Description

Return Value

Description

dims

Dict, runtime shape.

  • If the length of the tensor name is greater than 127, when dims["name"] is output, it 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: