提交 333cd3d7 编写于 作者: Y Yu Yang

Add comments about feeding a list to feeder.

上级 cac5ad69
......@@ -35,15 +35,31 @@ class DataFeeder(DataProviderConverter):
DataFeeder converts this mini-batch data entries into Arguments in order
to feed it to C++ interface.
The example usage:
The simple usage shows below
.. code-block:: python
data_types = [('image', paddle.data_type.dense_vector(784)),
('label', paddle.data_type.integer_value(10))]
feeding = ['image', 'label']
feeder = DataFeeder(data_types=data_types, feeding=feeding)
minibatch_data = [([1.0, 2.0, 3.0, ...], 5)]
arg = feeder(minibatch_data)
If mini-batch data and data layers are not one to one mapping, we
could pass a dictionary to feeding parameter to represent the mapping
relationship.
.. code-block:: python
data_types = [('image', paddle.data_type.dense_vector(784)),
('label', paddle.data_type.integer_value(10))]
reader_dict = {'image':0, 'label':1}
feeder = DataFeeder(data_types=data_types, reader_dict=reader_dict)
feeding = {'image':0, 'label':1}
feeder = DataFeeder(data_types=data_types, feeding=feeding)
minibatch_data = [
( [1.0,2.0,3.0,4.0], 5, [6,7,8] ), # first sample
( [1.0,2.0,3.0,4.0], 5, [6,7,8] ) # second sample
......@@ -65,9 +81,9 @@ class DataFeeder(DataProviderConverter):
a tuple of (data_name, data_type).
:type data_types: list
:param reader_dict: A dictionary to specify the position of each data
in the input data.
:type feeding: dict
:param feeding: A dictionary or a sequence to specify the position of each
data in the input data.
:type feeding: dict|collections.Sequence|None
"""
def __init__(self, data_types, feeding=None):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册