class_docstr: An environment wrapper for normalization.
  
  This wrapper normalizes action, and optionally observation and reward.
  
  Args:
      env (Environment): An environment instance.
      scale_reward (float): Scale of environment reward.
      normalize_obs (bool): If True, normalize observation.
      normalize_reward (bool): If True, normalize reward. scale_reward is
          applied after normalization.
      expected_action_scale (float): Assuming action falls in the range of
          [-expected_action_scale, expected_action_scale] when normalize it.
      flatten_obs (bool): Flatten observation if True.
      obs_alpha (float): Update rate of moving average when estimating the
          mean and variance of observations.
      reward_alpha (float): Update rate of moving average when estimating the
          mean and variance of rewards.
class_docstr_tok: ["An","environment","wrapper","for","normalization",".","This","wrapper","normalizes","action",",","and","optionally","observation","and","reward",".","Args",":","env","(","Environment",")",":","An","environment","instance",".","scale_reward","(","float",")",":","Scale","of","environment","reward",".","normalize_obs","(","bool",")",":","If","True",",","normalize","observation",".","normalize_reward","(","bool",")",":","If","True",",","normalize","reward",".","scale_reward","is","applied","after","normalization",".","expected_action_scale","(","float",")",":","Assuming","action","falls","in","the","range","of","[","-expected_action_scale",",","expected_action_scale","]","when","normalize","it",".","flatten_obs","(","bool",")",":","Flatten","observation","if","True",".","obs_alpha","(","float",")",":","Update","rate","of","moving","average","when","estimating","the","mean","and","variance","of","observations",".","reward_alpha","(","float",")",":","Update","rate","of","moving","average","when","estimating","the","mean","and","variance","of","rewards","."]
code: def __init__(
      self,
      env,
      scale_reward=1.0,
      normalize_obs=False,
      normalize_reward=False,
      expected_action_scale=1.0,
      flatten_obs=True,
      obs_alpha=0.001,
      reward_alpha=0.001,
  ):
      super().__init__(env)
  
      self._scale_reward = scale_reward
      self._normalize_obs = normalize_obs
      self._normalize_reward = normalize_reward
      self._expected_action_scale = expected_action_scale
      self._flatten_obs = flatten_obs
  
      self._obs_alpha = obs_alpha
      flat_obs_dim = self._env.observation_space.flat_dim
      self._obs_mean = np.zeros(flat_obs_dim)
      self._obs_var = np.ones(flat_obs_dim)
  
      self._reward_alpha = reward_alpha
      self._reward_mean = 0.0
      self._reward_var = 1.0
  
file_path: garage/src/garage/envs/normalized_env.py
imports: import akro
  import numpy
  from garage import EnvStep, Wrapper
label_desc: Use image node_id 1 to create a new NormalizedEnv object from inherited base classes: Wrapper with example: obj = NormalizedEnv(env, scale_reward, normalize_obs, normalize_reward, expected_action_scale, flatten_obs, obs_alpha, reward_alpha)