Solved by ptrblck in post #2 
              
              
                with torch.no_grad() is a context manager and is used to prevent calculating gradients in the following code block. 
Usually it is used when you evaluate your model and don’t need to call backward() to calculate the gradients and update the corresponding parameters. 
Also, you can use it to initiali…