class_docstr: Core trainable object in OpenNMT. Implements a trainable interface
  for a simple, generic encoder / decoder or decoder only model.
  
  Args:
    encoder (onmt.encoders.EncoderBase): an encoder object
    decoder (onmt.decoders.DecoderBase): a decoder object
class_docstr_tok: ["Core","trainable","object","in","OpenNMT",".","Implements","a","trainable","interface","for","a","simple",",","generic","encoder","\/","decoder","or","decoder","only","model",".","Args",":","encoder","(","onmt.encoders.EncoderBase",")",":","an","encoder","object","decoder","(","onmt.decoders.DecoderBase",")",":","a","decoder","object"]
docstr: Forward propagate a `src` and `tgt` pair for training.
  
  Args:
      src (Tensor): A source sequence passed to encoder.
          Typically for input this will be a padded `LongTensor`
          of size ``(batch, len, features)``. However, may be an
          image or other generic input depending on encoder.
      tgt (LongTensor): A target sequence passed to decoder.
          Size ``(batch, tgt_len, features)``.
      src_len(LongTensor): The src lengths, pre-padding ``(batch,)``.
      bptt (Boolean): A flag indicating if truncated bptt is set.
          If bptt is false then init decoder state.
      with_align (Boolean): A flag indicating whether output alignment,
          Only valid for transformer decoder.
  
  Returns:
      (FloatTensor, dict[str, FloatTensor]):
  
      * decoder output ``(batch, tgt_len, hidden)``
      * dictionary of attention weights ``(batch, tgt_len, src_len)``
docstr_tok: ["Forward","propagate","a","`","src","`","and","`","tgt","`","pair","for","training",".","Args",":","src","(","Tensor",")",":","A","source","sequence","passed","to","encoder",".","Typically","for","input","this","will","be","a","padded","`","LongTensor","`","of","size","``","(","batch",",","len",",","features",")","``",".","However",",","may","be","an","image","or","other","generic","input","depending","on","encoder",".","tgt","(","LongTensor",")",":","A","target","sequence","passed","to","decoder",".","Size","``","(","batch",",","tgt_len",",","features",")","``",".","src_len","(","LongTensor",")",":","The","src","lengths",",","pre-padding","``","(","batch",",",")","``",".","bptt","(","Boolean",")",":","A","flag","indicating","if","truncated","bptt","is","set",".","If","bptt","is","false","then","init","decoder","state",".","with_align","(","Boolean",")",":","A","flag","indicating","whether","output","alignment",",","Only","valid","for","transformer","decoder",".","Returns",":","(","FloatTensor",",","dict","[","str",",","FloatTensor","]",")",":","*","decoder","output","``","(","batch",",","tgt_len",",","hidden",")","``","*","dictionary","of","attention","weights","``","(","batch",",","tgt_len",",","src_len",")","``"]
code: def forward(self, src, tgt, src_len, bptt=False, with_align=False):
      """Forward propagate a `src` and `tgt` pair for training.
  
      Args:
          src (Tensor): A source sequence passed to encoder.
              Typically for input this will be a padded `LongTensor`
              of size ``(batch, len, features)``. However, may be an
              image or other generic input depending on encoder.
          tgt (LongTensor): A target sequence passed to decoder.
              Size ``(batch, tgt_len, features)``.
          src_len(LongTensor): The src lengths, pre-padding ``(batch,)``.
          bptt (Boolean): A flag indicating if truncated bptt is set.
              If bptt is false then init decoder state.
          with_align (Boolean): A flag indicating whether output alignment,
              Only valid for transformer decoder.
  
      Returns:
          (FloatTensor, dict[str, FloatTensor]):
  
          * decoder output ``(batch, tgt_len, hidden)``
          * dictionary of attention weights ``(batch, tgt_len, src_len)``
      """
  
      raise NotImplementedError
  
imports: import torch
  import torch.nn
  from glob import glob
label_desc: Use image node_id 2 for calling the BaseModel obj's underlying member method code with example usage: obj.forward(src, tgt, src_len, bptt, with_align) without return types