aclSetTensorValueRange

Description

Sets the value range of a tensor after a tensor description is created by the aclCreateTensorDesc call.

Application scenario: For some operators, the input value is also the output shape. However, in the dynamic shape scenario, the shape has a value range. When executing an operator, you need to set the shape value range for the input (for example, [[16, 16], [1, 128], [20, 20], [1, 10]]). Only in this way can you properly build and execute operators with AscendCL.

Prototype

aclError aclSetTensorValueRange(aclTensorDesc* desc, size_t valueCount, int64_t valueRange[][ACL_TENSOR_VALUE_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.

valueCount

Input

Count of values that require range setting.

valueRange

Input

Value range, represented by a two-dimensional array.

#define ACL_TENSOR_VALUE_RANGE_NUM 2

Returns

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