Rows Become Columns
The transpose of a matrix , written , swaps rows and columns. The element at moves to , so a 2×3 matrix becomes 3×2. A square matrix keeps its shape but reflects across the main diagonal.
Why It Appears So Often
- Aligning matrix-multiplication axes: a (32, 128) batch can multiply a (256, 128) weight matrix after the weight becomes (128, 256).
- Defining symmetry: defines a symmetric matrix. Covariance and Gram matrices are common ML examples.
- Backpropagation: transposed weights naturally appear when gradients pass backward through a linear layer.
In NumPy and PyTorch, a simple transpose often returns a view with changed strides rather than copying the data. That does not make every downstream use free. An operation may require contiguous memory and trigger a copy, or noncontiguous access may be slower. Inspect the memory layout when performance matters.
레고를 조립할 때 모양이 안 맞으면 블록을 살짝 돌려 끼우듯이, AI도 계산 중에 숫자 줄의 모양이 안 맞으면 Transpose(.T)라는 마법을 써서 숫자를 돌려준다. 그래야 퍼즐 조각처럼 딱 맞물려 행렬 곱셈이 시작될 수 있다. 대각선 거울 놀이를 했는데도 처음과 모양이 같다면 그 행렬은 아주 예쁜 '대칭 모양'을 가졌다는 뜻이다. AI는 이런 대칭 구조를 보면 데이터가 아주 규칙적이고 안정적이라고 판단한다.