MegaWrapper

class MegaWrapper(env, image_shape: tuple[int, int] = (84, 84), pixels_transform: Callable | None = None, goal_transform: Callable | None = None, required_keys: Iterable | None = None, separate_goal: Iterable | None = True)[source]

Bases: Wrapper

Combines multiple wrappers for comprehensive environment preprocessing.

Applies in sequence: AddPixelsWrapper → EverythingToInfoWrapper → EnsureInfoKeysWrapper → EnsureGoalInfoWrapper → ResizeGoalWrapper.

This provides a complete preprocessing pipeline with rendered pixels, unified info dict, key validation, goal checking, and goal resizing.

Parameters:
  • env – The Gymnasium environment to wrap.

  • image_shape – Target (height, width) for pixels and goal. Defaults to (84, 84).

  • pixels_transform – Optional torchvision transform for rendered pixels.

  • goal_transform – Optional torchvision transform for goal images.

  • required_keys – Additional regex patterns for keys that must be in info. Pattern ^pixels(?:\..*)?$ is always added.

  • separate_goal – If True, validates ‘goal’ is present in info. Defaults to True.

reset(*args, **kwargs)[source]

Uses the reset() of the env that can be overwritten to change the returned data.

step(action)[source]

Uses the step() of the env that can be overwritten to change the returned data.