From 8fd0740221af5ab5cd17c28cb9e0474053741859 Mon Sep 17 00:00:00 2001 From: Ariel Kwiatkowski Date: Wed, 11 Jan 2023 02:12:01 +0100 Subject: [PATCH] Minor fixes for the resize observation wrapper (#254) --- gymnasium/wrappers/resize_observation.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gymnasium/wrappers/resize_observation.py b/gymnasium/wrappers/resize_observation.py index 2f8d2b664..a0af05190 100644 --- a/gymnasium/wrappers/resize_observation.py +++ b/gymnasium/wrappers/resize_observation.py @@ -49,11 +49,9 @@ def __init__(self, env: gym.Env, shape: tuple[int, int] | int) -> None: ), f"Expected the observation space to be Box, actual type: {type(env.observation_space)}" dims = len(env.observation_space.shape) assert ( - 2 <= dims <= 3 + dims == 2 or dims == 3 ), f"Expected the observation space to have 2 or 3 dimensions, got: {dims}" - self.shape = tuple(shape) - obs_shape = self.shape + env.observation_space.shape[2:] self.observation_space = Box(low=0, high=255, shape=obs_shape, dtype=np.uint8)