class_docstr: Batch scorer interface.
class_docstr_tok: ["Batch","scorer","interface","."]
docstr: Score new token batch (required).
  
  Args:
      ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen).
      states (List[Any]): Scorer states for prefix tokens.
      xs (torch.Tensor):
          The encoder feature that generates ys (n_batch, xlen, n_feat).
  
  Returns:
      tuple[torch.Tensor, List[Any]]: Tuple of
          batchfied scores for next token with shape of `(n_batch, n_vocab)`
          and next state list for ys.
docstr_tok: ["Score","new","token","batch","(","required",")",".","Args",":","ys","(","torch.Tensor",")",":","torch.int64","prefix","tokens","(","n_batch",",","ylen",")",".","states","(","List","[","Any","]",")",":","Scorer","states","for","prefix","tokens",".","xs","(","torch.Tensor",")",":","The","encoder","feature","that","generates","ys","(","n_batch",",","xlen",",","n_feat",")",".","Returns",":","tuple","[","torch.Tensor",",","List","[","Any","]","]",":","Tuple","of","batchfied","scores","for","next","token","with","shape","of","`","(","n_batch",",","n_vocab",")","`","and","next","state","list","for","ys","."]
code: def batch_score(
      self, ys: torch.Tensor, states: List[Any], xs: torch.Tensor
  ) -> Tuple[torch.Tensor, List[Any]]:
      """Score new token batch (required).
  
      Args:
          ys (torch.Tensor): torch.int64 prefix tokens (n_batch, ylen).
          states (List[Any]): Scorer states for prefix tokens.
          xs (torch.Tensor):
              The encoder feature that generates ys (n_batch, xlen, n_feat).
  
      Returns:
          tuple[torch.Tensor, List[Any]]: Tuple of
              batchfied scores for next token with shape of `(n_batch, n_vocab)`
              and next state list for ys.
  
      """
      warnings.warn(
          "{} batch score is implemented through for loop not parallelized".format(
              self.__class__.__name__
          )
      )
      scores = list()
      outstates = list()
      for i, (y, state, x) in enumerate(zip(ys, states, xs)):
          score, outstate = self.score(y, state, x)
          outstates.append(outstate)
          scores.append(score)
      scores = torch.cat(scores, 0).view(ys.shape[0], -1)
      return scores, outstates
  
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 BatchScorerInterface obj's underlying member method code with example usage: obj.batch_score(ys, states, xs) and returns: scores,  outstates