PyTorch torch.t function
PyTorch torch reference manual
torch.t is a function in PyTorch used to transpose a 2D tensor.
Function definition
torch.t(input)
Usage examples
Example
import
torch
x
=
torch.
randn
(
3
,
4
)
y
=
torch.
t
(
x
)
(
"Original shape:"
,
x.
shape
)
(
"After transposition:"
,
y.
shape
)