Given a matrix A
, say:
A = torch.randn(5,5)
What is the difference between A.T
and A.t()
?
Given a matrix A
, say:
A = torch.randn(5,5)
What is the difference between A.T
and A.t()
?
From the docs:
tensor.t
:
Expects
input
to be <= 2-D tensor and transposes dimensions 0 and 1.
0-D and 1-D tensors are returned as is. When input is a 2-D tensor this is equivalent totranspose(input, 0, 1)
.
Returns a view of this tensor with its dimensions reversed.
Ifn
is the number of dimensions inx
,x.T
is equivalent tox.permute(n-1, n-2, ..., 0)
.
In your use case both will yield the same result.