I cannot reproduce this error, but ran into other issues.
While your custom transformation returns a dict with the image and label, the standard torchvision.transforms do not accept this kind of input.
You could unwrap the dict, transform the image to a tensor separately and recreate the dict again:
class ThisDataset(Dataset): #shortened here
    def __init__(self, transform=None):
        self.transform = transform
        self.data = torch.randn(10, 3, 224, 224)
        
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
    
        image = transforms.ToPILImage()(self.data[idx])
        
        sample = {'image': image, 'labels': torch.randint(0, 2, (1,))}
        if self.transform:
            sample = self.transform(sample)
        image, labels = sample['image'], sample['labels']
        x = transforms.ToTensor()(image)
        y = labels
        sample = {'image': x, 'labels': y}
        return sample


class RandCrop(object):
     def __init__(self, size, scale):
         self.crop = transforms.RandomResizedCrop(size=size, scale=scale)

     def __call__(self, sample):
         image, labels = sample['image'], sample['labels']
         image = self.crop(image)
         return {'image': image,
                 'labels': labels}


crop_size = 224
crop_range = (0.8,1)

dataset = ThisDataset(transform=transforms.Compose([RandCrop(size = crop_size, scale = crop_range)]))
dataloader = DataLoader(dataset=dataset, batch_size=1, shuffle=True, num_workers=0)

batch = next(iter(dataloader))