Function tch::no_grad_guard
source · pub fn no_grad_guard() -> NoGradGuard
Expand description
Disables gradient tracking, this will be enabled back when the
returned value gets deallocated.
Note that it is important to bind this to a name like _guard
and not to _
as the latter would immediately drop the guard.
See https://internals.rust-lang.org/t/pre-rfc-must-bind/12658/46
for more details.