IndexError in the validation dataloader obtained using Subset

Hi!
I’m trying to perform the validation aver the alexnet trained with the dataset ‘Caltech101’ and I tried different solutions but none these seems to work.
The problem is that I’ve an index error like the following each time I run the validation part:

IndexError: index 3457 is out of bounds for axis 0 with size 2892.

Here my dataset class’ implementation:
https://github.com/rubenIng93/Homework2-Caltech101/blob/master/caltech_dataset.py

prep_data

Any help would be appreciated!

you have downsized train_dataset in line 16

just flip line 16 and line 17

Oh thanks a lot, I did not see that