捷徑

torch.permute

torch.permute(input, dims) Tensor

傳回原始張量 input 的視圖,其維度已重新排列。

參數
  • input ( Tensor ) – 輸入張量 (input tensor)。

  • dims ( tuple of int ) – 維度的期望順序 (The desired ordering of dimensions)。

範例 (Example)

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

文件

存取 PyTorch 的完整開發者文件 (Access comprehensive developer documentation for PyTorch)

檢視文件 (View Docs)

教學 (Tutorials)

取得適合初學者和進階開發者的深入教學 (Get in-depth tutorials for beginners and advanced developers)

檢視教學 (View Tutorials)

資源 (Resources)

尋找開發資源並獲得您問題的解答 (Find development resources and get your questions answered)

檢視資源 (View Resources)