The passed transform will be applied in CustomDataSet.__getitem__ in this line of code:
tensor_image = self.transform(image)

and will thus be applied on the PIL.Image and tensor_image should be a tensor in this case.