code: def forward(self, encoder_output):
      # [source_length, batch_size, encoder_output_dim]
      encoder_hiddens, *_ = encoder_output
      assert encoder_hiddens.dim()
  
      if self.use_self_attention:
          # [batch_size, hidden_dim]
          init_state = self._get_init_state(encoder_hiddens)
          # [source_length, batch_size, 1]
          attn_scores = self._attention(encoder_hiddens, init_state)
          # [batch_size, hidden_dim]
          attned_state = (encoder_hiddens * attn_scores).sum(0)
  
          pred_input = torch.cat([init_state, attned_state], 1)
          pred_hidden = F.relu(self.hidden_layer(pred_input))
          # [batch_size, vocab_size]
          logits = self.output_layer(pred_hidden)
      else:
          # [source_length, batch_size, hidden_dim]
          hidden = F.relu(self.hidden_layer(encoder_hiddens))
          # [batch_size, hidden_dim]
          mean_hidden = torch.mean(hidden, 0)
          max_hidden = torch.max(hidden, 0)[0]
          # [batch_size, vocab_size]
          logits = self.output_layer(mean_hidden + max_hidden)
  
      return logits
  
file_path: translate/pytorch_translate/word_prediction/word_predictor.py
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the WordPredictor obj's underlying member method code with example usage: obj.forward(encoder_output) and returns: logits