aclmdlSetDatasetTensorDesc

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

x

Atlas inference product

Atlas training product

Function Usage

Sets the tensor description of a dynamic-shape input or output before the model is executed.

Prototype

1
aclError aclmdlSetDatasetTensorDesc(aclmdlDataset *dataset, aclTensorDesc *tensorDesc, size_t index)

Parameters

Parameter

Input/Output

Description

dataset

Output

Pointer to the address of aclmdlDataset where aclTensorDesc is to be added, indicating the input or output data structure for model execution.

Call aclmdlCreateDataset to create data of the aclmdlDataset type in advance, and then call aclmdlAddDatasetBuffer to add aclDataBuffer to aclmdlDataset.

tensorDesc

Input

Pointer to the address of aclTensorDesc, indicating the input or output tensor description for model execution.

Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance. Currently, you can set only the dimension information in the model input and output tensor description (namely the numDims parameter that indicates the number of dimensions and the dims parameter that indicates the dimension size in the aclCreateTensorDesc API). You cannot set the data type or format.

The number and size of dimensions must be within the range of the input shape set during model build.

index

Input

Input or output index.

When a model has multiple inputs and outputs, you can call aclmdlGetInputNameByIndex and aclmdlGetOutputNameByIndex to obtain the input and output names and set the names based on their indexes to avoid index errors.

Returns

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

Restrictions

For a single model, only one of the aclmdlSetDynamicBatchSize, aclmdlSetDynamicHWSize, aclmdlSetInputDynamicDims, and aclmdlSetDatasetTensorDesc APIs can be called.

Reference

For the API call example, see Dynamic Shape Input (Setting the Shape Range).