提交 78582dbe 编写于 作者: C chenfeiyu

make DataIterator compatible for python 2

上级 25883dcd
import six
from .sampler import SequentialSampler, RandomSampler, BatchSampler
......@@ -84,7 +85,11 @@ class DataIterator(object):
return minibatch
def _next_index(self):
return next(self._sampler_iter)
if six.PY3:
return next(self._sampler_iter)
else:
# six.PY2
return self._sampler_iter.next()
def __len__(self):
return len(self._index_sampler)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册