@ptrblck  Okay that being done but there’s one more thing I am confused about as per the pytorch docs the torch.unique() returns the unique elements , indices and counts , how do i get the indices of the classes i want to keep? suppose i want to enforce a constraint that my count of images per class should be >=3 then how do i get the indices satisfying the condition?