Unverified Commit 67681a76 authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

[FBcode->GH] Fix to_tensor for accimage backend (#3439)

parent a7b4bfd6
...@@ -119,9 +119,9 @@ def to_tensor(pic): ...@@ -119,9 +119,9 @@ def to_tensor(pic):
return img return img
if accimage is not None and isinstance(pic, accimage.Image): 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) pic.copyto(nppic)
return torch.from_numpy(nppic) return torch.from_numpy(nppic).to(dtype=default_float_dtype)
# handle PIL Image # handle PIL Image
if pic.mode == 'I': if pic.mode == 'I':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment