TUTORIALAI 与数据科学FETCHED
PyTorch torch.t 函数
PyTorch torch.t 函数 Pytorch torch 参考手册 torch.t 是 PyTorch 中用于二维张量转置的函数。 函数定义 torch.t(input) 使用示例 实例 [mycode4 type='python'] import torch x = torch.randn(3, 4) y = torch.t(x) print('原始形状:', ..
更新于 2026/7/16
教程详情页默认 noindex。
PyTorch torch.t 函数
torch.t 是 PyTorch 中用于二维张量转置的函数。
函数定义
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 参考手册