Avoid double wrapping

This commit is contained in:
Antonin RAFFIN 2020-04-22 18:28:00 +02:00
parent f38ddcb278
commit 02b452a9f9
2 changed files with 2 additions and 2 deletions

View file

@ -141,7 +141,7 @@ class BaseRLModel(ABC):
print("Wrapping the env in a DummyVecEnv.") print("Wrapping the env in a DummyVecEnv.")
env = DummyVecEnv([lambda: env]) env = DummyVecEnv([lambda: env])
if is_image_space(env.observation_space): if is_image_space(env.observation_space) and not isinstance(env, VecTransposeImage):
if self.verbose >= 1: if self.verbose >= 1:
print("Wrapping the env in a VecTransposeImage.") print("Wrapping the env in a VecTransposeImage.")
env = VecTransposeImage(env) env = VecTransposeImage(env)

View file

@ -20,7 +20,7 @@ def is_image_space(observation_space: spaces.Space,
:param observation_space: (spaces.Space) :param observation_space: (spaces.Space)
:param channels_last: (bool) :param channels_last: (bool)
:param check_channels: (bool) Whether to do or not the check for the number of channels. :param check_channels: (bool) Whether to do or not the check for the number of channels.
Because of frame-skip, the observation space may have more channels than expected. e.g., with frame-stacking, the observation space may have more channels than expected.
:return: (bool) :return: (bool)
""" """
if isinstance(observation_space, spaces.Box) and len(observation_space.shape) == 3: if isinstance(observation_space, spaces.Box) and len(observation_space.shape) == 3: