提交 ef5c4197 编写于 作者: D dengkaipeng

not reset when max_iters unset

上级 91823e97
......@@ -119,7 +119,7 @@ class ParallelMap(object):
self._producer = threading.Thread(
target=self._produce,
args=('producer-' + id, self._source, self._inq))
self._producer.daemon = False
self._producer.daemon = True
self._consumers = []
self._consumer_endsig = {}
......@@ -130,7 +130,7 @@ class ParallelMap(object):
target=self._consume,
args=(consumer_id, self._inq, self._outq, self._worker))
self._consumers.append(p)
p.daemon = use_process
p.daemon = True
setattr(p, 'id', consumer_id)
if use_process:
worker_set.add(p)
......
......@@ -304,9 +304,11 @@ class Reader(object):
if self._epoch < 0:
self.reset()
if self.drained():
self.stop()
raise StopIteration
batch = self._load_batch()
if self._drop_last and len(batch) < self._batch_size:
self.stop()
raise StopIteration
if self._worker_num > -1:
return batch
......@@ -418,8 +420,8 @@ def create_reader(cfg, max_iter=0, global_cfg=None, devices_num=1):
n += 1
if max_iter > 0 and n == max_iter:
return
reader.reset()
if max_iter <= 0:
return
reader.reset()
return _reader
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册