Function: set_tensor_value_range

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

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.

Prototype

  • C Prototype
    1
    aclError aclSetTensorValueRange(aclTensorDesc* desc, size_t valueCount, int64_t valueRange[][ACL_TENSOR_VALUE_RANGE_NUM])
    
  • Python Function
    1
    ret = acl.set_tensor_value_range(desc, value_range)
    

Parameter Description

Parameter

Description

desc

Int, pointer address of the aclTensorDesc type. 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 Description

Return Value

Description

ret

Int, error code.