When testing a network in PyTorch one can use with torch.no_grad():
. What is the Libtorch (C++) equivalent?
Thanks!
What is the LibTorch equivalent to PyTorch's torch.no_grad?
The equivalent in LibTorch is torch::NoGradGuard no_grad
, see documentation.
Yes. It will affect the current scope you're in by disabling the gradient computation. –
Distefano
© 2022 - 2024 — McMap. All rights reserved.
torch::NoGradGuard no_grad;
and every following line operates with no grad? – Oestriol