Function: set_dynamic_batch_size
Applicability
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Sets the batch size for dynamic-shape model inference before the model is executed.
Prototype
- C Prototype
1aclError aclmdlSetDynamicBatchSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, uint64_t batchSize)
- Python Function
1ret = acl.mdl.set_dynamic_batch_size(model_id, dataset, index, batch_size)
Parameter Description
|
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, pointer address of the input data of a model. 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. |
|
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. |
|
batch_size |
Int, batch size for model inference. The configured batch size must be among the batch size profiles set during model building. You can also call acl.mdl.get_dynamic_batch to obtain the number of batch profiles supported by a specified model and the number of batches in each profile. |
Return Value Description
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code: 0 on success; else, failure. |