diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 9b04a58c98539f86ca94af380dffa38746053781..7a8f2a185f7ca7d69608555004d66b8e62d35979 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -168,7 +168,7 @@ paddle.fluid.layers.batch ArgSpec(args=['reader', 'batch_size'], varargs=None, k paddle.fluid.layers.double_buffer ArgSpec(args=['reader', 'place', 'name'], varargs=None, keywords=None, defaults=(None, None)) paddle.fluid.layers.random_data_generator ArgSpec(args=['low', 'high', 'shapes', 'lod_levels', 'for_parallel'], varargs=None, keywords=None, defaults=(True,)) paddle.fluid.layers.py_reader ArgSpec(args=['capacity', 'shapes', 'dtypes', 'lod_levels', 'name', 'use_double_buffer'], varargs=None, keywords=None, defaults=(None, None, True)) -paddle.fluid.layers.py_reader_by_data ArgSpec(args=['capacity', 'feed_list', 'name', 'use_double_buffer'], varargs=None, keywords=None, defaults=(None, True)) +paddle.fluid.layers.create_py_reader_by_data ArgSpec(args=['capacity', 'feed_list', 'name', 'use_double_buffer'], varargs=None, keywords=None, defaults=(None, True)) paddle.fluid.layers.Preprocessor.__init__ ArgSpec(args=['self', 'reader', 'name'], varargs=None, keywords=None, defaults=(None,)) paddle.fluid.layers.Preprocessor.block ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None) paddle.fluid.layers.Preprocessor.inputs ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None) diff --git a/python/paddle/fluid/layers/io.py b/python/paddle/fluid/layers/io.py index 09bff06d3e712ac161400a8f84f14f2752025bc6..e0e397f639315b6a09d15954aca39a124ee6a163 100644 --- a/python/paddle/fluid/layers/io.py +++ b/python/paddle/fluid/layers/io.py @@ -30,8 +30,8 @@ from ..unique_name import generate as unique_name __all__ = [ 'data', 'open_files', 'read_file', 'shuffle', 'batch', 'double_buffer', - 'random_data_generator', 'py_reader', 'py_reader_by_data', 'Preprocessor', - 'load' + 'random_data_generator', 'py_reader', 'create_py_reader_by_data', + 'Preprocessor', 'load' ] @@ -480,7 +480,7 @@ def _py_reader(capacity, feed_list=None): if feed_list is not None: - if isinstance(feed_list, list): + if not isinstance(feed_list, list): raise TypeError("feed_list should be a list of Variable" " instead of " + str(type(feed_list))) lod_levels = [] @@ -758,7 +758,10 @@ def py_reader(capacity, use_double_buffer=use_double_buffer) -def py_reader_by_data(capacity, feed_list, name=None, use_double_buffer=True): +def create_py_reader_by_data(capacity, + feed_list, + name=None, + use_double_buffer=True): """ Create a Python reader for data feeding in Python @@ -781,7 +784,6 @@ def py_reader_by_data(capacity, feed_list, name=None, use_double_buffer=True): 1. The basic usage of :code:`py_reader` is as follows: - >>> import paddle.v2 >>> import paddle.fluid as fluid >>> import paddle.dataset.mnist as mnist >>> diff --git a/python/paddle/fluid/tests/unittests/test_py_reader_using_executor.py b/python/paddle/fluid/tests/unittests/test_py_reader_using_executor.py index aaa6e762d6e1608d49777ce29c127ee70671cc63..b85b94c939f76a3ba67a301682d9d356b481e0c9 100644 --- a/python/paddle/fluid/tests/unittests/test_py_reader_using_executor.py +++ b/python/paddle/fluid/tests/unittests/test_py_reader_using_executor.py @@ -58,7 +58,7 @@ def simple_fc_net(in_size, if use_feed_list: data = fluid.layers.data(name="data", dtype='float32', shape=[in_size]) label = fluid.layers.data(name='label', dtype='int64', shape=[1]) - reader = fluid.layers.py_reader_by_data( + reader = fluid.layers.create_py_reader_by_data( capacity=queue_capacity, use_double_buffer=False, feed_list=[data, label]) @@ -114,7 +114,8 @@ class TestPyReaderUsingExecutor(unittest.TestCase): print({ 'use_cuda': use_cuda, 'use_parallel_executor': use_parallel_executor, - 'use_double_buffer': use_double_buffer + 'use_double_buffer': use_double_buffer, + 'use_feed_list': use_feed_list }) self.main(use_cuda, use_parallel_executor, use_double_buffer, use_feed_list)