Execute fn with gradient computation disabled. The previous grad mode is always restored, even if fn throws.
fn
Execute
fnwith gradient computation disabled. The previous grad mode is always restored, even iffnthrows.