Solved by Sobir_Bobiev in post #2 
              
              
                Hi, 
Here is one way to do it: 
from torchvision.datasets import CIFAR10
trainset = CIFAR10('./data', train=True, download=True)

# select classes you want to include in your subset
classes = torch.tensor([0, 1, 2, 3, 4])

# get indices that correspond to one of the selected classes
indices = (torch…