提交 bb625337 编写于 作者: D dangqingqing

add some comments

上级 6cf56035
......@@ -15,5 +15,46 @@
from py_paddle import DataProviderConverter
__all__ = ['DataFeeder']
"""
DataFeeder converts the data returned by paddle.reader into a data structure
of Arguments which is defined in the API. The paddle.reader usually returns
a list of mini-batch data. Each item in the list is a tuple or list, which is
one sample with multiple features. DataFeeder converts this mini-batch data
into Arguments in order to feed it to C++ interface.
The example usage:
data_types = [paddle.data_type.dense_vector(784),
paddle.data_type.integer_value(10)]
feeder = DataFeeder(input_types=data_types)
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
]
# or
# 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
# ]
arg = feeder(minibatch_data)
Args:
input_types: A list of input data types. It's length is equal to the length
of data returned by paddle.reader. Each item specifies the type
of each feature.
mintbatch_data: A list of mini-batch data. Each item is a list or tuple,
for example:
[
(feature_0, feature_1, feature_2, ...), # first sample
(feature_0, feature_1, feature_2, ...), # second sample
...
]
Returns:
An Arguments object contains this mini-batch data with multiple features.
The Arguments definition is in the API.
"""
DataFeeder = DataProviderConverter
......@@ -89,7 +89,6 @@ class SGD(ITrainer):
event_handler = default_event_handler
topology = v2_layer.parse_network(topology)
print topology
__check_train_args__(**locals())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册