class_docstr: Base class for Synthetic Reward net builder.
class_docstr_tok: ["Base","class","for","Synthetic","Reward","net","builder","."]
docstr: Returns a TorchScript predictor module
docstr_tok: ["Returns","a","TorchScript","predictor","module"]
code: def build_serving_module(
      self,
      seq_len: int,
      synthetic_reward_network: ModelBase,
      state_normalization_data: NormalizationData,
      action_normalization_data: Optional[NormalizationData] = None,
      discrete_action_names: Optional[List[str]] = None,
      # sparse state features will be read from state_feature_config
      state_feature_config: Optional[rlt.ModelFeatureConfig] = None,
      # sparse action features will be read from action_feature_config
      action_feature_config: Optional[rlt.ModelFeatureConfig] = None,
  ) -> torch.nn.Module:
      """
      Returns a TorchScript predictor module
      """
      state_preprocessor = Preprocessor(
          state_normalization_data.dense_normalization_parameters
      )
      if not discrete_action_names:
          assert action_normalization_data is not None
          action_preprocessor = Preprocessor(
              action_normalization_data.dense_normalization_parameters
          )
          return SyntheticRewardPredictorWrapper(
              seq_len,
              state_preprocessor,
              action_preprocessor,
              synthetic_reward_network.export_mlp().cpu().eval(),
          )
      else:
          # TODO add Discrete Single Step Synthetic Reward Predictor
          return torch.jit.script(torch.nn.Linear(1, 1))
  
file_path: ReAgent/reagent/net_builder/synthetic_reward_net_builder.py
imports: import abc
  from typing import List, Optional
  import reagent.core.types
  import torch
  from reagent.core.fb_checker import IS_FB_ENVIRONMENT
  from reagent.core.parameters import NormalizationData
  from reagent.models.base import ModelBase
  from reagent.preprocessing.preprocessor import Preprocessor
label_desc: Use image node_id 2 for calling the SyntheticRewardNetBuilder obj's underlying member method code with example usage: obj.build_serving_module(seq_len, synthetic_reward_network, state_normalization_data, action_normalization_data, discrete_action_names, state_feature_config, action_feature_config) and returns: SyntheticRewardPredictorWrapper, torch