Solved by Jani_Basha_S in post #3 
              
              
                I have solved it by converting the list of labels to tensor. 
instead of this: 

label = self.img_list[idx][1] 

Used the below line 

label = torch.tensor(self.img_list[idx][1] , dtype=torch.float32)