OK, this was the problem. Following the pytorch tutorial 24 for making a custom dataset, my dataset would pass a sample as a dictionary: {'image': image, 'label': label}.
Then the custom transforms would unpack this and access the image as sample[‘image’].
Interestingly, before being put in the dictionary, type(image) would be <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=341x341 at 0x12D907210> as expected. However, when retrieving it from sample[‘image’] it becomes: (<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=341x341 at 0x12D907210>,).
So it got converted into a tuple for some reason. Accessing the 0th element of the tuple and passing it along to transform fixes the issue.