diff --git a/lightly/transforms/torchvision_transforms.py b/lightly/transforms/torchvision_transforms.py index 6e26f571b..e225d1d37 100644 --- a/lightly/transforms/torchvision_transforms.py +++ b/lightly/transforms/torchvision_transforms.py @@ -21,15 +21,3 @@ from torchvision import transforms as torchvision_transforms _TRANSFORMS_V2 = False - - -def ToTensor() -> Union[torchvision_transforms.Compose, ToTensorV1]: - T = torchvision_transforms - if _TRANSFORMS_V2 and hasattr(T, "ToImage") and hasattr(T, "ToDtype"): - # v2.transforms.ToTensor is deprecated and will be removed in the future. - # This is the new recommended way to convert a PIL Image to a tensor since - # torchvision v0.16. - # See also https://github.com/pytorch/vision/blame/33e47d88265b2d57c2644aad1425be4fccd64605/torchvision/transforms/v2/_deprecated.py#L19 - return T.Compose([T.ToImage(), T.ToDtype(dtype=torch.float32, scale=True)]) - else: - return T.ToTensor()