__getitem__ forces return of a different datatype


Could someone help me understand why the outputs are not the same? The point is that I want to do all the necessary processing in the getitem itself and not outside, but no matter what I do, it returns not the data type I wanted.


When you enumerate the loader it returns you a tuple (<index> , (<data>, <label>)). So if you unpack the loader like this: for i, (batch, _) in enumerate(val_loader):, you will get the the data you want.