From 8b632a229f68884ee93b089293dec7bdb042f70d Mon Sep 17 00:00:00 2001 From: Siming Dai <908660116@qq.com> Date: Mon, 5 Dec 2022 14:43:39 +0800 Subject: [PATCH] Add get_epoch_finish python interface (#182) * add get_epoch_finish interface * add return * delete return --- paddle/fluid/framework/data_set.cc | 1 - paddle/fluid/pybind/data_set_py.cc | 3 +++ python/paddle/fluid/dataset.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/data_set.cc b/paddle/fluid/framework/data_set.cc index 41129b2596761..b6b9e26792467 100644 --- a/paddle/fluid/framework/data_set.cc +++ b/paddle/fluid/framework/data_set.cc @@ -470,7 +470,6 @@ void DatasetImpl::LoadIntoMemory() { readers_[i]->ResetPathNum(); readers_[i]->ResetEpochFinish(); } - return; } for (int64_t i = 0; i < thread_num_; ++i) { diff --git a/paddle/fluid/pybind/data_set_py.cc b/paddle/fluid/pybind/data_set_py.cc index dc381e6a033e0..bc60d536d19ce 100644 --- a/paddle/fluid/pybind/data_set_py.cc +++ b/paddle/fluid/pybind/data_set_py.cc @@ -290,6 +290,9 @@ void BindDataset(py::module *m) { .def("get_memory_data_size", &framework::Dataset::GetMemoryDataSize, py::call_guard()) + .def("get_epoch_finish", + &framework::Dataset::GetEpochFinish, + py::call_guard()) .def("get_pv_data_size", &framework::Dataset::GetPvDataSize, py::call_guard()) diff --git a/python/paddle/fluid/dataset.py b/python/paddle/fluid/dataset.py index decd3988602ac..b5f6fe4fbcb0c 100644 --- a/python/paddle/fluid/dataset.py +++ b/python/paddle/fluid/dataset.py @@ -945,6 +945,9 @@ def get_pv_data_size(self): """ return self.dataset.get_pv_data_size() + def get_epoch_finish(self): + return self.dataset.get_epoch_finish() + @deprecated( since="2.0.0", update_to="paddle.distributed.InMemoryDataset.get_memory_data_size")