PyTorch torch.t 関数
torch.tPyTorchにおいて2次元テンソルを転置するための関数です。
関数定義
torch.t(input)
使用例
実例
import torch
x = torch.randn(3, 4)
y = torch.t(x)
print(元の形状:, x.shape)
print(転置後:, y.shape)
x = torch.randn(3, 4)
y = torch.t(x)
print(元の形状:, x.shape)
print(転置後:, y.shape)
その他の拡張
Pytorch torch リファレンスマニュアル