If you use .data autograd doesn’t track these changes and you might end up with wrong gradients, as you are modifying the underlying data.
If you want to update a parameter like weight, you should use the new with torch.no_grad() op, as it’s generally not advised to use .data.