torch.permute

torch.permute(input, dims) Tensor

返回原始张量input维度重新排列后的视图。

参数
  • input (Tensor) – 需要输入的张量。

  • dims (元组 of 整数) – 指定所需的维度顺序

示例

>>> x = torch.randn(2, 3, 5)
>>> x.size()
torch.Size([2, 3, 5])
>>> torch.permute(x, (2, 0, 1)).size()
torch.Size([5, 2, 3])
本页目录