PyTorch4 min read
Tensor Shape Cheat Sheet: Every Layer's Input/Output Formula
Quick-reference formulas for every PyTorch layer's output shape. Worked examples with real numbers for Conv2d, Linear, LSTM, MaxPool2d, MultiheadAttention, and more.
By Michael LipHeyTensor Blog
Read the full story
Originally published by HeyTensor Blog on Apr 6, 2026.
Comments
Sign in to join the discussion.