class_docstr: Train models to attribute single step rewards from sparse/delayed/aggregated rewards.
  Ideas from:
  1. Synthetic Returns for Long-Term Credit Assignment: https://arxiv.org/pdf/2102.12425.pdf
  2. RUDDER: Return Decomposition for Delayed Rewards: https://arxiv.org/pdf/1806.07857.pdf
  3. Optimizing Agent Behavior over Long Time Scales by Transporting Value: https://arxiv.org/pdf/1810.06721.pdf
  4. Sequence Modeling of Temporal Credit Assignment for Episodic Reinforcement Learning: https://arxiv.org/pdf/1905.13420.pdf
class_docstr_tok: ["Train","models","to","attribute","single","step","rewards","from","sparse\/delayed\/aggregated","rewards",".","Ideas","from",":","1",".","Synthetic","Returns","for","Long-Term","Credit","Assignment",":","https",":","\/\/arxiv.org\/pdf\/2102.12425.pdf","2",".","RUDDER",":","Return","Decomposition","for","Delayed","Rewards",":","https",":","\/\/arxiv.org\/pdf\/1806.07857.pdf","3",".","Optimizing","Agent","Behavior","over","Long","Time","Scales","by","Transporting","Value",":","https",":","\/\/arxiv.org\/pdf\/1810.06721.pdf","4",".","Sequence","Modeling","of","Temporal","Credit","Assignment","for","Episodic","Reinforcement","Learning",":","https",":","\/\/arxiv.org\/pdf\/1905.13420.pdf"]
docstr: Returns a TorchScript predictor module
docstr_tok: ["Returns","a","TorchScript","predictor","module"]
code: def build_serving_module(
      self,
      trainer_module: ReAgentLightningModule,
      normalization_data_map: Dict[str, NormalizationData],
  ) -> torch.nn.Module:
      """
      Returns a TorchScript predictor module
      """
      assert isinstance(trainer_module, RewardNetTrainer)
  
      net_builder = self.net_builder.value
      action_normalization_data = None
      if not self.discrete_action_names:
          action_normalization_data = normalization_data_map[
              NormalizationKey.ACTION
          ]
      return net_builder.build_serving_module(
          self.max_seq_len,
          trainer_module.reward_net,
          normalization_data_map[NormalizationKey.STATE],
          action_normalization_data=action_normalization_data,
          discrete_action_names=self.discrete_action_names,
          state_feature_config=self.state_feature_config,
          action_feature_config=self.parametric_action_feature_config,
      )
  
imports: import logging
  from dataclasses import replace
  from typing import Dict, List, Optional, Tuple
  import reagent.core.types
  import torch
  from reagent.core.dataclasses import dataclass, field
  from reagent.core.parameters import EvaluationParameters, NormalizationData, NormalizationKey, param_hash
  from reagent.data.data_fetcher import DataFetcher
  from reagent.data.manual_data_module import ManualDataModule
  from reagent.data.reagent_data_module import ReAgentDataModule
  from reagent.model_managers.model_manager import ModelManager
  from reagent.net_builder.synthetic_reward.single_step_synthetic_reward import SingleStepSyntheticReward
  from reagent.net_builder.unions import SyntheticRewardNetBuilder__Union
  from reagent.preprocessing.types import InputColumn
  from reagent.reporting.reward_network_reporter import RewardNetworkReporter
  from reagent.training import ReAgentLightningModule, RewardNetTrainer, RewardNetworkTrainerParameters
  from reagent.workflow.identify_types_flow import identify_normalization_parameters
  from reagent.workflow.types import Dataset, PreprocessingOptions, ReaderOptions, ResourceOptions, RewardOptions, TableSpec
label_desc: Use image node_id 5 for calling the SyntheticReward obj's underlying member method code with example usage: obj.build_serving_module(trainer_module, normalization_data_map) and returns: net_builder