@@ -88,7 +88,7 @@ def infer(output_layer, parameters, input, feeding=None, field='value'):
8888 Infer a neural network by given neural network output and parameters. The
8989 user should pass either a batch of input data or reader method.
9090
91- Example usages :
91+ Example usage for sinlge output_layer :
9292
9393 .. code-block:: python
9494
@@ -97,8 +97,19 @@ def infer(output_layer, parameters, input, feeding=None, field='value'):
9797 input=SomeData)
9898 print result
9999
100+ Example usage for multiple outout_layers and fields:
101+
102+ .. code-block:: python
103+
104+ result = paddle.infer(output_layer=[prediction1, prediction2],
105+ parameters=parameters,
106+ input=SomeData,
107+ field=[id, value]])
108+ print result
109+
100110 :param output_layer: output of the neural network that would be inferred
101- :type output_layer: paddle.v2.config_base.Layer
111+ :type output_layer: paddle.v2.config_base.Layer or a list of
112+ paddle.v2.config_base.Layer
102113 :param parameters: parameters of the neural network.
103114 :type parameters: paddle.v2.parameters.Parameters
104115 :param input: input data batch. Should be a python iterable object, and each
@@ -112,7 +123,9 @@ def infer(output_layer, parameters, input, feeding=None, field='value'):
112123 Note that `prob` only used when output_layer is beam_search
113124 or max_id.
114125 :type field: str
115- :return: a numpy array
126+ :return: The prediction result. If there are multiple outout_layers and fields,
127+ the return order is outout_layer1.field1, outout_layer2.field1, ...,
128+ outout_layer1.field2, outout_layer2.field2 ...
116129 :rtype: numpy.ndarray
117130 """
118131
0 commit comments