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 these two would have different semantics. See https://internals.rust-lang.org/t/pre-rfc-must-bind/12658/46 for more details.