code: def create_eager_metrics(metric_names, weights_fn=common_layers.weights_all):
    
    metric_fns = dict(
        [(name, METRICS_FNS[name]) for name in metric_names])
    return create_eager_metrics_internal(metric_fns, weights_fn)
docs: Create metrics accumulators and averager for Eager mode.
  
    Args:
      metric_names: list<str> from Metrics enum
      weights_fn: function that takes labels and returns a weights mask. Defaults
        to weights of all 1, i.e. common_layers.weights_all. Use
        common_layers.weights_nonzero if labels have 0-padding.
  
    Returns:
      (accum_fn(predictions, targets) => None,
       result_fn() => dict<str metric_name, float avg_val>