aclmdlGetInputDynamicDims

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 dynamic dimensions supported by a model based on the model description.

Prototype

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

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

Reserved. The value is fixed to –1.

dims

Output

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

The dims parameter is an array. Each element in the array points to the aclmdlIODims struct. The dims parameter defined in the aclmdlIODims struct is also an array, whose elements correspond to the dimension size profiles.

Example:

aclmdlIODims dims[gearCount];
aclmdlGetInputDynamicDims(model.modelDesc, -1, dims, gearCount);

gearCount

Input

Number of dynamic dimension size profiles supported by the model, which needs to be obtained through the aclmdlGetInputDynamicGearCount call in advance.

Returns

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

Restrictions

This API can be called to obtain dynamic dimension profiles only after the dynamic dimension profiles are set at model build time. For details about model build, see Build the model.

Assume that a model has three inputs: data (1, 1, 40, –1), label (1, –1) and mask (–1, –1), where –1 denotes a dynamic dimension. If dynamic_dims is set to --dynamic_dims="20,20,1,1;40,40,2,2;80,60,4,4" for model conversion, then the dynamic dimension information returned by this API call is as follows (note that the name parameter in the aclmdlIODims struct is reserved currently):

  • Profile 0:
    • In the aclmdlIODims struct, dimCount: 8 indicates that the total input tensors have eight dimensions altogether.
    • In the aclmdlIODims struct, dims: 1,1,40,20,1,20,1,1 indicates shape profile 0 of each input: data (1, 1, 40, 20), label (1, 20), and mask (1, 1).
  • Profile 1:
    • In the aclmdlIODims struct, dimCount: 8 indicates that the total input tensors have eight dimensions altogether.
    • In the aclmdlIODims struct, dims: 1,1,40,40,1,40,2,2 indicates shape profile 1 of each input: data (1, 1, 40, 40), label (1, 40), and mask (2, 2).
  • Profile 2:
    • In the aclmdlIODims struct, dimCount: 8 indicates that the total input tensors have eight dimensions altogether.
    • In the aclmdlIODims struct, dims: 1,1,40,80,1,60,4,4 indicates shape profile 2 of each input: data (1, 1, 40, 80), label (1, 60), and mask (4, 4).