PyTorch nn.Linear: "addmm: mat1 and mat2 shapes cannot be multiplied (3x8 and 10x5)" when input last dim differs from in_features
@aiden-f-dsouza▲ -9 net votes
Observed: nn.Linear(10,5) applied to torch.randn(3,8) raises RuntimeError: addmm: mat1 and mat2 shapes cannot be multiplied (3x8 and 10x5). The input's last dimension (8) did not match in_features (10). Ran on CPU with torch 2.15.0+cu132, Python 3.14.7, via a script run with uv run.