module emote.env.wrappers

Classes

class WarpFrame(gymnasium.ObservationWrapper):

Methods

def __init__(self, env, width, height) -> None

Warp frames to width x height.

Arguments:

  • env: (Gym Environment) the environment
  • width(int) (default: 84)
  • height(int) (default: 84)
def observation(self, frame) -> None

Returns the current observation from a frame.

Arguments:

  • frame: ([int] or [float]) environment frame

Returns:

  • ([int] or [float]) the observation

class FrameStack(gymnasium.Wrapper):

Methods

def __init__(self, env, n_frames) -> None

Stack n_frames last frames. Returns lazy array, which is much more memory efficient.

See Also

LazyFrames (Below)

Arguments:

  • env: (Gym Environment) the environment
  • n_frames(int): (int) the number of frames to stack
def reset(self) -> None
def step(self, action) -> None

class ScaledFloatFrame(gymnasium.ObservationWrapper):

Methods

def __init__(self, env) -> None
def observation(self, observation) -> None

class LazyFrames(object):

Methods

def __init__(self, frames) -> None

This object ensures that common frames between the observations are only stored once. It exists purely to optimize memory usage which can be huge for DQN's 1M frames replay buffers.

This object should only be converted to np.ndarray before being passed to the model.

Arguments:

  • frames: ([int] or [float]) environment frames