Jean_Michel_Sarr:

source_data = MyData(train_data.data, train_data.targets)



Probably you are not applying transform sequence as torchvision's CIFAR10 does.
Remember that only the raw data is passed as input to your newly written MyData class. All the other post-computations (such as Normalization) should be handled in MyData.
  

      github.com
  

  
    pytorch/vision/blob/main/torchvision/datasets/cifar.py#L113-L118



          
        
            # doing this so that it is consistent with all other datasets
            # to return a PIL Image
            img = Image.fromarray(img)
            
            
if self.transform is not None:
                img = self.transform(img)