Skip to content

Commit a414ed6

Browse files
committed
Replace with explicit check on image.
1 parent d0063f3 commit a414ed6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

torchvision/transforms/functional_tensor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ def convert_image_dtype(image: torch.Tensor, dtype: torch.dtype = torch.float) -
5959
if image.dtype == dtype:
6060
return image
6161

62-
# TODO: replace with image.dtype.is_floating_point when torchscript supports it
63-
if torch.empty(0, dtype=image.dtype).is_floating_point():
62+
if image.is_floating_point():
6463

6564
# TODO: replace with dtype.is_floating_point when torchscript supports it
6665
if torch.tensor(0, dtype=dtype).is_floating_point():

0 commit comments

Comments
 (0)