Function: get_input_dims_v2
C Prototype |
aclError aclmdlGetInputDimsV2(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims) |
|---|---|
Python Function |
dims, ret = acl.mdl.get_input_dims_v2(model_desc, index) |
Function Usage |
Obtains dimension information of the input tensor based on the model description. If the model contains static AIPP configuration, call acl.mdl.get_input_dims or acl.mdl.get.input_dims_v2 to obtain the shape as required. The differences between the two APIs are as follows:
|
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 input to be obtained, starting from 0. |
Return Value |
dims: dict, maximum supported combinations for dynamic-batch or dynamic-size scenarios based on the dictionary array. For details, see aclmdlIODims. dims = {
"name": xxx, #tensor name
"dimCount": xxx, #Number of dimensions in shape
"dims": [xx, xx, xx] # dimension information
}
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 dims [-1, 3, 224, 224] indicates that the batch size is dynamic, and the tensor dims [1, 3, -1, -1] indicates that the image size is dynamic. The italic numbers are examples only.
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. ret: int, error code.
|
Restrictions |
None |
Image Format |
dims Format |
dims 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" |