code: def _batch_stats(refs, hyps):
      """Internal function which actually computes the counts.
  
      Used by accumulatable_wer_stats
  
      Arguments
      ----------
      ref : iterable
          Batch of reference sequences.
      hyp : iterable
          Batch of hypothesis sequences.
  
      Returns
      -------
      collections.Counter
          Edit statistics over the batch, with keys:
  
          * "insertions" - number of insertions
          * "deletions" - number of deletions
          * "substitutions" - number of substitutions
          * "num_ref_tokens" - number of reference tokens
  
      Example
      -------
      >>> from speechbrain.utils.edit_distance import _batch_stats
      >>> batch = [[[1,2,3],[4,5,6]], [[1,2,4],[5,6]]]
      >>> refs, hyps = batch
      >>> print(_batch_stats(refs, hyps))
      Counter({'num_ref_tokens': 6, 'substitutions': 1, 'deletions': 1})
      """
      if len(refs) != len(hyps):
          raise ValueError(
              "The reference and hypothesis batches are not of the same size"
          )
      stats = collections.Counter()
      for ref_tokens, hyp_tokens in zip(refs, hyps):
          table = op_table(ref_tokens, hyp_tokens)
          edits = count_ops(table)
          stats += edits
          stats["num_ref_tokens"] += len(ref_tokens)
      return stats
  
file_path: speechbrain/speechbrain/utils/edit_distance.py
imports: import collections
label_desc: Use image node_id 2 for calling a global function with example usage: _batch_stats(refs, hyps) and returns: stats