hyphi_gym.wrappers.monitor#

Module Contents#

Classes#

Monitor

A monitor wrapper for Gym environments, it is used to know the episode reward, length, time and other data.

class hyphi_gym.wrappers.monitor.Monitor(env: gymnasium.Env, record_video=False)#

Bases: gymnasium.Wrapper[gymnasium.core.ObsType, gymnasium.core.ActType, gymnasium.core.ObsType, gymnasium.core.ActType]

A monitor wrapper for Gym environments, it is used to know the episode reward, length, time and other data. :param env: The environment

property total_steps: int#
property episode_returns: list[float]#
property termination_reasons: list[str]#
property episode_lengths: list[int]#
property episode_times: list[float]#
reset(**kwargs) tuple[gymnasium.core.ObsType, dict]#

Calls the Gym environment reset. :param kwargs: Extra keywords saved for the next episode. only if defined by reset_keywords :return: the first observation of the environment

step(action: gymnasium.core.ActType) tuple[gymnasium.core.ObsType, SupportsFloat, bool, bool, dict]#

Step the environment with the given action :param action: the action :return: observation, reward, terminated, truncated, information

get_video(reset=True)#
save_video(path: str, reset=True)#

Saves current videobuffer to file

write_video(writer, label, step)#

Adds current videobuffer to tensorboard

save_image(path) None#