Asked about Autograd, custom pieces and performance

How would you speed up a training run?

An answer that works

Profile first, because the bottleneck is usually data loading or synchronisation rather than arithmetic. Then mixed precision, more data loader workers, removing per-step .item() calls, and torch.compile.

Reading an answer is not being able to give one. The section that teaches this is Autograd, custom pieces and performance, 5 hours of PyTorch.

Learn this properly