We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Tensor Foundations step 3 of 7
Easy
Framework
Transpose a Matrix
Transpose a 2D matrix (swap rows and columns).
Input: A 2D tensor x of shape (m, n)
Output: A 2D tensor of shape (n, m) that is the transpose of x.
API Reference:
-
PyTorch:
x.T,x.t(), ortorch.transpose(x, 0, 1) -
JAX:
x.Torjnp.transpose(x)
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.