From a414ed61b969479747670286db1aa5047b092469 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 11 Jan 2021 14:22:29 +0000 Subject: [PATCH] Replace with explicit check on image. --- torchvision/transforms/functional_tensor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/torchvision/transforms/functional_tensor.py b/torchvision/transforms/functional_tensor.py index c97fcf44fe7..6e0ab284623 100644 --- a/torchvision/transforms/functional_tensor.py +++ b/torchvision/transforms/functional_tensor.py @@ -59,8 +59,7 @@ def convert_image_dtype(image: torch.Tensor, dtype: torch.dtype = torch.float) - if image.dtype == dtype: return image - # TODO: replace with image.dtype.is_floating_point when torchscript supports it - if torch.empty(0, dtype=image.dtype).is_floating_point(): + if image.is_floating_point(): # TODO: replace with dtype.is_floating_point when torchscript supports it if torch.tensor(0, dtype=dtype).is_floating_point():