class_docstr: Default RNNLM for `LMInterface` Implementation.
  
  Note:
      PyTorch seems to have memory leak when one GPU compute this after data parallel.
      If parallel GPUs compute this, it seems to be fine.
      See also https://github.com/espnet/espnet/issues/1075
class_docstr_tok: ["Default","RNNLM","for","`","LMInterface","`","Implementation",".","Note",":","PyTorch","seems","to","have","memory","leak","when","one","GPU","compute","this","after","data","parallel",".","If","parallel","GPUs","compute","this",",","it","seems","to","be","fine",".","See","also","https",":","\/\/github.com\/espnet\/espnet\/issues\/1075"]
docstr: Score new token.
  
  Args:
      y (torch.Tensor): 1D torch.int64 prefix tokens.
      state: Scorer state for prefix tokens
      x (torch.Tensor): 2D encoder feature that generates ys.
  
  Returns:
      tuple[torch.Tensor, Any]: Tuple of
          torch.float32 scores for next token (n_vocab)
          and next state for ys
docstr_tok: ["Score","new","token",".","Args",":","y","(","torch.Tensor",")",":","1D","torch.int64","prefix","tokens",".","state",":","Scorer","state","for","prefix","tokens","x","(","torch.Tensor",")",":","2D","encoder","feature","that","generates","ys",".","Returns",":","tuple","[","torch.Tensor",",","Any","]",":","Tuple","of","torch.float32","scores","for","next","token","(","n_vocab",")","and","next","state","for","ys"]
code: def score(self, y, state, x):
      """Score new token.
  
      Args:
          y (torch.Tensor): 1D torch.int64 prefix tokens.
          state: Scorer state for prefix tokens
          x (torch.Tensor): 2D encoder feature that generates ys.
  
      Returns:
          tuple[torch.Tensor, Any]: Tuple of
              torch.float32 scores for next token (n_vocab)
              and next state for ys
  
      """
      new_state, scores = self.model.predict(state, y[-1].unsqueeze(0))
      return scores.squeeze(0), new_state
  
imports: import logging
  from typing import Any, List, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from espnet.nets.lm_interface import LMInterface
  from espnet.nets.pytorch_backend.e2e_asr import to_device
  from espnet.nets.scorer_interface import BatchScorerInterface
  from espnet.utils.cli_utils import strtobool
label_desc: Use image node_id 6 for calling the DefaultRNNLM obj's underlying member method code with example usage: obj.score(y, state, x) and returns: scores,  new_state