What are the differences between the transforms:
torchvision.transforms.ToTensor
and
torchvision.transforms.PILToTensor
?
What are the differences between the transforms:
torchvision.transforms.ToTensor
and
torchvision.transforms.PILToTensor
?
PILToTensor
transforms a PIL Image to a PyTorch tensor and the resulting tensor is of the same dtype, whereas ToTensor
returns a FloatTensor after normalizing in the range [0, 1].
Please also refer to the official docs for better understanding.