I would like to see how many of each label is in this random subset. When I type this it gives me an error:
Below is my code:
# import the required modules import torch import torchvision from torchvision.datasets import CIFAR10 from collections import Counter trainset = CIFAR10(root='./data', train=True, download=True, transform=torchvision.transforms.ToTensor()) subset_size = 3000 train_dataset_subset = torch.utils.data.random_split(trainset, [subset_size, len(trainset)-subset_size])
How do I go about solving this? Is there a way to use access trainset.targets when it is wrapped in torch.utils.data.random_split?