Solved by ptrblck in post #2 
              
              
                The no_grad guard disables gradient calculations, so Autograd won’t track any operations applied in this block. 
While it’s useful for inference, it can be also applied when you would like to manipulate some internal parameters without using the .data attribute.