aclSetTensorValueRange

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

Atlas inference product

Atlas training product

Function Usage

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.

Prototype

1
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

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