In my dataloader I am providing dataset which is created by using torchdata.Dataset, I am using the following two lines
img = cv2.imread(path_img, 1)       
img = img.transpose(2, 0, 1)

It is working normal for some iteration but then giving error like:
'Nonetype' object has no attribute 'transpose'

I am confused whether it is due to some of the images in the dataset or due to python.
Thanks in advance for help.