Solved by ptrblck in post #2 
              
              
                .numel() is defined for PyTorch tensors, not numpy arrays. Based on your error message it seems that you are using numpy arrays inside your Dataset, which then fails in: 
numel = sum([x.numel() for x in batch])

Assuming the __getitem__ returns these numpy arrays (I don’t have a clue which types the…