convert_to
函数功能
将Tensor的值转换为指定类型,支持dtype.float32、dtype.float16、dtype.int8、dtype.int32、dtype.uint8、dtype.int16、dtype.uint16、dtype.uint32、dtype.int64、dtype.uint64、dtype.double、dtype.bool类型的转换。
当前支持Atlas 推理系列产品和Atlas 200I/500 A2 推理产品。
- 接口中的输入输出Tensor必须在Device侧。
 
函数原型
convert_to(inputTensor: Tensor, dataType: dtype)
参数说明
参数名  | 
输入/输出  | 
说明  | 
|---|---|---|
inputTensor  | 
输入  | 
Tensor类,输入张量。  | 
dataType  | 
输入  | 
dtype类,指定转换的类型。  | 
返回参数说明
返回类型转换后的Tensor类数据。
父主题: TensorOperations