DQN playing PongNoFrameskip-v4 from https://github.com/sgoodfriend/rl-algo-impls/tree/1d4094fbcc9082de7f53f4348dd4c7c354152907
ee5d423
import gym | |
import numpy as np | |
class VideoCompatWrapper(gym.Wrapper): | |
def __init__(self, env: gym.Env) -> None: | |
super().__init__(env) | |
def render(self, mode="human", **kwargs): | |
r = super().render(mode=mode, **kwargs) | |
if mode == "rgb_array" and isinstance(r, np.ndarray) and r.dtype != np.uint8: | |
r = r.astype(np.uint8) | |
return r | |