Training and Inference

Parameters

Trainer

Event

All training events.

There are:

  • BeginIteration
  • EndIteration
  • BeginPass
  • EndPass

TODO(yuyang18): Complete it!

Inference

paddle.v2.infer(output_layer, parameters, input, feeding=None, field='value')

Infer a neural network by given neural network output and parameters. The user should pass either a batch of input data or reader method.

Example usages:

result = paddle.infer(prediction, parameters, input=SomeData,
                      batch_size=32)
print result
Parameters:
  • output_layer (paddle.v2.config_base.Layer) – output of the neural network that would be inferred
  • parameters (paddle.v2.parameters.Parameters) – parameters of the neural network.
  • input (collections.Iterable) – input data batch. Should be a python iterable object, and each element is the data batch.
  • feeding – Reader dictionary. Default could generate from input value.
  • field (str) – The prediction field. It should in [value, id, prob]. value and prob mean return the prediction probabilities, id means return the prediction labels. Default is value. Note that prob only used when output_layer is beam_search or max_id.
Returns:

a numpy array

Return type:

numpy.ndarray