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)