parameters: (self, eval_data, num_batch=None, merge_batches=True, reset=True,
                  always_output_list=False)
return_statement: return output_list
docstring: Runs prediction and collects the outputs.
  
          When `merge_batches` is ``True`` (by default), the return value will be a list
          ``[out1, out2, out3]``, where each element is formed by concatenating the outputs for
          all the mini-batches. When `always_output_list` is ``False`` (as by default),
          then in the case of a single output, `out1` is returned instead of ``[out1]``.
  
          When `merge_batches` is ``False``, the return value will be a nested list like
          ``[[out1_batch1, out2_batch1], [out1_batch2], ...]``. This mode is useful because
          in some cases (e.g. bucketing), the module does not necessarily produce the same
          number of outputs.
  
          The objects in the results have type `NDArray`. If you need to work with a numpy array,
          just call ``.asnumpy()`` on each `NDArray`.
  
          Parameters
          ----------
          eval_data : DataIter
              Evaluation data to run prediction on.
          num_batch : int
              Defaults to ``None``, indicates running all the batches in the data iterator.
          merge_batches : bool
              Defaults to ``True``, see above for return values.
          reset : bool
              Defaults to ``True``, indicates whether we should reset the data iter before
              doing prediction.
          always_output_list : bool
              Defaults to ``False``, see above for return values.
  
          Returns
          -------
          list of NDArray or list of list of NDArray
              Prediction results.
  
          Examples
          --------
          >>> # An example of using `predict` for prediction.
          >>> # Predict on the first 10 batches of val_dataiter
          >>> mod.predict(eval_data=val_dataiter, num_batch=10)
docstring_summary: Runs prediction and collects the outputs.
docstring_tokens: Runs prediction and collects the outputs .
function: def predict(self, eval_data, num_batch=None, merge_batches=True, reset=True,
                  always_output_list=False):
          """Runs prediction and collects the outputs.
  
          When `merge_batches` is ``True`` (by default), the return value will be a list
          ``[out1, out2, out3]``, where each element is formed by concatenating the outputs for
          all the mini-batches. When `always_output_list` is ``False`` (as by default),
          then in the case of a single output, `out1` is returned instead of ``[out1]``.
  
          When `merge_batches` is ``False``, the return value will be a nested list like
          ``[[out1_batch1, out2_batch1], [out1_batch2], ...]``. This mode is useful because
          in some cases (e.g. bucketing), the module does not necessarily produce the same
          number of outputs.
  
          The objects in the results have type `NDArray`. If you need to work with a numpy array,
          just call ``.asnumpy()`` on each `NDArray`.
  
          Parameters
          ----------
          eval_data : DataIter
              Evaluation data to run prediction on.
          num_batch : int
              Defaults to ``None``, indicates running all the batches in the data iterator.
          merge_batches : bool
              Defaults to ``True``, see above for return values.
          reset : bool
              Defaults to ``True``, indicates whether we should reset the data iter before
              doing prediction.
          always_output_list : bool
              Defaults to ``False``, see above for return values.
  
          Returns
          -------
          list of NDArray or list of list of NDArray
              Prediction results.
  
          Examples
          --------
          >>> # An example of using `predict` for prediction.
          >>> # Predict on the first 10 batches of val_dataiter
          >>> mod.predict(eval_data=val_dataiter, num_batch=10)
          """
          assert self.binded and self.params_initialized
  
          if reset:
              eval_data.reset()
  
          output_list = []
  
          for nbatch, eval_batch in enumerate(eval_data):
              if num_batch is not None and nbatch == num_batch:
                  break
              self.forward(eval_batch, is_train=False)
              pad = eval_batch.pad
              outputs = [out[0:out.shape[0]-pad].copy() for out in self.get_outputs()]
  
              output_list.append(outputs)
  
          if len(output_list) == 0:
              return output_list
  
          if merge_batches:
              num_outputs = len(output_list[0])
              for out in output_list:
                  assert len(out) == num_outputs, \
                         'Cannot merge batches, as num of outputs is not the same ' + \
                         'in mini-batches. Maybe bucketing is used?'
              output_list2 = [ndarray.concatenate([out[i] for out in output_list])
                              for i in range(num_outputs)]
  
              if num_outputs == 1 and not always_output_list:
                  return output_list2[0]
              return output_list2
  
          return output_list
function_tokens: def predict ( self , eval_data , num_batch = None , merge_batches = True , reset = True , always_output_list = False ) : assert self . binded and self . params_initialized if reset : eval_data . reset ( ) output_list = [ ] for nbatch , eval_batch in enumerate ( eval_data ) : if num_batch is not None and nbatch == num_batch : break self . forward ( eval_batch , is_train = False ) pad = eval_batch . pad outputs = [ out [ 0 : out . shape [ 0 ] - pad ] . copy ( ) for out in self . get_outputs ( ) ] output_list . append ( outputs ) if len ( output_list ) == 0 : return output_list if merge_batches : num_outputs = len ( output_list [ 0 ] ) for out in output_list : assert len ( out ) == num_outputs , 'Cannot merge batches, as num of outputs is not the same ' + 'in mini-batches. Maybe bucketing is used?' output_list2 = [ ndarray . concatenate ( [ out [ i ] for out in output_list ] ) for i in range ( num_outputs ) ] if num_outputs == 1 and not always_output_list : return output_list2 [ 0 ] return output_list2 return output_list