Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap width and height in RGBImgObsWrapper, add test #445

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion minigrid/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ def __init__(self, env, tile_size=8):
low=0,
high=255,
shape=(
self.unwrapped.width * tile_size,
self.unwrapped.height * tile_size,
self.unwrapped.width * tile_size,
3,
),
dtype="uint8",
Expand Down
10 changes: 10 additions & 0 deletions tests/test_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,13 @@ def test_no_death_wrapper():
assert reward_wrap == reward + death_cost
env.close()
env_wrap.close()


def test_non_square_RGBIMgObsWrapper():
"""
Add test for non-square dimensions with RGBImgObsWrapper
(https://github.com/Farama-Foundation/Minigrid/issues/444).
"""
env = RGBImgObsWrapper(gym.make("MiniGrid-BlockedUnlockPickup-v0"))
obs, info = env.reset()
assert env.observation_space["image"].shape == obs["image"].shape
Loading