torch_npu.npu_format_cast_

API接口

torch_npu.npu_format_cast_(self, src) -> Tensor

功能描述

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

参数说明

示例

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