set_tensor_value

Function Usage

Sets the value of a tensor. The value can be of the dtype.int32, dtype.uint8, dtype.float16, or dtype.float32 type.

  • Note the data type and data range.
  • The tensor object must be on the device side, and the data type must match the called set_tensor_value method.

Prototype

set_tensor_value(value: float, dataType: dtype)

Input Parameters

Parameter

Type

Description

value

float

Value to be set, which cannot be empty.

dataType

dtype enumeration type

dataType: dtype

Conversion type, which cannot be empty. The supported inputs are dtype.float16, dtype.float32, dtype.uint8, and dtype.int32.

Response Parameters

Tensor data after the tensor value is set.