The issue is that the functional version of contrast expects to take in the input directly rather than returning a callable function. You can work around this by using ColorJitter and only changing the contrast (e.g., torchvision.transforms.ColorJitter(brightness=0, contrast=0.5, saturation=0, hue=0)).
If you want a constant adjustment you can just wrap the current function: