def _model_with_metrics(model, eval_task):
  """Returns a model+metrics layer built on an already initialized model.

  Args:
    model: Layer with initialized weights and state.
    eval_task: :py:class:`EvalTask` instance.

  Returns:
    An initialized, combined model+metrics layer, preserving the initialization
    of ``model``.
  """
  return _model_with_ends(
      model, eval_task.metrics, shapes.signature(eval_task.sample_batch)
  )
Returns a model+metrics layer built on an already initialized model.

  Args:
    model: Layer with initialized weights and state.
    eval_task: :py:class:`EvalTask` instance.

  Returns:
    An initialized, combined model+metrics layer, preserving the initialization
    of ``model``.
  
trax/supervised/training.py