garage.envs.garage_env module¶
Wrapper class that converts gym.Env into GarageEnv.
-
class
GarageEnv
(env=None, env_name='', is_image=False)[source]¶ Bases:
gym.core.Wrapper
Returns an abstract Garage wrapper class for gym.Env.
In order to provide pickling (serialization) and parameterization for gym.Envs, they must be wrapped with a GarageEnv. This ensures compatibility with existing samplers and checkpointing when the envs are passed internally around garage.
Furthermore, classes inheriting from GarageEnv should silently convert action_space and observation_space from gym.Spaces to akro.spaces.
Parameters: - env (gym.Env) – An env that will be wrapped
- env_name (str) – If the env_name is speficied, a gym environment with that name will be created. If such an environment does not exist, a gym.error is thrown.
- is_image (bool) – True if observations contain pixel values, false otherwise. Setting this to true converts a gym.Spaces.Box obs space to an akro.Image and normalizes pixel values.
-
reset
(**kwargs)[source]¶ Call reset on wrapped env.
This method is necessary to suppress a deprecated warning thrown by gym.Wrapper.
Parameters: kwargs – Keyword args Returns: The initial observation. Return type: object
-
spec
¶ Return the environment specification.
This property needs to exist, since it’s defined as a property in gym.Wrapper in a way that makes it difficult to overwrite.
Returns: The envionrment specification. Return type: garage.envs.env_spec.EnvSpec
-
step
(action)[source]¶ Call step on wrapped env.
This method is necessary to suppress a deprecated warning thrown by gym.Wrapper.
Parameters: action (object) – An action provided by the agent. Returns: Agent’s observation of the current environment float : Amount of reward returned after previous action bool : Whether the episode has ended, in which case further step() calls will return undefined results- dict: Contains auxiliary diagnostic information (helpful for
- debugging, and sometimes learning)
Return type: object