未验证 提交 3185d38a 编写于 作者: C Chen Weihang 提交者: GitHub

Merge pull request #12467 from chenwhql/batch_size_check

fix: add batch size check in loading data process
...@@ -40,4 +40,10 @@ def batch(reader, batch_size, drop_last=False): ...@@ -40,4 +40,10 @@ def batch(reader, batch_size, drop_last=False):
if drop_last == False and len(b) != 0: if drop_last == False and len(b) != 0:
yield b yield b
# Batch size check
batch_size = int(batch_size)
if batch_size <= 0:
raise ValueError("batch_size should be a positive integeral value, "
"but got batch_size={}".format(batch_size))
return batch_reader return batch_reader
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册