Skip to content

Commit

Permalink
Replace with explicit check on image. (#3239)
Browse files Browse the repository at this point in the history
Summary: Co-authored-by: Francisco Massa <fvsmassa@gmail.com>

Reviewed By: datumbox

Differential Revision: D26156388

fbshipit-source-id: aa09fdf088ab2271da5ae25d764262d6246e4599
  • Loading branch information
vincentqb authored and facebook-github-bot committed Feb 1, 2021
1 parent 1c2644f commit 9249fb5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions torchvision/transforms/functional_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 9249fb5

Please sign in to comment.