Skip to content

Commit 5ae34fb

Browse files
committed
Make code more compatible
1 parent 8551e07 commit 5ae34fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/paddle/dataset/flowers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import scipy.io as scio
4040
from paddle.dataset.image import *
4141
from paddle.reader import *
42+
from paddle import compat as cpt
4243
import os
4344
import numpy as np
4445
from multiprocessing import cpu_count
@@ -126,9 +127,11 @@ def reader():
126127
batch = pickle.load(f)
127128
else:
128129
batch = pickle.load(f, encoding='bytes')
129-
data = batch[six.b('data')]
130-
labels = batch[six.b('label')]
131-
for sample, label in zip(data, batch[six.b('label')]):
130+
if batch is not None:
131+
batch = cpt.to_text(batch)
132+
data = batch['data']
133+
labels = batch['label']
134+
for sample, label in zip(data, batch['label']):
132135
yield sample, int(label) - 1
133136
if not cycle:
134137
break

0 commit comments

Comments
 (0)