A tensor is just an N-dimensional array. Rank = number of dimensions. A grayscale image is rank 2 (H×W). RGB image is rank 3 (H×W×3). A mini-batch of images is rank 4 (B×H×W×C).
Transpose swaps axes. In PyTorch: x.T for 2D or x.permute(0,2,1) for 3D.
Tensor Viewer - Interactive Visualization
Tensors are the data containers of deep learning. A rank-1 tensor is a vector, rank-2 is a matrix, rank-3 is a cube of numbers. Understanding tensor shapes and operations (reshape, transpose, slice) is essential for implementing neural networks. This viewer lets you explore all three ranks with colored grids, showing exactly what operations like transpose and slicing do to the underlying data.
Transpose rank-2 tensors and see rows become columns
Slice rank-3 tensors: see what [:, :, 0] actually selects
Foundation for implementing neural networks in NumPy and PyTorch
Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.