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