code: def test_greedytop1(target_vocab_size):
      batch_size = 1
      beam_size = 1
      target_vocab_size = 50
      # Random model scores. Shape: (batch_size * beam_size, target_vocab_size)
      scores = onp.random.uniform(
          0, 1, (batch_size * beam_size, target_vocab_size)
      )
      (
          expected_hyp_index,
          expected_word_index,
          expected_value,
      ) = numpy_topk(scores, k=beam_size, offset=None)
      assert expected_hyp_index[0] == 0
      assert expected_value.shape == (1, 1)
  
      greedy_top1 = sockeye.beam_search.GreedyTop1()
  
      best_word_index = (
          greedy_top1(pt.tensor(scores), None, None).detach().numpy()
      )
      assert best_word_index.shape == (1, 1)
      assert best_word_index[0, 0] == expected_word_index[0]
  
      target_factors = pt.ones(1, 1, 2, dtype=pt.int32)
      best_word_index_with_factors = (
          greedy_top1(pt.tensor(scores), None, target_factors)
          .detach()
          .numpy()
      )
      assert best_word_index_with_factors.shape == (1, 2)
      assert (
          best_word_index_with_factors[0, 0] == expected_word_index[0]
      )
      assert (
          best_word_index_with_factors[0, 1]
          == target_factors[:, :, 1].item()
      )
  
imports: from typing import List, Optional
  from typing import Tuple
  import numpy
  import pytest
  import torch
  import numpy
  import sockeye.beam_search
  import sockeye.constants
  import sockeye.lexicon
  import sockeye.utils
label_desc: Use image node_id 10 for calling a global function with example usage: test_greedytop1(target_vocab_size) without return types