diff --git a/paddle/fluid/pybind/reader_py.cc b/paddle/fluid/pybind/reader_py.cc index 7703f8f48d7f6b92bd73af567b87f79441d6c3ec..0dd30e562b66847551e5f27b45042fb077fc7bc7 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])); }