Skip to content

Commit

Permalink
[FBcode->GH] Fix to_tensor for accimage backend (#3439)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassa authored Feb 23, 2021
1 parent a7b4bfd commit 67681a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchvision/transforms/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def to_tensor(pic):
return img

if accimage is not None and isinstance(pic, accimage.Image):
nppic = np.zeros([pic.channels, pic.height, pic.width], dtype=default_float_dtype)
nppic = np.zeros([pic.channels, pic.height, pic.width], dtype=np.float32)
pic.copyto(nppic)
return torch.from_numpy(nppic)
return torch.from_numpy(nppic).to(dtype=default_float_dtype)

# handle PIL Image
if pic.mode == 'I':
Expand Down

0 comments on commit 67681a7

Please sign in to comment.