Skip to content

Glossary: Deep Learning Basics

torch.no_grad

Also written: no_grad, with torch.no_grad()

A block (or decorator) inside which results don't record gradients. Use it when only predicting, to save memory and time.

Where the book teaches it

Related terms

Autograddetachmodel.train() / model.eval()