From 9a35f409a3071cc26be64383268ca2d5fbc95280 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Mon, 11 May 2020 07:26:02 +0000 Subject: [PATCH] stop on return --- ppdet/data/reader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppdet/data/reader.py b/ppdet/data/reader.py index 4f4678800..662deac74 100644 --- a/ppdet/data/reader.py +++ b/ppdet/data/reader.py @@ -304,11 +304,9 @@ 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 @@ -419,8 +417,10 @@ def create_reader(cfg, max_iter=0, global_cfg=None, devices_num=1): yield _batch n += 1 if max_iter > 0 and n == max_iter: + reader.stop() return if max_iter <= 0: + reader.stop() return reader.reset() -- GitLab