Solved by albanD in post #4 
              
              
                It’s just that your sampler should be a subclass of the original torch.utils.data.Sampler as the error states. 
You can fix that by setting class SequentialSampler2(torch.utils.data.Sampler): to inherit from it. and add  super().__init__() in the first line of your init function to make sure to init…