beta)torch_npu.npu_format_cast_

接口原型

torch_npu.npu_format_cast_(self, src) -> Tensor

功能描述

原地修改self张量格式,与src格式保持一致。src,即source tensor,源张量。

参数说明

支持的型号

调用示例

1
2
3
4
5
>>> x = torch.rand(2, 3, 4, 5).npu()
>>> torch_npu.get_npu_format(x)
0
>>> torch_npu.get_npu_format(torch_npu.npu_format_cast_(x, 2))
2