i resolved the upper given problem by making shuffle bool false in DataLoader function. But now i am getting following error.
NotImplementedError                       Traceback (most recent call last)
<ipython-input-54-2dda8680dbda> in <module>()
     13 
     14 dataset_sizes = {
---> 15     x: len(image_datasets[x]) for x in image_datasets.keys()
     16 }
     17 

<ipython-input-54-2dda8680dbda> in <dictcomp>((x,))
     13 
     14 dataset_sizes = {
---> 15     x: len(image_datasets[x]) for x in image_datasets.keys()
     16 }
     17 

/home/gul/anaconda2/lib/python2.7/site-packages/torch/utils/data/dataset.pyc in __len__(self)
     18 
     19     def __len__(self):
---> 20         raise NotImplementedError
     21 
     22     def __add__(self, other):

NotImplementedError: 

on following code:
from torch.utils.data import Dataset, DataLoader

image_datasets = {
    'train': train_set, 'val': val_set
}

batch_size = 10

dataloaders = {
    'train': DataLoader(train_set, batch_size=batch_size, shuffle=False, num_workers=0),
    'val': DataLoader(val_set, batch_size=batch_size, shuffle=False, num_workers=0)
}

dataset_sizes = {
    x: len(image_datasets[x]) for x in image_datasets.keys()
}

dataset_sizes

Edit 1
Resolved this error by making image_datasets[x] to image_datasets[x].image_paths in the third last statement