From bc9eaf0167de20008dd2b82ae9614bf6b0a32a1e Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Mon, 27 Jul 2020 11:34:25 +0800 Subject: [PATCH] fix DataLoader.generrator using error, test=develop (#25355) (#25709) --- paddle/fluid/pybind/reader_py.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paddle/fluid/pybind/reader_py.cc b/paddle/fluid/pybind/reader_py.cc index d64d02f4332..bee3074d6fa 100644 --- a/paddle/fluid/pybind/reader_py.cc +++ b/paddle/fluid/pybind/reader_py.cc @@ -188,6 +188,14 @@ class MultiDeviceFeedReader { result.emplace_back(); auto &ret = result.back(); + PADDLE_ENFORCE_EQ(names_.size(), ret_[i].size(), + platform::errors::InvalidArgument( + "The sample number of reader's input data and the " + "input number of feed list are not equal.\n" + "Possible reasons are:\n" + " The generator is decorated by `paddle.batch` " + "and configured by `set_batch_generator`, but here " + "need to used `set_sample_list_generator`.")); for (size_t j = 0; j < names_.size(); ++j) { ret.emplace(names_[j], std::move(ret_[i][j])); } -- GitLab