aclmdlGetInputDynamicDims
Description
Obtains the dynamic shape profiles supported by a model based on the model description.
Restrictions
This API can be called to obtain dynamic shape profiles only after the dynamic shape profiles are set at model build time. For details about model building, see Building a 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 shape 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 three 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 three 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 three 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).
Prototype
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 shape. 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 profiles supported by the model, which needs to be obtained through the aclmdlGetInputDynamicGearCount call in advance. |
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.