Unverified Commit 7f5b2c42 authored by dddzg's avatar dddzg Committed by GitHub
Browse files

make the tensor continuous when pass numpy object to tensor (#2483)


Co-authored-by: default avatarvfdev <vfdev.5@gmail.com>
parent 5e4a9f6d
......@@ -71,7 +71,7 @@ def to_tensor(pic):
if pic.ndim == 2:
pic = pic[:, :, None]
img = torch.from_numpy(pic.transpose((2, 0, 1)))
img = torch.from_numpy(pic.transpose((2, 0, 1))).contiguous()
# backward compatibility
if isinstance(img, torch.ByteTensor):
return img.float().div(255)
......
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