torch_npu.npu_dtype_cast

API接口

torch_npu.npu_dtype_cast(input, dtype) -> Tensor

功能描述

执行张量数据类型(dtype)转换。

参数说明

示例

>>> torch_npu.npu_dtype_cast(torch.tensor([0, 0.5, -1.]).npu(), dtype=torch.int)
tensor([ 0,  0, -1], device='npu:0', dtype=torch.int32)