code: def __init__(
      self,
      gym_env: EnvWrapper,
      mdnrnn: MemoryNetwork,
      max_embed_seq_len: int,
      state_min_value: Optional[float] = None,
      state_max_value: Optional[float] = None,
  ):
      self.env = gym_env
      self.unwrapped.spec = self.env.unwrapped.spec
      self.max_embed_seq_len = max_embed_seq_len
      self.mdnrnn = mdnrnn
      self.embed_size = self.mdnrnn.num_hiddens
      self.raw_state_dim = self.env.observation_space.shape[0]  # type: ignore
      self.state_dim = self.embed_size + self.raw_state_dim
      if isinstance(self.env.action_space, gym.spaces.Discrete):
          self.is_discrete_action = True
          self.action_dim = self.env.action_space.n
      elif isinstance(self.env.action_space, gym.spaces.Box):
          self.is_discrete_action = False
          self.action_dim = self.env.action_space.shape[0]
  
      self.action_space = self.env.action_space
  
      # only need to set up if needed
      if state_min_value is None or state_max_value is None:
          state_min_value = np.min(gym_env.observation_space.low)
          state_max_value = np.max(gym_env.observation_space.high)
  
      self.observation_space = Box(  # type: ignore
          low=state_min_value,
          high=state_max_value,
          shape=(self.state_dim,),
      )
  
      self.cur_raw_state = None
      self.recent_states = deque([], maxlen=self.max_embed_seq_len)  # type: ignore
      self.recent_actions = deque([], maxlen=self.max_embed_seq_len)
  
file_path: ReAgent/reagent/gym/envs/pomdp/state_embed_env.py
imports: import logging
  from collections import deque
  from typing import Optional
  import gym
  import numpy
  import reagent.core.types
  import torch
  from gym.spaces import Box
  from reagent.gym.envs import EnvWrapper
  from reagent.models.world_model import MemoryNetwork
label_desc: Use image node_id 1 to create a new StateEmbedEnvironment object from inherited base classes: gym with example: obj = StateEmbedEnvironment(gym_env, mdnrnn, max_embed_seq_len, state_min_value, state_max_value)