Function: set_tensor_value_range

C Prototype

aclError aclSetTensorValueRange(aclTensorDesc* desc, size_t valueCount, int64_t valueRange[][ACL_TENSOR_VALUE_RANGE_NUM])

Python Function

ret = acl.set_tensor_value_range(desc, value_range)

Function Usage

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

Use case: 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 execute operators with pyACL.

Input Description

desc: int, pointer address of aclTensorDesc. Call Function: create_tensor_desc to create data of the aclTensorDesc type in advance.

value_range: list. A two-dimensional list is used to indicate the range of each data value.

ACL_TENSOR_VALUE_RANGE_NUM = 2

Return Value

ret: int, error code.

Restrictions

None