aclmdlSetDatasetTensorDesc

Applicability

Product

Supported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

Atlas training products

Description

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

Prototype

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 and format.

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

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.

See Also

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