docstr: Forward pass of Seq2Reward
  
  Takes in the current state and use it as init hidden
  The input sequence are pure actions only
  Output the predicted reward after each time step
  
  :param actions: (SEQ_LEN, BATCH_SIZE, ACTION_DIM) torch tensor
  :param states: (SEQ_LEN, BATCH_SIZE, STATE_DIM) torch tensor
  :param valid_reward_len: (BATCH_SIZE,) torch tensor
  
  :returns: predicated accumulated rewards at last step for the given sequence
      - acc_reward: (BATCH_SIZE, 1) torch tensor
docstr_tok: ["Forward","pass","of","Seq2Reward","Takes","in","the","current","state","and","use","it","as","init","hidden","The","input","sequence","are","pure","actions","only","Output","the","predicted","reward","after","each","time","step",":","param","actions",":","(","SEQ_LEN",",","BATCH_SIZE",",","ACTION_DIM",")","torch","tensor",":","param","states",":","(","SEQ_LEN",",","BATCH_SIZE",",","STATE_DIM",")","torch","tensor",":","param","valid_reward_len",":","(","BATCH_SIZE",",",")","torch","tensor",":","returns",":","predicated","accumulated","rewards","at","last","step","for","the","given","sequence","-","acc_reward",":","(","BATCH_SIZE",",","1",")","torch","tensor"]
code: def forward(
      self,
      state: rlt.FeatureData,
      action: rlt.FeatureData,
      valid_reward_len: Optional[torch.Tensor] = None,
  ):
      """Forward pass of Seq2Reward
  
      Takes in the current state and use it as init hidden
      The input sequence are pure actions only
      Output the predicted reward after each time step
  
      :param actions: (SEQ_LEN, BATCH_SIZE, ACTION_DIM) torch tensor
      :param states: (SEQ_LEN, BATCH_SIZE, STATE_DIM) torch tensor
      :param valid_reward_len: (BATCH_SIZE,) torch tensor
  
      :returns: predicated accumulated rewards at last step for the given sequence
          - acc_reward: (BATCH_SIZE, 1) torch tensor
      """
      states = state.float_features
      actions = action.float_features
      batch_size = states.shape[1]
      hidden = self.get_initial_hidden_state(
          states[0][None, :, :], batch_size=batch_size
      )
      # all_steps_hidden shape: seq_len, batch_size, hidden_size
      all_steps_hidden, _ = self.rnn(actions, hidden)
      if valid_reward_len is None:
          acc_reward = self.lstm_linear(all_steps_hidden[-1])
      else:
          valid_step_hidden = all_steps_hidden[
              valid_reward_len - 1, torch.arange(batch_size)
          ]
          acc_reward = self.lstm_linear(valid_step_hidden)
  
      return rlt.Seq2RewardOutput(acc_reward=acc_reward)
  
file_path: ReAgent/reagent/models/seq2reward_model.py
imports: from typing import Optional
  import torch
  import torch.nn
  from reagent.core import types
  from reagent.models.base import ModelBase
label_desc: Use image node_id 3 for calling the Seq2RewardNetwork obj's underlying member method code with example usage: obj.forward(state, action, valid_reward_len) and returns: rlt