thunder.clang.matrix_transpose¶
- thunder.clang.matrix_transpose(a)[source]¶
Transposes the last two dimensions of a tensor.
This function is used to implement the .mT attribute.
- Parameters:
a¶ (TensorProxy) – The tensor to transpose.
a (TensorProxy) –
- Returns:
The transposed tensor.
- Return type:
Examples
>>> a = torch.tensor([[1, 2, 3], [4, 5, 6]]) >>> def func(x): return x.mT >>> traced_func = thunder.make_traced(func, executor="torch") >>> traced_func(a) tensor([[1, 4], [2, 5], [3, 6]])