aclmdlGetInputDimsV2
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Obtains the shape of an input tensor based on the model description.
If the model contains static AIPP configuration information, call aclmdlGetInputDims or aclmdlGetInputDimsV2 to obtain the shape as required. The differences between the two APIs are as follows:
- aclmdlGetInputDims: The obtained shape values are consistent with those of the input image. For details, see Table 1.
- aclmdlGetInputDimsV2: The obtained size of the H dimension is that of the input image multiplied by a coefficient, and the size of the C dimension varies according to the image format. For details, see aclmdlGetInputDimsV2 in aclmdlGetInputDimsV2. The product of the dimensions is consistent with that obtained by the aclmdlGetInputSizeByIndex call.
Prototype
1 | aclError aclmdlGetInputDimsV2(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims) |
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 |
Index of the input whose dimension is to be obtained, indexed from 0. |
dims |
Output |
Pointer to the input dimension information. For details about the type definition, see aclmdlIODims. In dynamic batch/image size scenarios, if the batch size is -1 or the width and height are -1, the tensor shape is dynamic. For example, if the format of the input tensor is NCHW, then the tensor shape [–1,3,224,224] indicates that the batch size is dynamic, and the tensor shape [1,3,–1,–1] indicates that the image size is dynamic. The italic numbers are examples only. If the length of a tensor name exceeds 127, the API replaces it with the format acl_modelId_${id}_input_${index}_${random string} when outputting dims.name. If the converted name conflicts with an existing tensor name, a random string (_${random string}) is appended; otherwise, no random string is added. The API also maintains a mapping between the converted and original names. You can call aclmdlGetTensorRealName to retrieve the original name by passing the converted one (or simply pass the original name to get it back unchanged). For a tensor name that has a length of 127 or fewer, dims.name directly reflects the original tensor name. In the static AIPP scenario, this API applies only to the NHWC format. Table 1 describes the mapping between the supported input image formats and dims shapes. |
Image Format |
Format |
Shape |
|---|---|---|
YUV420SP_U8 |
NHWC |
n,h*1.5,w,1 |
XRGB8888_U8 |
NHWC |
n,h,w,4 |
RGB888_U8 |
NHWC |
n,h,w,3 |
YUV400_U8 |
NHWC |
n,h,w,1 |
ARGB8888_U8 |
NHWC |
n,h,w,4 |
YUYV_U8 |
NHWC |
n,h,w,2 |
YUV422SP_U8 |
NHWC |
n,h*2,w,1 |
AYUV444_U8 |
NHWC |
n,h,w,4 |
Returns
0 on success; else, failure. For details, see aclError.