def METHOD_NAME():
  """Returns a clu.Metric that computes average CTC loss
  taking padding into account.
  """
  @flax.struct.dataclass
  class _Metric(metrics.Metric):
    """Applies `fun` and computes the average."""
    total: np.float32
    weight: np.float32
    @classmethod
    def from_model_output(cls, loss_dict, **_):
      return cls(
          total=loss_dict['summed'], weight=loss_dict['n_valid_examples'])
    def merge(self, other):
      return type(self)(
          total=self.total + other.total, weight=self.weight + other.weight)
    def compute(self):
      return self.total / self.weight
  return _Metric