Skip to content

Commit ac8208b

Browse files
authored
Merge pull request #13707 from velconia/fix_ci_random_fail
Fix flowers data read in python3
2 parents 60ea082 + d8384c8 commit ac8208b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/paddle/dataset/flowers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
import functools
3636
from .common import download
3737
import tarfile
38-
import six
3938
import scipy.io as scio
4039
from paddle.dataset.image import *
4140
from paddle.reader import *
41+
from paddle import compat as cpt
4242
import os
4343
import numpy as np
4444
from multiprocessing import cpu_count
4545
import six
4646
from six.moves import cPickle as pickle
47-
from six.moves import zip
4847
__all__ = ['train', 'test', 'valid']
4948

5049
DATA_URL = 'http://paddlemodels.cdn.bcebos.com/flowers/102flowers.tgz'
@@ -126,9 +125,11 @@ def reader():
126125
batch = pickle.load(f)
127126
else:
128127
batch = pickle.load(f, encoding='bytes')
128+
if six.PY3:
129+
batch = cpt.to_text(batch)
129130
data = batch['data']
130131
labels = batch['label']
131-
for sample, label in zip(data, batch['label']):
132+
for sample, label in six.moves.zip(data, batch['label']):
132133
yield sample, int(label) - 1
133134
if not cycle:
134135
break

0 commit comments

Comments
 (0)