Commit d2901654 authored by soumith's avatar soumith
Browse files

py3 compat

parent 2c277d62
...@@ -2,7 +2,7 @@ import torch.utils.data as data ...@@ -2,7 +2,7 @@ import torch.utils.data as data
from PIL import Image from PIL import Image
import os import os
import os.path import os.path
import StringIO import six
import string import string
import sys import sys
if sys.version_info[0] == 2: if sys.version_info[0] == 2:
...@@ -34,7 +34,7 @@ class LSUNClass(data.Dataset): ...@@ -34,7 +34,7 @@ class LSUNClass(data.Dataset):
with env.begin(write=False) as txn: with env.begin(write=False) as txn:
imgbuf = txn.get(self.keys[index]) imgbuf = txn.get(self.keys[index])
buf = StringIO.StringIO() buf = six.BytesIO()
buf.write(imgbuf) buf.write(imgbuf)
buf.seek(0) buf.seek(0)
img = Image.open(buf).convert('RGB') img = Image.open(buf).convert('RGB')
......
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