aclmdlDesc
Interfaces of this data type are all synchronous interfaces.
- Function: create_desc
- Function: destroy_desc
- Function: get_desc
- Function: get_num_inputs
- Function: get_num_outputs
- Function: get_input_size_by_index
- Function: get_output_size_by_index
- Function: get_input_dims
- Function: get_input_dims_v2
- Function: get_output_dims
- Function: get_input_name_by_index
- Function: get_output_name_by_index
- Function: get_input_format
- Function: get_output_format
- Function: get_input_data_type
- Function: get_output_data_type
- Function: get_input_index_by_name
- Function: get_output_index_by_name
- Function: get_dynamic_batch
- Function: get_dynamic_hw
- Function: get_cur_output_dims
- Function: get_first_aipp_info
Function: create_desc
C Prototype |
aclmdlDesc* aclmdlCreateDesc() |
---|---|
Python Function |
desc = acl.mdl.create_desc() |
Function Usage |
Creates data of the aclmdlDesc type. |
Input Description |
None |
Return Value |
desc: int, address of an object of the aclmdlDesc type. |
Restrictions |
None |
Precautions |
None |
Function: destroy_desc
C Prototype |
aclError aclmdlDestroyDesc(aclmdlDesc *modelDesc) |
---|---|
Python Function |
ret = acl.mdl.destroy_desc(model_desc) |
Function Usage |
Destroys data of the aclmdlDesc type. |
Input Description |
model_desc: pointer to the aclmdlDesc to be destroyed. |
Return Value |
ret: int, error code.
|
Restrictions |
Destruction API: The released or destroyed resources are no longer available after this API is called. You are advised to set the released or destroyed resources to invalid values (for example, 0 or None) after calling this API. |
Precautions |
None |
Function: get_desc
C Prototype |
aclError aclmdlGetDesc(aclmdlDesc *modelDesc, uint32_t modelId) |
---|---|
Python Function |
ret = acl.mdl.get_desc(model_desc, model_id) |
Function Usage |
Obtains model data of the aclmdlDesc type using the model ID. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. model_id: int, model ID. |
Return Value |
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: get_num_inputs
C Prototype |
size_t aclmdlGetNumInputs(aclmdlDesc *modelDesc) |
---|---|
Python Function |
size = acl.mdl.get_num_inputs(model_desc) |
Function Usage |
Obtains the number of input models based on data of the aclmdlDesc type. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. |
Return Value |
size: int, number of input models. |
Restrictions |
None |
Precautions |
None |
Function: get_num_outputs
C Prototype |
size_t aclmdlGetNumOutputs(aclmdlDesc *modelDesc) |
---|---|
Python Function |
size = acl.mdl.get_num_outputs(model_desc) |
Function Usage |
Obtains the number of output models based on data of the aclmdlDesc type. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. |
Return Value |
size: int, number of input models. |
Restrictions |
None |
Precautions |
None |
Function: get_input_size_by_index
C Prototype |
size_t aclmdlGetInputSizeByIndex(aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
size = acl.mdl.get_input_size_by_index(model_desc, index) |
Function Usage |
Obtains the input size in bytes based on data of the aclmdlDesc type. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
size: int, size of the input, in bytes. |
Restrictions |
None |
Precautions |
None |
Function: get_output_size_by_index
C Prototype |
size_t aclmdlGetOutputSizeByIndex(aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
size = acl.mdl.get_output_size_by_index(model_desc, index) |
Function Usage |
Obtains the output size in bytes based on data of the aclmdlDesc type. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
size: int, size of the input, in bytes. |
Restrictions |
None |
Precautions |
None |
Function: get_input_dims
C Prototype |
aclError aclmdlGetInputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims) |
---|---|
Python Function |
dims, ret = acl.mdl.get_input_dims(model_desc, index) |
Function Usage |
Obtains dimension information of the input tensor based on the model description. If the model contains static AIPP configuration information, call acl.mdl.get_input_dims or acl.mdl.get.input_dims_v2 to obtain the dimension information as required. The differences between the two interfaces are as follows:
|
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input whose Dims is 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.
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Image Format |
dims Format |
dims Shape |
YUV420SP_U8 |
NHWC |
n,h,w,c |
XRGB8888_U8 |
NHWC |
n,h,w,c |
RGB888_U8 |
NHWC |
n,h,w,c |
YUV400_U8 |
NHWC |
n,h,w,c |
ARGB8888_U8 |
NHWC |
n,h,w,c |
YUYV_U8 |
NHWC |
n,h,w,c |
YUV422SP_U8 |
NHWC |
n,h,w,c |
AYUV444_U8 |
NHWC |
n,h,w,c |
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(model_desc, index) |
Function Usage |
Obtains dimension information of the input tensor based on the model description. If the model contains static AIPP configuration information, call acl.mdl.get_input_dims or acl.mdl.get.input_dims_v2 to obtain the dimension information as required. The differences between the two interfaces are as follows:
|
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. 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.
ret: int, error code.
|
Restrictions |
None |
Precautions |
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" |
Function: get_output_dims
C Prototype |
aclError aclmdlGetOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims) |
---|---|
Python Function |
acl.mdl.get_output_dims(model_desc, index) |
Function Usage |
Obtains tensor dimension information of an output based on the model description. In the fixed shape scenario, this API is used to obtain the dimension information of the output tensor of a model. This API is used to obtain the dimension information of the maximum batch/image size choice in the dynamic shape (dynamic batch or dynamic resolution) scenario. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. 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.
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: get_input_name_by_index
C Prototype |
const char *aclmdlGetInputNameByIndex(const aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
input_name = acl.mdl.get_input_name_by_index(model_desc, index) |
Function Usage |
Obtains the name of an input in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
input_name: str, input name. |
Restrictions |
None |
Precautions |
None |
Function: get_output_name_by_index
C Prototype |
const char *aclmdlGetOutputNameByIndex(const aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
output_name = acl.mdl.get_output_name_by_index(model_desc, index) |
Function Usage |
Obtains the name of an output in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
output_name: str, output name. |
Restrictions |
None |
Precautions |
None |
Function: get_input_format
C Prototype |
aclFormat aclmdlGetInputFormat(const aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
format_info = acl.mdl.get_input_format(model_desc, index) |
Function Usage |
Obtains the format of an input in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
format_info: int, format of the specified input.
|
Restrictions |
None |
Precautions |
None |
Function: get_output_format
C Prototype |
aclFormat aclmdlGetOutputFormat(const aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
format_info = acl.mdl.get_output_format(model_desc, index) |
Function Usage |
Obtains the format of an output in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
format_info: int, format of the specified input.
|
Restrictions |
None |
Precautions |
None |
Function: get_input_data_type
C Prototype |
aclDataType aclmdlGetInputDataType(const aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
data_type = acl.mdl.get_input_data_type(model_desc, index) |
Function Usage |
Obtains the data type of an input in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
data_type: int, data type of the specified input.
|
Restrictions |
None |
Precautions |
None |
Function: get_output_data_type
C Prototype |
aclDataType aclmdlGetOutputDataType(const aclmdlDesc *modelDesc, size_t index) |
---|---|
Python Function |
data_type = acl.mdl.get_output_data_type(model_desc, index) |
Function Usage |
Obtains the data type of an input in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the input to be obtained, starting from 0. |
Return Value |
ata_type: int, data type of the specified input.
|
Restrictions |
None |
Precautions |
None |
Function: get_input_index_by_name
C Prototype |
aclError aclmdlGetInputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index) |
---|---|
Python Function |
index, ret = acl.mdl.get_input_index_by_name(model_desc, name) |
Function Usage |
Obtains the index of an input using the input name in a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. name: str, input name. |
Return Value |
index: int, index of the input to be obtained. ret: int, error code.
|
Restrictions |
None |
Precautions |
For dynamic batch and image size, the input name is fixed to ascend_mbatch_shape_data. For dynamic AIPP, the input name is fixed to ascend_dynamic_aipp_data. |
Function: get_output_index_by_name
C Prototype |
aclError aclmdlGetOutputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index) |
---|---|
Python Function |
index, ret = acl.mdl.get_output_index_by_name(model_desc, name) |
Function Usage |
Obtains the index of the output by the output name in the model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. name: str, input name. |
Return Value |
index: int, index of the input to be obtained. ret: int, error code.
|
Restrictions |
None |
Precautions |
The name is fixed to data. |
Function: get_dynamic_batch
C Prototype |
aclError aclmdlGetDynamicBatch(const aclmdlDesc *modelDesc, aclmdlBatch *batch) |
---|---|
Python Function |
batch, ret = acl.mdl.get_dynamic_batch(model_desc) |
Function Usage |
Obtains the dynamic batch size information supported by a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. |
Return Value |
batch: dict, dynamic batch information supported by the obtained model
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: get_dynamic_hw
C Prototype |
aclError aclmdlGetDynamicHW(const aclmdlDesc *modelDesc, size_t index, aclmdlHW *hw) |
---|---|
Python Function |
hw_info, ret = acl.mdl.get_dynamic_hw(model_desc, index) |
Function Usage |
Obtains the dynamic size information supported by a model. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: Reserved. The value is fixed to –1. |
Return Value |
hw_info: dict, width and height supported by the obtained model.
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: get_cur_output_dims
C Prototype |
aclErroraclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclIODims *dims) |
---|---|
Python Function |
dims, ret = acl.mdl.get_cur_output_dims(model_desc, index) |
Function Usage |
Obtains actual tensor dimension information of an output based on the model description. |
Input Description |
model_desc: int, pointer to the data of the aclmdlDesc type. index: int, sequence number of the output whose Dims is to be obtained, indexing starting from 0. |
Return Value |
dims: dict, actual dimension information.
ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
Function: get_first_aipp_info
C Prototype |
aclError aclmdlGetFirstAippInfo(uint32_t modelId, size_t index, aclAippInfo *aippinfo) |
---|---|
Python Function |
aipp_info, ret = acl.mdl.get_first_aipp_info(model_id, index) |
Function Usage |
Obtains the AIPP (static or dynamic) configuration of a model. Static AIPP provides the following functions. They are executed in the exact sequence. For details, see ATC Tool Instructions. Cropping -> CSC -> Mean subtraction/normalization -> Padding |
Input Description |
model_id: int, model ID. acl.mdl.load_from_file, acl.mdl.load_from_mem, acl.mdl.load_from_file_with_mem, and acl.mdl.load_from_mem_with_mem are called to load the model. After the model is successfully loaded, the model ID is returned. index: int, sequence number of the specified input to the model |
Return Value |
aipp_info: dict. Static AIPP configuration. ret: int, error code.
|
Restrictions |
None |
Precautions |
None |
- Function: create_desc
- Function: destroy_desc
- Function: get_desc
- Function: get_num_inputs
- Function: get_num_outputs
- Function: get_input_size_by_index
- Function: get_output_size_by_index
- Function: get_input_dims
- Function: get_input_dims_v2
- Function: get_output_dims
- Function: get_input_name_by_index
- Function: get_output_name_by_index
- Function: get_input_format
- Function: get_output_format
- Function: get_input_data_type
- Function: get_output_data_type
- Function: get_input_index_by_name
- Function: get_output_index_by_name
- Function: get_dynamic_batch
- Function: get_dynamic_hw
- Function: get_cur_output_dims
- Function: get_first_aipp_info