Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.t function

PyTorch torch.t function


PyTorch torch reference manual 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

)

print

(

"Original shape:"

,

x.

shape

)

print

(

"After transposition:"

,

y.

shape

)


PyTorch torch reference manual PyTorch torch reference manual