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.
1 parent e7342bb commit 764ac3bCopy full SHA for 764ac3b
imagenet/transforms.py
@@ -1,7 +1,6 @@
1
import torch
2
import math
3
import random
4
-import numpy as np
5
from PIL import Image
6
7
@@ -17,7 +16,7 @@ def __call__(self, img):
17
16
18
class ToTensor(object):
19
def __call__(self, pic):
20
- img = torch.ByteTensor(np.asarray(pic, dtype=np.uint8))
+ img = torch.ByteTensor(torch.ByteStorage.from_buffer(pic.tobytes()))
21
img = img.view(pic.size[0], pic.size[1], 3)
22
# put it in CHW format
23
# yikes, this transpose takes 80% of the loading time/CPU
0 commit comments