Solved by albanD in post #5 
              
              
                Hi, 
Because labels = labels.cuda() this does not change the original labels inplace. But your code does change the original dictionary inplace ! So if this dictionary is the same as the one stored in your Dataset, then you change the one stored in your dataset.