Solved by krishnamurthy in post #6 
              
              
                Your dataloader transforms the data. What’s incorrect is that you’re accessing the train set directly, and not the output of the dataloader. 
More concretely, you must not access tr[0] directly. You should rather access the dataloader output. (accessing the zeroth index is as simple as calling next…