PyTorch Guides
In-depth tutorials for fixing common PyTorch errors and understanding tensor shapes. Each guide includes code examples, debugging steps, and interactive tools.
Fix "mat1 and mat2 shapes cannot be multiplied"
Complete guide to fixing PyTorch RuntimeError: mat1 and mat2 shapes cannot be multiplied. 7 real-world causes with code fixes, interactive shape checker, and prevention tips.
Transformer Architecture Visual Guide, Self-Attention Explained
Interactive step-by-step canvas visualization: Q/K/V projection, attention scores, softmax, multi-head attention. Step through 7 layers with prev/next controls. Full PyTorch implementation included.
About These Guides
Each guide covers a specific PyTorch error or concept in depth, with real-world code examples, step-by-step debugging processes, and links to the relevant HeyTensor tools. Use the Tensor Shape Calculator to verify shapes interactively as you follow along, or try the mat1/mat2 error debugger to paste your error message and get an instant fix.
Built by Michael Lip. All guides are free and open source.
TENSOR PREFLIGHT · DOWNLOADABLE PYTORCH TOOLKIT
Take the next step in your own PyTorch model.
Trace a local forward pass, inspect tensor shapes in an HTML report, and turn a repair into a regression check. Includes eight broken-and-fixed workflows, source code and setup instructions.
Is this toolkit right for my problem?
Use the free calculator for a layer formula or a quick shape check.
Consider Tensor Preflight when you have a local PyTorch model and want a forward-pass report plus repeatable checks. Python 3.9+ and PyTorch 2.8+ are required. It does not run your model in this website or automatically repair it.
Open the sample report before buying to check the output format.
Python 3.9+ · PyTorch 2.8+ · Runs locally