code: def test_TransformerDecoder_init_state(decoder_class):
      decoder = decoder_class(10, 12)
      x = torch.randn(9, 12)
      state = decoder.init_state(x)
      t = torch.randint(0, 10, [4], dtype=torch.long)
      decoder.score(t, state, x)
  
file_path: espnet/test/espnet2/asr/decoder/test_transformer_decoder.py
imports: import pytest
  import torch
  from espnet2.asr.ctc import CTC
  from espnet2.asr.decoder.transformer_decoder import DynamicConvolution2DTransformerDecoder, DynamicConvolutionTransformerDecoder, LightweightConvolution2DTransformerDecoder, LightweightConvolutionTransformerDecoder, TransformerDecoder
  from espnet.nets.batch_beam_search import BatchBeamSearch
  from espnet.nets.batch_beam_search_online_sim import BatchBeamSearchOnlineSim
  from espnet.nets.beam_search import BeamSearch
  from espnet.nets.scorers.ctc import CTCPrefixScorer
label_desc: Use image node_id 2 for calling a global function with example usage: test_TransformerDecoder_init_state(decoder_class) without return types