class_docstr: Run simulated and real env side-by-side for comparison.
  
  Displays three windows - one for real environment, second for simulated
  and third for their differences.
  
  Normal actions are passed to both environments.
  
  Special Actions:
    RESTART_SIMULATED_ENV_ACTION: restart simulated environment only, using
      current frames from real environment.
    See `PlayerEnv` for rest of special actions.
  
  Naming conventions:
    envs_step_tuples: dictionary with two keys.
    {
      "real_env": (observation, reward, done, info),
      "sim_env": (observation, reward, done, info)
    }
class_docstr_tok: ["Run","simulated","and","real","env","side-by-side","for","comparison",".","Displays","three","windows","-","one","for","real","environment",",","second","for","simulated","and","third","for","their","differences",".","Normal","actions","are","passed","to","both","environments",".","Special","Actions",":","RESTART_SIMULATED_ENV_ACTION",":","restart","simulated","environment","only",",","using","current","frames","from","real","environment",".","See","`","PlayerEnv","`","for","rest","of","special","actions",".","Naming","conventions",":","envs_step_tuples",":","dictionary","with","two","keys",".","{","``","real_env","''",":","(","observation",",","reward",",","done",",","info",")",",","``","sim_env","''",":","(","observation",",","reward",",","done",",","info",")","}"]
docstr: Init.
  
  Args:
    real_env: real environment such as `FlatBatchEnv<T2TGymEnv>`.
    sim_env: simulation of `real_env` to be compared with. E.g.
      `SimulatedGymEnv` must allow to update initial frames for next reset
      with `add_to_initial_stack` method.
    action_meanings: list of strings indicating action names. Can be obtain by
      >>> env = gym.make("PongNoFrameskip-v4")  # insert your game name
      >>> env.unwrapped.get_action_meanings()
      See gym AtariEnv get_action_meanings() for more details.
docstr_tok: ["Init",".","Args",":","real_env",":","real","environment","such","as","`","FlatBatchEnv","<","T2TGymEnv",">","`",".","sim_env",":","simulation","of","`","real_env","`","to","be","compared","with",".","E.g",".","`","SimulatedGymEnv","`","must","allow","to","update","initial","frames","for","next","reset","with","`","add_to_initial_stack","`","method",".","action_meanings",":","list","of","strings","indicating","action","names",".","Can","be","obtain","by",">",">",">","env","=","gym.make","(","``","PongNoFrameskip-v4","''",")","#","insert","your","game","name",">",">",">","env.unwrapped.get_action_meanings","(",")","See","gym","AtariEnv","get_action_meanings","(",")","for","more","details","."]
code: def __init__(self, real_env, sim_env, action_meanings):
      """Init.
  
      Args:
        real_env: real environment such as `FlatBatchEnv<T2TGymEnv>`.
        sim_env: simulation of `real_env` to be compared with. E.g.
          `SimulatedGymEnv` must allow to update initial frames for next reset
          with `add_to_initial_stack` method.
        action_meanings: list of strings indicating action names. Can be obtain by
          >>> env = gym.make("PongNoFrameskip-v4")  # insert your game name
          >>> env.unwrapped.get_action_meanings()
          See gym AtariEnv get_action_meanings() for more details.
      """
      super(SimAndRealEnvPlayer, self).__init__(action_meanings)
      assert (
          real_env.observation_space.shape
          == sim_env.observation_space.shape
      )
      self.real_env = real_env
      self.sim_env = sim_env
      orig = self.real_env.observation_space
      # Observation consists three side-to-side images - simulated environment
      # observation, real environment observation and difference between these
      # two.
      shape = (
          orig.shape[0] + self.HEADER_HEIGHT,
          orig.shape[1] * 3,
          orig.shape[2],
      )
  
      self.observation_space = gym.spaces.Box(
          low=orig.low.min(),
          high=orig.high.max(),
          shape=shape,
          dtype=orig.dtype,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gym
  from gym.utils import play
  import numpy
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.rl import player_utils
  from tensor2tensor.rl.envs.simulated_batch_env import PIL_Image
  from tensor2tensor.rl.envs.simulated_batch_env import PIL_ImageDraw
  from tensor2tensor.rl.envs.simulated_batch_gym_env import FlatBatchEnv
  from tensor2tensor.rl.rl_utils import absolute_hinge_difference
  from tensor2tensor.rl.rl_utils import full_game_name
  import tensor2tensor.rl.trainer_model_based_params
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 1 to create a new SimAndRealEnvPlayer object from inherited base classes: PlayerEnv with example: obj = SimAndRealEnvPlayer(real_env, sim_env, action_meanings)