torch.adjoint
Returns a view of the tensor with the last two dimensions transposed. This is commonly used for conjugate transpose (Hermitian adjoint) of matrices. For real tensors, this is equivalent to transpose(-2, -1).
Parameters
inputTensor- The input tensor (must have at least 2 dimensions)
Returns
Tensor– Tensor with last two dimensions swappedExamples
const x = torch.randn(2, 3, 4, 5);
torch.adjoint(x).shape; // [2, 3, 5, 4]