code: def post_preprocess_batch(
      seq2slate_net, candidate_num, batch, device, epoch
  ):
      model_propensity, model_action, reward = rank_on_policy_and_eval(
          seq2slate_net, batch, candidate_num, greedy=False
      )
      batch = rlt.PreprocessedRankingInput.from_input(
          state=batch.state.float_features,
          candidates=batch.src_seq.float_features,
          device=device,
          action=model_action,
          logged_propensities=model_propensity,
          # negate because we want to minimize
          slate_reward=-reward,
      )
      logger.info(
          f"Epoch {epoch} mean on_policy reward: {torch.mean(reward)}"
      )
      logger.info(
          f"Epoch {epoch} mean model_propensity: {torch.mean(model_propensity)}"
      )
      return batch
  
imports: import logging
  import math
  import tempfile
  from itertools import permutations
  import pytorch_lightning
  import reagent.core.types
  import torch
  import torch.nn
  from reagent.core.parameters import Seq2SlateParameters
  from reagent.core.parameters_seq2slate import LearningMethod, SimulationParameters
  from reagent.core.torch_utils import gather
  from reagent.model_utils.seq2slate_utils import Seq2SlateOutputArch
  from reagent.models.seq2slate import Seq2SlateMode, Seq2SlateTransformerNet
  from reagent.optimizer.union import Optimizer__Union
  from reagent.training.ranking.seq2slate_sim_trainer import Seq2SlateSimulationTrainer
  from reagent.training.ranking.seq2slate_trainer import Seq2SlateTrainer
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: post_preprocess_batch(seq2slate_net, candidate_num, batch, device, epoch) and returns: batch