code: def init_step(self, beam, expected_len_pen):
      # init_preds: [4, 3, 5, 6, 7] - no EOS's
      init_scores = torch.log_softmax(
          torch.tensor([[0, 0, 0, 4, 5, 3, 2, 1]], dtype=torch.float),
          dim=1,
      )
      init_scores = deepcopy(
          init_scores.repeat(self.BATCH_SZ * self.BEAM_SZ, 1)
      )
      new_scores = init_scores + beam.topk_log_probs.view(-1).unsqueeze(
          1
      )
      expected_beam_scores, expected_preds_0 = new_scores.view(
          self.BATCH_SZ, self.BEAM_SZ * self.N_WORDS
      ).topk(self.BEAM_SZ, dim=-1)
      beam.advance(deepcopy(init_scores), self.random_attn())
      self.assertTrue(
          beam.topk_log_probs.allclose(expected_beam_scores)
      )
      self.assertTrue(beam.topk_ids.equal(expected_preds_0))
      self.assertFalse(
          any([any(subbeam) for subbeam in beam.is_finished_list])
      )
      self.assertFalse(beam.done)
      return expected_beam_scores
  
imports: import unittest
  from onmt.translate.beam_search import BeamSearch, GNMTGlobalScorer
  from onmt.translate.beam_search import BeamSearchLM
  from copy import deepcopy
  import torch
label_desc: Use image node_id 2 for calling the TestBeamSearchAgainstReferenceCase obj's underlying member method code with example usage: obj.init_step(beam, expected_len_pen) and returns: expected_beam_scores