Sure, here is the code and error:
class swe_dataset(Dataset):
    def __init__(self, train, label,transform=None):
        self.x_data=train 
        self.y_data=label
        self.len = len(self.x_data)
        #self.transform=transform
        
        self.transform= transforms.Compose([
            transforms.ToPILImage(),
            transforms.Resize((120,120)),
            transforms.ToTensor()
        ])
        
    def __getitem__(self,index):
        sample= self.x_data[index], self.y_data[index]
        if self.transform is not None:
            sample=self.transform(sample)
            
        return sample
    
    def __len__(self):
        return self.len

TypeError                                 Traceback (most recent call last)
<ipython-input-335-3765493ebbad> in <module>
----> 1 im,_=next(iter(train_set))

<ipython-input-331-2ded7f573365> in __getitem__(self, index)
     15         sample= self.x_data[index], self.y_data[index]
     16         if self.transform is not None:
---> 17             sample=self.transform(sample)
     18 
     19         return sample

~/anaconda3/envs/gpu-env/lib/python3.8/site-packages/torchvision/transforms/transforms.py in __call__(self, img)
     68     def __call__(self, img):
     69         for t in self.transforms:
---> 70             img = t(img)
     71         return img
     72 

~/anaconda3/envs/gpu-env/lib/python3.8/site-packages/torchvision/transforms/transforms.py in __call__(self, pic)
    134 
    135         """
--> 136         return F.to_pil_image(pic, self.mode)
    137 
    138     def __repr__(self):

~/anaconda3/envs/gpu-env/lib/python3.8/site-packages/torchvision/transforms/functional.py in to_pil_image(pic, mode)
    118     """
    119     if not(isinstance(pic, torch.Tensor) or isinstance(pic, np.ndarray)):
--> 120         raise TypeError('pic should be Tensor or ndarray. Got {}.'.format(type(pic)))
    121 
    122     elif isinstance(pic, torch.Tensor):

TypeError: pic should be Tensor or ndarray. Got <class 'tuple'>.