class_docstr: LM Interface for ESPnet model implementation.
docstr: Compute LM loss value from buffer sequences.
  
  Args:
      x (torch.Tensor): Input ids. (batch, len)
      t (torch.Tensor): Target ids. (batch, len)
  
  Returns:
      tuple[torch.Tensor, torch.Tensor, torch.Tensor]: Tuple of
          loss to backward (scalar),
          negative log-likelihood of t: -log p(t) (scalar) and
          the number of elements in x (scalar)
  
  Notes:
      The last two return values are used
      in perplexity: p(t)^{-n} = exp(-log p(t) / n)
docstr_tok: ["Compute","LM","loss","value","from","buffer","sequences",".","Args",":","x","(","torch.Tensor",")",":","Input","ids",".","(","batch",",","len",")","t","(","torch.Tensor",")",":","Target","ids",".","(","batch",",","len",")","Returns",":","tuple","[","torch.Tensor",",","torch.Tensor",",","torch.Tensor","]",":","Tuple","of","loss","to","backward","(","scalar",")",",","negative","log-likelihood","of","t",":","-log","p","(","t",")","(","scalar",")","and","the","number","of","elements","in","x","(","scalar",")","Notes",":","The","last","two","return","values","are","used","in","perplexity",":","p","(","t",")","^","{","-n","}","=","exp","(","-log","p","(","t",")","\/","n",")"]
code: def forward(self, x, t):
      """Compute LM loss value from buffer sequences.
  
      Args:
          x (torch.Tensor): Input ids. (batch, len)
          t (torch.Tensor): Target ids. (batch, len)
  
      Returns:
          tuple[torch.Tensor, torch.Tensor, torch.Tensor]: Tuple of
              loss to backward (scalar),
              negative log-likelihood of t: -log p(t) (scalar) and
              the number of elements in x (scalar)
  
      Notes:
          The last two return values are used
          in perplexity: p(t)^{-n} = exp(-log p(t) / n)
  
      """
      raise NotImplementedError("forward method is not implemented")
  
file_path: espnet/espnet/nets/lm_interface.py
imports: import argparse
  from espnet.nets.scorer_interface import ScorerInterface
  from espnet.utils.dynamic_import import dynamic_import
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 3 for calling the LMInterface obj's underlying member method code with example usage: obj.forward(x, t) without return types