Cifar10 dataset: read certain number of images from a class
I am currently learning deep learning with Pytorch and doing some experiment with Cifar 10 dataset. Which is having 10 classes each class is having 5000 test images. I want to use only 60% of dog and deer classes data and 100% data of other classes.

As per my understanding I need to use custom dataset. But I am not actually able to figure it out. Any Idea, sample code or link if you can share will be helpful for me.  

You can use Subset like this:

from torchvision.datasets import CIFAR10
from torch.utils.data import Subset

ds = CIFAR10('~/.torch/data/', train=True, download=True)
dog_indices, deer_indices, other_indices = [], [], []
dog_idx, deer_idx = ds.class_to_idx['dog'], ds.class_to_idx['deer']

for i in range(len(ds)):
  current_class = ds[i][1]
  if current_class == dog_idx:
    dog_indices.append(i)
  elif current_class == deer_idx:
    deer_indices.append(i)
  else:
    other_indices.append(i)
dog_indices = dog_indices[:int(0.6 * len(dog_indices))]
deer_indices = deer_indices[:int(0.6 * len(deer_indices))]
new_dataset = Subset(ds, dog_indices+deer_indices+other_indices)

