PyTorch 2 · Performance

Speed up a model

Compile the model with torch.compile for faster training and inference.

model = torch.compile(model)

Official PyTorch 2 documentation

More performance commands

All performance commands · PyTorch 2 cheatsheet

Was this page helpful?