code: def rlestimator_input_to_edp(
      input: RLEstimatorInput, num_actions: int
  ) -> EvaluationDataPage:
      mdp_ids = []
      logged_propensities = []
      logged_rewards = []
      action_mask = []
      model_propensities = []
      model_values = []
  
      for mdp in input.log:
          mdp_id = len(mdp_ids)
          for t in mdp:
              mdp_ids.append(mdp_id)
              logged_propensities.append(t.action_prob)
              logged_rewards.append(t.reward)
              assert t.action is not None
              action_mask.append(
                  [
                      1 if x == t.action.value else 0
                      for x in range(num_actions)
                  ]
              )
              assert t.last_state is not None
              model_propensities.append(
                  [
                      input.target_policy(t.last_state)[Action(x)]
                      for x in range(num_actions)
                  ]
              )
              assert input.value_function is not None
              model_values.append(
                  [
                      input.value_function(t.last_state, Action(x))
                      for x in range(num_actions)
                  ]
              )
  
      return EvaluationDataPage(
          mdp_id=torch.tensor(mdp_ids).reshape(len(mdp_ids), 1),
          logged_propensities=torch.tensor(logged_propensities).reshape(
              (len(logged_propensities), 1)
          ),
          logged_rewards=torch.tensor(logged_rewards).reshape(
              (len(logged_rewards), 1)
          ),
          action_mask=torch.tensor(action_mask),
          model_propensities=torch.tensor(model_propensities),
          model_values=torch.tensor(model_values),
          sequence_number=torch.tensor([]),
          model_rewards=torch.tensor([]),
          model_rewards_for_logged_action=torch.tensor([]),
      )
  
imports: import logging
  import random
  import unittest
  import numpy
  import torch
  from reagent.core import types
  from reagent.evaluation.evaluation_data_page import EvaluationDataPage
  from reagent.evaluation.ope_adapter import OPEstimatorAdapter, SequentialOPEstimatorAdapter
  from reagent.ope.estimators.contextual_bandits_estimators import DMEstimator, DoublyRobustEstimator, IPSEstimator, SwitchDREstimator, SwitchEstimator
  from reagent.ope.estimators.sequential_estimators import DoublyRobustEstimator, EpsilonGreedyRLPolicy, RandomRLPolicy, RLEstimatorInput
  from reagent.ope.estimators.types import Action, ActionSpace
  from reagent.ope.test.envs import PolicyLogGenerator
  from reagent.ope.test.gridworld import GridWorld, NoiseGridWorldModel
  from reagent.ope.trainers.rl_tabular_trainers import DPTrainer, DPValueFunction, TabularPolicy
  from reagent.test.evaluation.test_evaluation_data_page import FakeSeq2SlateRewardNetwork, FakeSeq2SlateTransformerNet
label_desc: Use image node_id 1 for calling a global function with example usage: rlestimator_input_to_edp(input, num_actions) and returns: EvaluationDataPage