PyTorch 2 · Autograd and models
Skip gradient tracking
Save memory and time when predicting.
with torch.no_grad():
preds = model(x)
Official PyTorch 2 documentation
PyTorch 2 · Autograd and models
Save memory and time when predicting.
with torch.no_grad():
preds = model(x)
Official PyTorch 2 documentation
Was this page helpful?