Function: set_input_dynamic_dims
Function Usage
Sets the runtime dimensions for model inference before model execution, assuming that the input shape is dynamic and the input data format is ND (supporting any format).
Prototype
- C Prototype
1aclError aclmdlSetInputDynamicDims(uint32_t modelId, aclmdlDataset *dataset, size_t index, const aclmdlIODims *dims)
- Python Function
1ret = acl.mdl.set_input_dynamic_dims(model_id, dataset_in, index, dims)
Parameters
|
Parameter |
Description |
|---|---|
|
modelId |
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 dynamic dimension size input. The input index is obtained by the acl.mdl.get_input_index_by_name API. The input name is fixed to ascend_mbatch_shape_data. |
|
dims |
Dict, dimension size for model inference. For details, see aclmdlIODims. You can call the acl.mdl.get_input_dynamic_dims API to obtain the number of dimension size profiles as well as the size of each profile supported by the model. Example: Use the following parameters to convert a model with ATC: input_shape="data:1,1,40,-1;label:1,-1;mask:-1,-1", dynamic_dims="20,20,1,1; 40,40,2,2; 80,60,4,4" If the actual dimension of the input data is (1,1,40,20,1,20,1,1), input dims as follows (name is not required): dims = {'dimCount': 8, 'name': '', 'dims': [1,1,40,20,1,20,1,1]} |
Returns
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code. 0 indicates success, and other values indicate failure. |