code: def test_repeated_ngram_blocking_end_to_end_unigrams(self):
      step_function = get_step_function(
          repeated_ngram_transition_probabilities_0
      )
      self.beam_search.beam_size = 2
  
      # Unigrams: On step 3, [1, 3, 1] will be blocked and [1, 3, end] will take its place
      self.beam_search.max_steps = 3
      self.beam_search.constraints = [
          RepeatedNGramBlockingConstraint(ngram_size=1)
      ]
      expected_top_k = np.array([[1, 2, 3], [1, 3, 5]])
      expected_log_probs = np.log(np.array([0.4, 0.6 * 1e-9]))
      self._check_results(
          expected_top_k=expected_top_k,
          expected_log_probs=expected_log_probs,
          take_step=step_function,
      )
  
      step_function = get_step_function(
          repeated_ngram_transition_probabilities_1
      )
      self.beam_search.max_steps = 5
      expected_top_k = np.array([[1, 2, 3, 4, 5], [1, 2, 4, 3, 5]])
      expected_log_probs = np.log(
          np.array(
              [0.4 * 0.3 * 0.3 * 0.2 * 0.1, 0.4 * 0.3 * 0.2 * 0.3 * 0.1]
          )
      )
      self._check_results(
          expected_top_k=expected_top_k,
          expected_log_probs=expected_log_probs,
          take_step=step_function,
      )
  
imports: from typing import Dict, Tuple, Union
  import numpy
  import pytest
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.nn.beam_search import MultinomialSampler, BeamSearch, TopKSampler, TopPSampler, GumbelSampler, LengthNormalizedSequenceLogProbabilityScorer, RepeatedNGramBlockingConstraint, StepFunctionTypeWithTimestep, StepFunctionTypeNoTimestep
  from allennlp.common.params import Params
  from allennlp.nn.util import min_value_of_dtype
label_desc: Use image node_id 33 for calling the BeamSearchTest obj's underlying member method code with example usage: obj.test_repeated_ngram_blocking_end_to_end_unigrams() without return types