aclSetTensorShapeRange

Description

Sets the size range of each dimension of a tensor after a tensor description is created by the aclCreateTensorDesc call.

Use case: For a dynamic-shape operator, a dynamic dimension is represented by –1. However, the value range of each dynamic dimension is different and needs to be set explicitly. For example, if the tensor shape is [16, –1, 20, –1], the corresponding shape range can be [[16,16],[1,128],[20,20],[1,10]]. This indicates that the first dimension is fixed at 16, the second dimension is sized 1–128, the third dimension is fixed at 20, and the fourth dimension is sized 1–10.

Prototype

aclError aclSetTensorShapeRange(aclTensorDesc* desc, size_t dimsCount, int64_t dimsRange[][ACL_TENSOR_SHAPE_RANGE_NUM])

Parameters

Parameter

Input/Output

Description

desc

Output

Pointer to data of the aclTensorDesc type.

Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance.

dimsCount

Input

Number of dimensions of the tensor.

dimsRange

Input

A 2D array for the size range of each dimension.

A dimension represented by a value other than –1 is a fixed dimension. The maximum size and minimum size of the dimension are the same. A dimension represented by –1 is a dynamic dimension. The corresponding array specifies the minimum size and maximum size of the dimension, respectively.

#define ACL_TENSOR_SHAPE_RANGE_NUM 2

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.