aclmdlSetDynamicHWSize

Applicable Products

Product

Supported

Ascend 950PR / Ascend 950DT

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Function Usage

Sets the height and width of the input image for model inference before model execution in the dynamic image size scenario.

Prototype

1
aclError aclmdlSetDynamicHWSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, uint64_t height, uint64_t width)

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 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 image size input. The input index is obtained by the aclmdlGetInputIndexByName call. The input name is fixed to ACL_DYNAMIC_TENSOR_NAME.

height

Input

Height to be set.

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

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

width

Input

Width to be set.

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

If you do not know the image size profiles set during model building, you can call aclmdlGetDynamicHW to obtain the image size profiles supported by the model and the image 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.