diff --git a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc index f3c0deb19fe674b48d5bf7a94d8cafd64cee14e2..0ca317930c0417518a2330040f4bf99ed981daea 100644 --- a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc +++ b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc @@ -52,6 +52,8 @@ class DoubleBufferReader : public framework::DecoratedReader { void ReadNextImpl(std::vector* out) override; + ~DoubleBufferReader() { Shutdown(); } + private: void ShutdownImpl() override { reader_->Shutdown(); diff --git a/python/paddle/fluid/tests/demo/pyreader.py b/python/paddle/fluid/tests/demo/pyreader.py index e4df9f749c6980fd14e8d7d5a577365dec8e0a53..e2df7b870b47a5558b972e776f98ebfd1cefc57b 100644 --- a/python/paddle/fluid/tests/demo/pyreader.py +++ b/python/paddle/fluid/tests/demo/pyreader.py @@ -100,7 +100,7 @@ def main(): trainer.run(fetch_list=[loss.name])) except fluid.core.EOFException: print 'End of epoch', epoch_id - # train_reader.reset() + train_reader.reset() train_data_thread.join() test_data_thread = pipe_reader_to_queue( @@ -111,7 +111,7 @@ def main(): tester.run(fetch_list=[test_loss.name])) except fluid.core.EOFException: print 'End of testing' - # test_reader.reset() + test_reader.reset() test_data_thread.join() break