code: def _get_sample_weight(self, batch: rlt.PreprocessedRankingInput):
      weight = None
      if self.weighted_by_inverse_propensity:
          if isinstance(batch, rlt.PreprocessedRankingInput):
              assert batch.tgt_out_probs is not None
              # pyre-fixme[58]: `/` is not supported for operand types `float` and
              #  `Tensor`.
              weight = 1.0 / batch.tgt_out_probs
          else:
              raise NotImplementedError(
                  f"Sampling weighting not implemented for {type(batch)}"
              )
      return weight
  
imports: import logging
  from enum import Enum
  from typing import Optional
  import numpy
  import reagent.core.types
  import torch
  from reagent.core.dataclasses import field
  from reagent.models.base import ModelBase
  from reagent.optimizer.union import Optimizer__Union
  from reagent.training.reagent_lightning_module import ReAgentLightningModule
label_desc: Use image node_id 3 for calling the RewardNetTrainer obj's underlying member method code with example usage: obj._get_sample_weight(batch) and returns: weight