torch_npu.npu_format_cast(self, acl_format) -> Tensor
修改NPU张量的格式。
- 参数解释:
- self (Tensor) - 输入张量。
- acl_format (Int) - 目标格式。
- 约束条件:
无
- 示例:
>>> x = torch.rand(2, 3, 4, 5).npu()
>>> torch_npu.get_npu_format(x)
0
>>> x1 = x.npu_format_cast(29)
>>> torch_npu.get_npu_format(x1)
29