We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 99ace64 + a8856b9 commit df55747Copy full SHA for df55747
torchvision/transforms.py
@@ -34,7 +34,7 @@ def __call__(self, pic):
34
else:
35
# handle PIL Image
36
img = torch.ByteTensor(torch.ByteStorage.from_buffer(pic.tobytes()))
37
- img = img.view(pic.size[1], pic.size[0], 3)
+ img = img.view(pic.size[1], pic.size[0], len(pic.mode))
38
# put it from HWC to CHW format
39
# yikes, this transpose takes 80% of the loading time/CPU
40
img = img.transpose(0, 1).transpose(0, 2).contiguous()
0 commit comments