Solved by ptrblck in post #2 
              
              
                You set the requires_grad attribute of all parameters to False, thus nothing in your computation graph requires gradients, which will raise this error.