【Pytorch】torch.permute

【Pytorch】torch.permute,第1张

官方文档:https://pytorch.org/docs/stable/generated/torch.permute.html?highlight=torch%20permute#torch.permute

形式:torch.permute(input, dims) → Tensor

作用:返回原始张量输入的视图,其尺寸已置换。

参数:

  • input (Tensor) – the input tensor.
  • dims (tuple of python:ints) – The desired ordering of dimensions

使用案例:

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])

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/789118.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-05
下一篇 2022-05-05

发表评论

登录后才能评论

评论列表(0条)

保存