This should work:
dataset = datasets.CIFAR10(root='./data',
                           transform=transforms.ToTensor())
dataset.targets = torch.tensor(dataset.targets)
idx = dataset.targets==1
dataset.targets= dataset.targets[idx]
dataset.data = dataset.data[idx.numpy().astype(np.bool)]

for data, target in dataset:
    print(data.sum())
    print(target)

However, I would consider these approaches as hacks and there might be some side effects I’m currently not aware of.
The clean approach would be to override the dataset class and manipulate the underlying data as you wish.