garage.envs.wrappers.stack_frames module

Stack frames wrapper for gym.Env.

class StackFrames(env, n_frames)[source]

Bases: gym.core.Wrapper

gym.Env wrapper to stack multiple frames.

Useful for training feed-forward agents on dynamic games. Only works with gym.spaces.Box environment with 2D single channel frames.

Parameters:
  • env – gym.Env to wrap.
  • n_frames – number of frames to stack.
Raises:
  • ValueError – If observation space shape is not 2 or
  • environment is not gym.spaces.Box.
observation_space

gym.Env observation space.

reset()[source]

gym.Env reset function.

step(action)[source]

gym.Env step function.