class_docstr: Custom decoder module for Transducer model.
  
  Args:
      odim: Output dimension.
      dec_arch: Decoder block architecture (type and parameters).
      input_layer: Input layer type.
      repeat_block: Number of times dec_arch is repeated.
      joint_activation_type: Type of activation for joint network.
      positional_encoding_type: Positional encoding type.
      positionwise_layer_type: Positionwise layer type.
      positionwise_activation_type: Positionwise activation type.
      input_layer_dropout_rate: Dropout rate for input layer.
      blank_id: Blank symbol ID.
class_docstr_tok: ["Custom","decoder","module","for","Transducer","model",".","Args",":","odim",":","Output","dimension",".","dec_arch",":","Decoder","block","architecture","(","type","and","parameters",")",".","input_layer",":","Input","layer","type",".","repeat_block",":","Number","of","times","dec_arch","is","repeated",".","joint_activation_type",":","Type","of","activation","for","joint","network",".","positional_encoding_type",":","Positional","encoding","type",".","positionwise_layer_type",":","Positionwise","layer","type",".","positionwise_activation_type",":","Positionwise","activation","type",".","input_layer_dropout_rate",":","Dropout","rate","for","input","layer",".","blank_id",":","Blank","symbol","ID","."]
docstr: One-step forward hypothesis.
  
  Args:
      hyp: Hypothesis.
      cache: Pairs of (dec_out, dec_state) for each label sequence. (key)
  
  Returns:
      dec_out: Decoder output sequence. (1, D_dec)
      dec_state: Decoder hidden states. [N x (1, U, D_dec)]
      lm_label: Label ID for LM. (1,)
docstr_tok: ["One-step","forward","hypothesis",".","Args",":","hyp",":","Hypothesis",".","cache",":","Pairs","of","(","dec_out",",","dec_state",")","for","each","label","sequence",".","(","key",")","Returns",":","dec_out",":","Decoder","output","sequence",".","(","1",",","D_dec",")","dec_state",":","Decoder","hidden","states",".","[","N","x","(","1",",","U",",","D_dec",")","]","lm_label",":","Label","ID","for","LM",".","(","1",",",")"]
code: def score(
      self, hyp: Hypothesis, cache: Dict[str, Any]
  ) -> Tuple[torch.Tensor, List[Optional[torch.Tensor]], torch.Tensor]:
      """One-step forward hypothesis.
  
      Args:
          hyp: Hypothesis.
          cache: Pairs of (dec_out, dec_state) for each label sequence. (key)
  
      Returns:
          dec_out: Decoder output sequence. (1, D_dec)
          dec_state: Decoder hidden states. [N x (1, U, D_dec)]
          lm_label: Label ID for LM. (1,)
  
      """
      labels = torch.tensor([hyp.yseq], device=self.device)
      lm_label = labels[:, -1]
  
      str_labels = "_".join(list(map(str, hyp.yseq)))
  
      if str_labels in cache:
          dec_out, dec_state = cache[str_labels]
      else:
          dec_out_mask = subsequent_mask(len(hyp.yseq)).unsqueeze_(0)
  
          new_state = check_state(
              hyp.dec_state, (labels.size(1) - 1), self.blank_id
          )
  
          dec_out = self.embed(labels)
  
          dec_state = []
          for s, decoder in zip(new_state, self.decoders):
              dec_out, dec_out_mask = decoder(
                  dec_out, dec_out_mask, cache=s
              )
              dec_state.append(dec_out)
  
          dec_out = self.after_norm(dec_out[:, -1])
  
          cache[str_labels] = (dec_out, dec_state)
  
      return dec_out[0], dec_state, lm_label
  
file_path: espnet/espnet/nets/pytorch_backend/transducer/custom_decoder.py
imports: from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  from espnet.nets.pytorch_backend.transducer.blocks import build_blocks
  from espnet.nets.pytorch_backend.transducer.utils import check_batch_states, check_state, pad_sequence
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.pytorch_backend.transformer.mask import subsequent_mask
  from espnet.nets.transducer_decoder_interface import ExtendedHypothesis, Hypothesis, TransducerDecoderInterface
label_desc: Use image node_id 5 for calling the CustomDecoder obj's underlying member method code with example usage: obj.score(hyp, cache) and returns: dec_out,  dec_state,  lm_label