The transformations would work on PIL.Images as well as PyTorch tensors (in newer torchvision releases), while it seems that you are trying to use a numpy array based on the error message.
Pass on of the supported types to transform and it should work.