code: def edp_to_rl_input(
      edp: EvaluationDataPage, gamma, device=None
  ) -> RLEstimatorInput:
      assert edp.model_values is not None
      eq_len = WeightedSequentialDoublyRobustEstimator.transform_to_equal_length_trajectories(
          edp.mdp_id,
          edp.action_mask.cpu().numpy(),
          edp.logged_rewards.cpu().numpy().flatten(),
          edp.logged_propensities.cpu().numpy().flatten(),
          edp.model_propensities.cpu().numpy(),
          # pyre-ignore [16]: Optional type has no attribute `cpu`
          edp.model_values.cpu().numpy(),
      )
  
      (
          actions,
          rewards,
          logged_propensities,
          target_propensities,
          estimated_q_values,
      ) = (
          torch.tensor(
              x, dtype=torch.double, device=device, requires_grad=True
          )
          for x in eq_len
      )
  
      num_examples = logged_propensities.shape[0]
      horizon = logged_propensities.shape[1]
  
      log = []
      for traj in range(num_examples):
          log.append(
              [
                  Transition(
                      last_state=State((traj, i)),
                      # pyre-fixme[6]: For 2nd param expected
                      #  `Optional[TypeWrapper[Union[Tuple[float], Tuple[int], float,
                      #  int, ndarray, Tensor]]]` but got `Union[bool, float, int]`.
                      action=torch.argmax(actions[traj, i]).item(),
                      action_prob=logged_propensities[traj, i].item(),
                      state=State((traj, i + 1)),
                      reward=rewards[traj, i].item(),
                  )
                  for i in range(horizon - 1)
                  # pyre-fixme[6]: For 1st param expected `Union[None,
                  #  List[typing.Any], int, slice, Tensor, typing.Tuple[typing.Any,
                  #  ...]]` but got `Union[bool, float, int]`.
                  if actions[traj, i][
                      torch.argmax(actions[traj, i]).item()
                  ]
                  != 0.0
              ]
          )
  
      return RLEstimatorInput(
          gamma=gamma,
          log=log,
          target_policy=SequentialOPEstimatorAdapter.EDPSeqPolicy(
              actions.shape[2], target_propensities
          ),
          value_function=SequentialOPEstimatorAdapter.EDPValueFunc(
              estimated_q_values, target_propensities
          ),
          ground_truth=None,
          horizon=horizon,
      )
  
imports: import logging
  import torch
  from reagent.evaluation.cpe import bootstrapped_std_error_of_mean, CpeEstimate, CpeEstimateSet
  from reagent.evaluation.evaluation_data_page import EvaluationDataPage
  from reagent.evaluation.evaluator import Evaluator
  from reagent.evaluation.weighted_sequential_doubly_robust_estimator import WeightedSequentialDoublyRobustEstimator
  from reagent.ope.estimators.contextual_bandits_estimators import BanditsEstimatorInput, DMEstimator, DoublyRobustEstimator, IPSEstimator, LogSample, ModelOutputs
  from reagent.ope.estimators.estimator import Estimator, EstimatorResult, EstimatorResults
  from reagent.ope.estimators.sequential_estimators import Action, ActionDistribution, DoublyRobustEstimator, MAGICEstimator, RLEstimator, RLEstimatorInput, RLPolicy, State, Transition, ValueFunction
  from reagent.ope.estimators.types import ActionSpace
label_desc: Use image node_id 2 for calling the SequentialOPEstimatorAdapter obj's underlying member method code with example usage: obj.edp_to_rl_input(edp, gamma, device) and returns: RLEstimatorInput