Function: set_dynamic_hw_size
Function Usage
In the dynamic image size scenario, sets the height and width of the input image for model inference before model execution.
Prototype
- C Prototype
1aclError aclmdlSetDynamicHWSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, uint64_t height, uint64_t width)
- Python Function
1ret = acl.mdl.set_dynamic_hw_size(model_id, dataset, index, height, width)
Parameters
|
Parameter |
Description |
|---|---|
|
model_id |
Int, model ID. You can obtain the model ID after the model is successfully loaded by calling the following APIs: |
|
dataset |
Int, model input data. Data of type aclmdlDataset describes the input data for model inference, while data of type aclDataBuffer describes the input buffer size and address. For details, see aclmdlDataset. |
|
index |
Int, index of the input dynamic batch, obtained by calling acl.mdl.get_input_index_by_name. 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. |
|
height |
Int, height to set. |
|
width |
Int, width to set. The configured resolution (height and width) must be one of the resolution profiles set during model building. You can also call acl.mdl.get_dynamic_hw to obtain the number of resolution profiles supported by a specified model and the width and height of each profile. |
Returns
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code. 0 indicates success, and other values indicate failure. |