convert_to

Function Usage

Converts the value of a tensor to a specified type. The dtype.float32, dtype.float16, dtype.int8, dtype.int32, dtype.uint8, dtype.int16, dtype.uint16, dtype.uint32, dtype.int64, dtype.uint64, dtype.double, and dtype.bool types are supported.

It is supported by the Atlas inference product and Atlas 200I/500 A2 inference product.

  • The input and output tensors must be on the device.

Prototype

convert_to(inputTensor: Tensor, dataType: dtype)

Parameters

Parameter

Input/Output

Description

inputTensor

Input

Tensor class, input tensor.

dataType

Input

dtype class, which specifies the type to be converted.

Response Parameters

Converted tensor data