beta)torch_npu.npu_transpose

接口原型

torch_npu.npu_transpose(self, perm, require_contiguous=True) -> Tensor

功能描述

返回原始张量视图,其维度已permute,结果连续。支持FakeTensor模式。

参数说明

支持的型号

调用示例

1
2
3
4
5
6
7
8
9
>>> x = torch.randn(2, 3, 5).npu()
>>> x.shape
torch.Size([2, 3, 5])
>>> x1 = torch_npu.npu_transpose(x, (2, 0, 1))
>>> x1.shape
torch.Size([5, 2, 3])
>>> x2 = torch_npu.npu_transpose(x, (2, 0, 1))
>>> x2.shape
torch.Size([5, 2, 3])