Shortcuts

torch.permute

torch.permute(input, dims) 张量

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

Parameters
  • 输入 (张量) – 输入张量。

  • dims元组整数)– 所需的维度顺序

示例

>>> 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])
优云智算