aclmdlSetDynamicBatchSize

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function Usage

Sets the number of images processed each time during model inference before model execution in dynamic batch scenarios.

Prototype

1
aclError aclmdlSetDynamicBatchSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, uint64_t batchSize)

Parameters

Parameter

Input/Output

Description

modelId

Input

Model ID.

A successful aclmdlLoadFromFile, aclmdlLoadFromMem, aclmdlLoadFromFileWithMem, or aclmdlLoadFromMemWithMem call returns a model ID.

dataset

Input and output

Pointer to the input data for model inference. For details about the type definition, see aclmdlDataset.

Data of type aclmdlDataset describes the input data for model inference, while data of type aclDataBuffer describes the input memory size and address.

index

Input

Index of the dynamic batch size input. The input index is obtained by the aclmdlGetInputIndexByName call. The input name is fixed to ACL_DYNAMIC_TENSOR_NAME.

batchSize

Input

Number of images processed each time during model inference.

The configured batch size must be among the batch size profiles set during model building.

If you do not know the batch profiles set during model building, you can call aclmdlGetDynamicBatch to obtain the batch profiles supported by the model and the batch size of each profile.

Returns

0 on success; else, failure. For details, see aclError.

Example

For details about the API call sequence and example, see Model Inference with Dynamic-Shape Inputs.