docstr: Score new token.
  
  Args:
      y (torch.Tensor): 1D torch.int64 prefix tokens.
      state: Scorer state for prefix tokens
      x (torch.Tensor): encoder feature that generates ys.
  
  Returns:
      tuple[torch.Tensor, Any]: Tuple of
          torch.float32 scores for next token (vocab_size)
          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",")",":","encoder","feature","that","generates","ys",".","Returns",":","tuple","[","torch.Tensor",",","Any","]",":","Tuple","of","torch.float32","scores","for","next","token","(","vocab_size",")","and","next","state","for","ys"]
code: def score(
      self, y: torch.Tensor, state: Any, x: torch.Tensor
  ) -> Tuple[torch.Tensor, Any]:
      """Score new token.
  
      Args:
          y (torch.Tensor): 1D torch.int64 prefix tokens.
          state: Scorer state for prefix tokens
          x (torch.Tensor): encoder feature that generates ys.
  
      Returns:
          tuple[torch.Tensor, Any]: Tuple of
              torch.float32 scores for next token (vocab_size)
              and next state for ys
  
      """
      y = y.unsqueeze(0)
      h, _, cache = self.encoder.forward_one_step(
          self.embed(y), self._target_mask(y), cache=state
      )
      h = self.decoder(h[:, -1])
      logp = h.log_softmax(dim=-1).squeeze(0)
      return logp, cache
  
file_path: espnet/espnet2/lm/transformer_lm.py
imports: from typing import Any, List, Tuple
  import torch
  import torch.nn
  from espnet2.lm.abs_model import AbsLM
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
  from espnet.nets.pytorch_backend.transformer.mask import subsequent_mask
label_desc: Use image node_id 4 for calling the TransformerLM obj's underlying member method code with example usage: obj.score(y, state, x) and returns: logp,  cache