From c9cf2bdb9cad2261bafb76bb2874a01317d9bea4 Mon Sep 17 00:00:00 2001 From: yuyang18 Date: Fri, 13 Jul 2018 22:04:35 +0800 Subject: [PATCH] Dctor cache --- .../fluid/operators/reader/create_double_buffer_reader_op.cc | 2 ++ python/paddle/fluid/tests/demo/pyreader.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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 f3c0deb19f..0ca317930c 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 e4df9f749c..e2df7b870b 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 -- GitLab