Solved by HaziqRazali in post #3 
              
              
                That code works for me as well. I believe it had something to do with the WeightedRandomSampler from my previous post DataLoader - using SubsetRandomSampler and WeightedRandomSampler at the same time. The variable index of the __getitem__ method is a tensor for the code when I make use of the Weight…