class_docstr: Scorer interface for beam search.
  
  The scorer performs scoring of the all tokens in vocabulary.
  
  Examples:
      * Search heuristics
          * :class:`espnet.nets.scorers.length_bonus.LengthBonus`
      * Decoder networks of the sequence-to-sequence models
          * :class:`espnet.nets.pytorch_backend.nets.transformer.decoder.Decoder`
          * :class:`espnet.nets.pytorch_backend.nets.rnn.decoders.Decoder`
      * Neural language models
          * :class:`espnet.nets.pytorch_backend.lm.transformer.TransformerLM`
          * :class:`espnet.nets.pytorch_backend.lm.default.DefaultRNNLM`
          * :class:`espnet.nets.pytorch_backend.lm.seq_rnn.SequentialRNNLM`
class_docstr_tok: ["Scorer","interface","for","beam","search",".","The","scorer","performs","scoring","of","the","all","tokens","in","vocabulary",".","Examples",":","*","Search","heuristics","*",":","class",":","`","espnet.nets.scorers.length_bonus.LengthBonus","`","*","Decoder","networks","of","the","sequence-to-sequence","models","*",":","class",":","`","espnet.nets.pytorch_backend.nets.transformer.decoder.Decoder","`","*",":","class",":","`","espnet.nets.pytorch_backend.nets.rnn.decoders.Decoder","`","*","Neural","language","models","*",":","class",":","`","espnet.nets.pytorch_backend.lm.transformer.TransformerLM","`","*",":","class",":","`","espnet.nets.pytorch_backend.lm.default.DefaultRNNLM","`","*",":","class",":","`","espnet.nets.pytorch_backend.lm.seq_rnn.SequentialRNNLM","`"]
docstr: Select state with relative ids in the main beam search.
  
  Args:
      state: Decoder state for prefix tokens
      i (int): Index to select a state in the main beam search
      new_id (int): New label index to select a state if necessary
  
  Returns:
      state: pruned state
docstr_tok: ["Select","state","with","relative","ids","in","the","main","beam","search",".","Args",":","state",":","Decoder","state","for","prefix","tokens","i","(","int",")",":","Index","to","select","a","state","in","the","main","beam","search","new_id","(","int",")",":","New","label","index","to","select","a","state","if","necessary","Returns",":","state",":","pruned","state"]
code: def select_state(self, state: Any, i: int, new_id: int = None) -> Any:
      """Select state with relative ids in the main beam search.
  
      Args:
          state: Decoder state for prefix tokens
          i (int): Index to select a state in the main beam search
          new_id (int): New label index to select a state if necessary
  
      Returns:
          state: pruned state
  
      """
      return None if state is None else state[i]
  
file_path: espnet/espnet/nets/scorer_interface.py
imports: import warnings
  from typing import Any, List, Tuple
  import torch
label_desc: Use image node_id 2 for calling the ScorerInterface obj's underlying member method code with example usage: obj.select_state(state, i, new_id) and returns: unknown