ExportGifWrapper

class maze.core.wrappers.export_gif_wrapper.ExportGifWrapper(env: MazeEnv, export: bool, duration: float)

Dumps step renderings of environments as .gif files.

Make sure to activate this only for rollouts and disable it during training (e.g. set export=False). Otherwise it will dump a lot off rollout GIFs to your disk.

To convert the GIF into a mp4 video run: ffmpeg -r 1 -i <file-path>.gif -movflags faststart -pix_fmt yuv420p -vf “scale=trunc(iw/2)*2:trunc(ih/2)*2” <file-path>.mp4

Parameters:
  • env – The environment to wrap.

  • duration – Duration in seconds between consecutive image frames.

  • export – Only if set to True a GIF is exported.

clone_from(env: ExportGifWrapper) None

(overrides SimulatedEnvMixin)

implementation of SimulatedEnvMixin.

close() None

Close the wrapper, performing cleanup or dumping data.

get_observation_and_action_dicts(maze_state: Any | None, maze_action: Any | None, first_step_in_episode: bool) Tuple[Dict[int | str, Any] | None, Dict[int | str, Any] | None]

(overrides Wrapper)

None

reset() Any

(overrides BaseEnv)

Intercept BaseEnv.reset and map observation.

step(action: Any) Tuple[Dict[str, numpy.ndarray], Any, bool, Dict[Any, Any]]

(overrides BaseEnv)

Intercept BaseEnv.step and map observation.