code: def forward(self, inputs, mask=None):
      # inputs: [batch_size, seq_size, hidden_size]
      batch_size = inputs.shape[0]
      # gather the correct outputs from the the RNN outputs (the outputs after sequence_length are all 0s)
      # todo: review for generality
      sequence_length = sequence_length_3D(inputs) - 1
      sequence_length[sequence_length < 0] = 0
      gathered = inputs[
          torch.arange(batch_size), sequence_length.type(torch.int64)
      ]
      return gathered
  
imports: import logging
  import torch
  from ludwig.modules.attention_modules import FeedForwardAttentionReducer
  from ludwig.utils.misc_utils import get_from_registry
  from ludwig.utils.torch_utils import LudwigModule, sequence_length_3D
label_desc: Use image node_id 1 for calling the ReduceLast obj's underlying member method code with example usage: obj.forward(inputs, mask) and returns: gathered