What does the tensor's "H","T" attributes mean?

Example codes as followed:

import torch

T = torch.rand(3,3)
print(T.H)
print(T.T)

And the corresponding output:

tensor([[0.9100, 0.4052, 0.8227],
        [0.9101, 0.5563, 0.8068],
        [0.5961, 0.8708, 0.0686]])
tensor([[0.9100, 0.4052, 0.8227],
        [0.9101, 0.5563, 0.8068],
        [0.5961, 0.8708, 0.0686]])

 tensor([[0.9100, 0.9101, 0.5961],
        [0.4052, 0.5563, 0.8708],
        [0.8227, 0.8068, 0.0686]])

From the docs:
Tensor.T:

Returns a view of this tensor with its dimensions reversed.
If n is the number of dimensions in x, x.T is equivalent to x.permute(n-1, n-2, ..., 0).

Tensor.H:

Returns a view of a matrix (2-D tensor) conjugated and transposed.
x.H is equivalent to x.transpose(0, 1).conj() for complex matrices and x.transpose(0, 1) for real matrices.

1 Like