I want to split FMNIST data set into different sub-datasets containing 

Containing random 500 samples for each class (so in total 500*no of class).
Containing random 100 samples for each class.
and so on…
Is there a direct way of doing this. I tried with subset but it is resulting in imbalanced dataset.