I have this code to download CIFAR 10:
trainset = torchvision.datasets.CIFAR10(root=’./data’, train=True, download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True)
for indices, train_data, train_label in trainloader:
**read the indices of the current batch? **
I do not want to design my own dataset class from scratch because I think I should store the images on the local machine to create my dataset subclass. Is there a way to get the indices directly?
Thanks