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(), or torch.transpose(x, 0, 1)
  • JAX: x.T or jnp.transpose(x)

Hints

transpose linear-algebra torch.transpose jnp.transpose
Detecting runtime...