code: def test_transducer_beam_search(rnn_type, search_params):
      token_list = ["<blank>", "a", "b", "c", "<sos>"]
      vocab_size = len(token_list)
      beam_size = (
          1 if search_params["search_type"] in ["greedy", "mbg"] else 2
      )
  
      encoder_output_size = 4
      decoder_output_size = 4
  
      decoder = TransducerDecoder(
          vocab_size, hidden_size=decoder_output_size, rnn_type=rnn_type
      )
      joint_net = JointNetwork(
          vocab_size,
          encoder_output_size,
          decoder_output_size,
          joint_space_size=2,
      )
  
      lm = search_params.pop(
          "lm", SequentialRNNLM(vocab_size, rnn_type="lstm")
      )
      if isinstance(lm, str) and lm == "TransformerLM":
          lm = TransformerLM(vocab_size, pos_enc=None, unit=10, layer=2)
  
      beam = BeamSearchTransducer(
          decoder,
          joint_net,
          beam_size=beam_size,
          lm=lm,
          token_list=token_list,
          **search_params,
      )
  
      enc_out = torch.randn(30, encoder_output_size)
  
      with torch.no_grad():
          _ = beam(enc_out)
  
imports: import pytest
  import torch
  from espnet2.asr.decoder.transducer_decoder import TransducerDecoder
  from espnet2.asr.transducer.beam_search_transducer import BeamSearchTransducer
  from espnet2.asr_transducer.joint_network import JointNetwork
  from espnet2.lm.seq_rnn_lm import SequentialRNNLM
  from espnet2.lm.transformer_lm import TransformerLM
label_desc: Use image node_id 1 for calling a global function with example usage: test_transducer_beam_search(rnn_type, search_params) without return types