You are passing the .data attribute to the criterion, which will detach the tensor from the computation graph and can yield other unwanted side effects.
We do not recommend to use this attribute, so pass the outputs tensor directly to criterion.