class_docstr: This class implements the beam-search algorithm for the transducer model.
  
  Parameters
  ----------
  decode_network_lst : list
      List of prediction network (PN) layers.
  tjoint: transducer_joint module
      This module perform the joint between TN and PN.
  classifier_network : list
      List of output layers (after performing joint between TN and PN)
      exp: (TN,PN) => joint => classifier_network_list [DNN bloc, Linear..] => chars prob
  blank_id : int
      The blank symbol/index.
  beam : int
      The width of beam. Greedy Search is used when beam = 1.
  nbest : int
      Number of hypotheses to keep.
  lm_module : torch.nn.ModuleList
      Neural networks modules for LM.
  lm_weight : float
      The weight of LM when performing beam search (λ).
      log P(y|x) + λ log P_LM(y). (default: 0.3)
  state_beam : float
      The threshold coefficient in log space to decide if hyps in A (process_hyps)
      is likely to compete with hyps in B (beam_hyps), if not, end the while loop.
      Reference: https://arxiv.org/pdf/1911.01629.pdf
  expand_beam : float
      The threshold coefficient to limit the number of expanded hypotheses
      that are added in A (process_hyp).
      Reference: https://arxiv.org/pdf/1911.01629.pdf
      Reference: https://github.com/kaldi-asr/kaldi/blob/master/src/decoder/simple-decoder.cc (See PruneToks)
  
  Example
  -------
  searcher = TransducerBeamSearcher(
      decode_network_lst=[hparams["emb"], hparams["dec"]],
      tjoint=hparams["Tjoint"],
      classifier_network=[hparams["transducer_lin"]],
      blank_id=0,
      beam_size=hparams["beam_size"],
      nbest=hparams["nbest"],
      lm_module=hparams["lm_model"],
      lm_weight=hparams["lm_weight"],
      state_beam=2.3,
      expand_beam=2.3,
  )
  >>> from speechbrain.nnet.transducer.transducer_joint import Transducer_joint
  >>> import speechbrain as sb
  >>> emb = sb.nnet.embedding.Embedding(
  ...     num_embeddings=35,
  ...     embedding_dim=3,
  ...     consider_as_one_hot=True,
  ...     blank_id=0
  ... )
  >>> dec = sb.nnet.RNN.GRU(
  ...     hidden_size=10, input_shape=(1, 40, 34), bidirectional=False
  ... )
  >>> lin = sb.nnet.linear.Linear(input_shape=(1, 40, 10), n_neurons=35)
  >>> joint_network= sb.nnet.linear.Linear(input_shape=(1, 1, 40, 35), n_neurons=35)
  >>> tjoint = Transducer_joint(joint_network, joint="sum")
  >>> searcher = TransducerBeamSearcher(
  ...     decode_network_lst=[emb, dec],
  ...     tjoint=tjoint,
  ...     classifier_network=[lin],
  ...     blank_id=0,
  ...     beam_size=1,
  ...     nbest=1,
  ...     lm_module=None,
  ...     lm_weight=0.0,
  ... )
  >>> enc = torch.rand([1, 20, 10])
  >>> hyps, _, _, _ = searcher(enc)
class_docstr_tok: ["This","class","implements","the","beam-search","algorithm","for","the","transducer","model",".","Parameters","--","--","--","--","--","decode_network_lst",":","list","List","of","prediction","network","(","PN",")","layers",".","tjoint",":","transducer_joint","module","This","module","perform","the","joint","between","TN","and","PN",".","classifier_network",":","list","List","of","output","layers","(","after","performing","joint","between","TN","and","PN",")","exp",":","(","TN",",","PN",")","=",">","joint","=",">","classifier_network_list","[","DNN","bloc",",","Linear","..","]","=",">","chars","prob","blank_id",":","int","The","blank","symbol\/index",".","beam",":","int","The","width","of","beam",".","Greedy","Search","is","used","when","beam","=","1.","nbest",":","int","Number","of","hypotheses","to","keep",".","lm_module",":","torch.nn.ModuleList","Neural","networks","modules","for","LM",".","lm_weight",":","float","The","weight","of","LM","when","performing","beam","search","(","\u03bb",")",".","log","P","(","y|x",")","+","\u03bb","log","P_LM","(","y",")",".","(","default",":","0.3",")","state_beam",":","float","The","threshold","coefficient","in","log","space","to","decide","if","hyps","in","A","(","process_hyps",")","is","likely","to","compete","with","hyps","in","B","(","beam_hyps",")",",","if","not",",","end","the","while","loop",".","Reference",":","https",":","\/\/arxiv.org\/pdf\/1911.01629.pdf","expand_beam",":","float","The","threshold","coefficient","to","limit","the","number","of","expanded","hypotheses","that","are","added","in","A","(","process_hyp",")",".","Reference",":","https",":","\/\/arxiv.org\/pdf\/1911.01629.pdf","Reference",":","https",":","\/\/github.com\/kaldi-asr\/kaldi\/blob\/master\/src\/decoder\/simple-decoder.cc","(","See","PruneToks",")","Example","--","--","--","-","searcher","=","TransducerBeamSearcher","(","decode_network_lst=","[","hparams","[","``","emb","''","]",",","hparams","[","``","dec","''","]","]",",","tjoint=hparams","[","``","Tjoint","''","]",",","classifier_network=","[","hparams","[","``","transducer_lin","''","]","]",",","blank_id=0",",","beam_size=hparams","[","``","beam_size","''","]",",","nbest=hparams","[","``","nbest","''","]",",","lm_module=hparams","[","``","lm_model","''","]",",","lm_weight=hparams","[","``","lm_weight","''","]",",","state_beam=2.3",",","expand_beam=2.3",",",")",">",">",">","from","speechbrain.nnet.transducer.transducer_joint","import","Transducer_joint",">",">",">","import","speechbrain","as","sb",">",">",">","emb","=","sb.nnet.embedding.Embedding","(","...","num_embeddings=35",",","...","embedding_dim=3",",","...","consider_as_one_hot=True",",","...","blank_id=0","...",")",">",">",">","dec","=","sb.nnet.RNN.GRU","(","...","hidden_size=10",",","input_shape=","(","1",",","40",",","34",")",",","bidirectional=False","...",")",">",">",">","lin","=","sb.nnet.linear.Linear","(","input_shape=","(","1",",","40",",","10",")",",","n_neurons=35",")",">",">",">","joint_network=","sb.nnet.linear.Linear","(","input_shape=","(","1",",","1",",","40",",","35",")",",","n_neurons=35",")",">",">",">","tjoint","=","Transducer_joint","(","joint_network",",","joint=","''","sum","''",")",">",">",">","searcher","=","TransducerBeamSearcher","(","...","decode_network_lst=","[","emb",",","dec","]",",","...","tjoint=tjoint",",","...","classifier_network=","[","lin","]",",","...","blank_id=0",",","...","beam_size=1",",","...","nbest=1",",","...","lm_module=None",",","...","lm_weight=0.0",",","...",")",">",">",">","enc","=","torch.rand","(","[","1",",","20",",","10","]",")",">",">",">","hyps",",","_",",","_",",","_","=","searcher","(","enc",")"]
docstr: Compute forward-pass through a list of prediction network (PN) layers.
  
  Arguments
  ----------
  out_PN : torch.tensor
      Input sequence from prediction network with shape
      [batch, target_seq_lens].
  decode_network_lst: list
      List of prediction network (PN) layers.
  hinne : torch.tensor
      Optional: None, hidden tensor to be used for
          recurrent layers in the prediction network
  
  Returns
  -------
  out_PN : torch.tensor
      Outputs a logits tensor [B,U, hiddens].
  hidden : torch.tensor
      Hidden tensor to be used for the next step
      by recurrent layers in prediction network.
docstr_tok: ["Compute","forward-pass","through","a","list","of","prediction","network","(","PN",")","layers",".","Arguments","--","--","--","--","--","out_PN",":","torch.tensor","Input","sequence","from","prediction","network","with","shape","[","batch",",","target_seq_lens","]",".","decode_network_lst",":","list","List","of","prediction","network","(","PN",")","layers",".","hinne",":","torch.tensor","Optional",":","None",",","hidden","tensor","to","be","used","for","recurrent","layers","in","the","prediction","network","Returns","--","--","--","-","out_PN",":","torch.tensor","Outputs","a","logits","tensor","[","B",",","U",",","hiddens","]",".","hidden",":","torch.tensor","Hidden","tensor","to","be","used","for","the","next","step","by","recurrent","layers","in","prediction","network","."]
code: def _forward_PN(self, out_PN, decode_network_lst, hidden=None):
      """Compute forward-pass through a list of prediction network (PN) layers.
  
      Arguments
      ----------
      out_PN : torch.tensor
          Input sequence from prediction network with shape
          [batch, target_seq_lens].
      decode_network_lst: list
          List of prediction network (PN) layers.
      hinne : torch.tensor
          Optional: None, hidden tensor to be used for
              recurrent layers in the prediction network
  
      Returns
      -------
      out_PN : torch.tensor
          Outputs a logits tensor [B,U, hiddens].
      hidden : torch.tensor
          Hidden tensor to be used for the next step
          by recurrent layers in prediction network.
      """
  
      for layer in decode_network_lst:
          if layer.__class__.__name__ in [
              "RNN",
              "LSTM",
              "GRU",
              "LiGRU",
              "LiGRU_Layer",
          ]:
              out_PN, hidden = layer(out_PN, hidden)
          else:
              out_PN = layer(out_PN)
      return out_PN, hidden
  
file_path: speechbrain/speechbrain/decoders/transducer.py
imports: import torch
  from functools import partial
label_desc: Use image node_id 9 for calling the TransducerBeamSearcher obj's underlying member method code with example usage: obj._forward_PN(out_PN, decode_network_lst, hidden) and returns: out_PN,  hidden