def __init__(self, labeled_data, metrics,
               metric_names=None, n_eval_batches=1, sample_batch=None,
               export_prefix=None):
    r"""Configures an eval task: named metrics run with a given data source.

    Args:
      labeled_data: Iterator of batches of labeled data tuples. Each tuple has
          1+ data tensors (NumPy ndarrays) followed by 1 label (target value)
          tensor.
      metrics: List of layers; each computes a scalar value per batch by
          comparing model output :math:`\hat{y}=f(x)` to the target :math:`y`.
      metric_names: List of names, one for each item in ``metrics``, in matching
           order, to be used when recording/reporting eval output. If ``None``,
           generate default names using layer names from metrics.
      n_eval_batches: Integer N that specifies how many eval batches to run;
          the output is then the average of the outputs from the N batches.
      sample_batch: Optional sample batch for model initialization. If not
          provided, it will be taken from ``labeled_data``.
      export_prefix: Optional task name to be used as prefix for exporting
          metrics during evaluation in Loop.
    """
    self._export_prefix = export_prefix
    self._labeled_data = labeled_data
    self._metrics = metrics
    self._metric_names = metric_names or self._default_names()
    self._n_eval_batches = n_eval_batches  # pylint: disable=invalid-name

    self._sample_batch = sample_batch or next(labeled_data)
    self._check_init_values()
Configures an eval task: named metrics run with a given data source.

    Args:
      labeled_data: Iterator of batches of labeled data tuples. Each tuple has
          1+ data tensors (NumPy ndarrays) followed by 1 label (target value)
          tensor.
      metrics: List of layers; each computes a scalar value per batch by
          comparing model output :math:`\hat{y}=f(x)` to the target :math:`y`.
      metric_names: List of names, one for each item in ``metrics``, in matching
           order, to be used when recording/reporting eval output. If ``None``,
           generate default names using layer names from metrics.
      n_eval_batches: Integer N that specifies how many eval batches to run;
          the output is then the average of the outputs from the N batches.
      sample_batch: Optional sample batch for model initialization. If not
          provided, it will be taken from ``labeled_data``.
      export_prefix: Optional task name to be used as prefix for exporting
          metrics during evaluation in Loop.
    
trax/supervised/training.py