diff --git a/python/paddle/fluid/layers/io.py b/python/paddle/fluid/layers/io.py index f4481e1df9d727c0725b617f2138a8dae1c16dd8..08f6d66a6524f6cf44fa9abd86df90874b039b53 100644 --- a/python/paddle/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -545,7 +545,11 @@ def py_reader(capacity, reader = monkey_patch_reader_methods(main_prog_var) if use_double_buffer: - reader = double_buffer(reader, name=double_buffer_name) + double_buffer_reader = double_buffer(reader, name=double_buffer_name) + # we return a double buffer reader. However, the reset method comes from + # py_reader. + double_buffer_reader.reset = reader.reset + reader = double_buffer_reader return reader, feed_queue