My request is pretty simple. I want to be able to turn off autograd mechanics without having to indent my entire code in a ‘with’ block. This way I can use it dynamically. I have so far tried this:
if do_grad: torch.enable_grad() else: torch.no_grad() ...
But so far I have noticed that gradients are being tracked no matter what.