code: def test_bleu_batch_macro():
      bleu = Bleu(ngram=4)
  
      # Batch size 3
      hypotheses = [corpus.cand_1, corpus.cand_2a, corpus.cand_2b]
      refs = [
          corpus.references_1,
          corpus.references_2,
          corpus.references_2,
      ]
      bleu.update((hypotheses, refs))
  
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          reference_bleu_score = (
              sentence_bleu(refs[0], hypotheses[0])
              + sentence_bleu(refs[1], hypotheses[1])
              + sentence_bleu(refs[2], hypotheses[2])
          ) / 3
      assert pytest.approx(bleu.compute()) == reference_bleu_score
  
      value = 0
      for _hypotheses, _refs in zip(hypotheses, refs):
          value += bleu._sentence_bleu(_refs, _hypotheses)
          bleu.update(([_hypotheses], [_refs]))
  
      ref_1 = value / len(refs)
      ref_2 = bleu.compute()
  
      assert pytest.approx(ref_1) == reference_bleu_score
      assert pytest.approx(ref_2) == reference_bleu_score
  
imports: import os
  import warnings
  from collections import Counter
  import pytest
  import torch
  from nltk.translate.bleu_score import corpus_bleu, sentence_bleu, SmoothingFunction
  import ignite.distributed
  from ignite.exceptions import NotComputableError
  from ignite.metrics.nlp import Bleu
  from .None import CorpusForTest
label_desc: Use image node_id 13 for calling a global function with example usage: test_bleu_batch_macro() without return types