It only takes an index so that the DataLoader can load a certain number of images during training (e.g. one epoch worth of images). get_item could essentially ignore the index and iteratively load data, check the ignore flag, and only return the data if ignore is False. That’s probably better than skipping the index, because you’ll actually go through the same number of datapoints each time you call the DataLoader.