From 6a05ed33666ca712a66272b9414d9f4d84373bfb Mon Sep 17 00:00:00 2001 From: chenweihang Date: Tue, 31 Jul 2018 07:59:41 +0000 Subject: [PATCH] fix: add batch size check in loading data process --- python/paddle/batch.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/paddle/batch.py b/python/paddle/batch.py index d48c54fcbb..2ba45c8164 100644 --- a/python/paddle/batch.py +++ b/python/paddle/batch.py @@ -40,4 +40,9 @@ def batch(reader, batch_size, drop_last=False): if drop_last == False and len(b) != 0: yield b + # Batch size check + if batch_size <= 0: + raise ValueError("batch_size should be a positive integeral value, " + "but got batch_size={}".format(batch_size)) + return batch_reader -- GitLab