class_docstr: This base class provides basic operations to consume inputs and call a synthetic reward net
  
  A synthetic reward net (self.net) assumes the input contains only torch.Tensors.
  Expected input shape:
      state: seq_len, batch_size, state_dim
      action: seq_len, batch_size, action_dim
  Expected output shape:
      reward: batch_size, seq_len
class_docstr_tok: ["This","base","class","provides","basic","operations","to","consume","inputs","and","call","a","synthetic","reward","net","A","synthetic","reward","net","(","self.net",")","assumes","the","input","contains","only","torch.Tensors",".","Expected","input","shape",":","state",":","seq_len",",","batch_size",",","state_dim","action",":","seq_len",",","batch_size",",","action_dim","Expected","output","shape",":","reward",":","batch_size",",","seq_len"]
code: def forward(self, training_batch: rlt.MemoryNetworkInput):
      # state shape: seq_len, batch_size, state_dim
      state = training_batch.state.float_features
      # action shape: seq_len, batch_size, action_dim
      action = training_batch.action.float_features
  
      # shape: batch_size, 1
      valid_step = training_batch.valid_step
      (
          seq_len,
          batch_size,
          _,
      ) = training_batch.action.float_features.shape
  
      # output shape: batch_size, seq_len
      output = self.net(state, action)
      assert valid_step is not None
      mask = _gen_mask(valid_step, batch_size, seq_len)
      output_masked = output * mask
  
      pred_reward = output_masked.sum(dim=1, keepdim=True)
      return rlt.SyntheticRewardNetworkOutput(
          predicted_reward=pred_reward,
          mask=mask,
          output=output,
      )
  
imports: import logging
  import math
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from reagent.core import parameters, types
  from reagent.models import convolutional_network, fully_connected_network
  from reagent.models.base import ModelBase
  from reagent.models.fully_connected_network import ACTIVATION_MAP
label_desc: Use image node_id 2 for calling the SyntheticRewardNet obj's underlying member method code with example usage: obj.forward(training_batch) and returns: rlt