Skip to content

Glossary: NLP with Transformers

inference_mode / no_grad

Also written: torch.inference_mode, torch.no_grad

PyTorch contexts that skip gradient tracking when you only predict. `inference_mode` is the stricter, faster version.

Where the book teaches it

Related terms

Logits