original_docstring: 
          At training, teacher forcing is True.
          if teacher_forcing is True, dec_maxlen must be given.
          
docstring: At training, teacher forcing is True.
  if teacher_forcing is True, dec_maxlen must be given.
docstring_tokens: At training teacher forcing is True . if teacher_forcing is True dec_maxlen must be given .
code: def forward(self, x, seqlens, decoder_inputs, teacher_forcing=True, dec_maxlen=None):
          '''
          At training, teacher forcing is True.
          if teacher_forcing is True, dec_maxlen must be given.
          '''
          last_hidden = self.encoder(x, seqlens)
          h0 = last_hidden.unsqueeze(0)
  
          if teacher_forcing:
              logits, y_hat, h0 = self.decoder(decoder_inputs, h0)
          else:
              logits, y_hat = [], []
              for t in range(dec_maxlen):
                  _logits, _y_hat, h0 = self.decoder(decoder_inputs[:, t:t + 1, :],
                                                     h0)  # logits: (N, 1, V), y_hat: (N, 1)
                  logits.append(_logits)
                  y_hat.append(_y_hat)
                  if _y_hat.sum(1) == 0: break  # all samples reach padding.
  
              logits = torch.cat(logits, 1)
              y_hat = torch.cat(y_hat, 1)
  
          return logits, y_hat
code_tokens: def forward ( self , x , seqlens , decoder_inputs , teacher_forcing = True , dec_maxlen = None ) : last_hidden = self . encoder ( x , seqlens ) h0 = last_hidden . unsqueeze ( 0 ) if teacher_forcing : logits , y_hat , h0 = self . decoder ( decoder_inputs , h0 ) else : logits , y_hat = [ ] , [ ] for t in range ( dec_maxlen ) : _logits , _y_hat , h0 = self . decoder ( decoder_inputs [ : , t : t + 1 , : ] , h0 ) logits . append ( _logits ) y_hat . append ( _y_hat ) if _y_hat . sum ( 1 ) == 0 : break logits = torch . cat ( logits , 1 ) y_hat = torch . cat ( y_hat , 1 ) return logits , y_hat
short_docstring: At training, teacher forcing is True.
short_docstring_tokens: At training teacher forcing is True .
comment: '''
          At training, teacher forcing is True.
          if teacher_forcing is True, dec_maxlen must be given.
          '''$SEP$# logits: (N, 1, V), y_hat: (N, 1)$SEP$# all samples reach padding.