mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-01 22:11:25 +00:00
added assertion of 'NoFrameskip' in AtariPreprocessing (#1725)
* added assertion of noframeskip in atari pre-proecessing * - corrected frameskipping assertion - added non-op assertion as well
This commit is contained in:
@@ -40,7 +40,10 @@ class AtariPreprocessing(gym.Wrapper):
|
||||
super().__init__(env)
|
||||
assert frame_skip > 0
|
||||
assert screen_size > 0
|
||||
|
||||
assert noop_max >= 0
|
||||
if frame_skip > 1:
|
||||
assert 'NoFrameskip' in env.spec.id, 'disable frame-skipping in the original env. for more than one' \
|
||||
' frame-skip as it will be done by the wrapper'
|
||||
self.noop_max = noop_max
|
||||
assert env.unwrapped.get_action_meanings()[0] == 'NOOP'
|
||||
|
||||
|
@@ -8,7 +8,7 @@ from gym.wrappers import AtariPreprocessing
|
||||
pytest.importorskip('atari_py')
|
||||
pytest.importorskip('cv2')
|
||||
|
||||
@pytest.mark.parametrize('env_id', ['Pong-v0', 'SpaceInvaders-v0'])
|
||||
@pytest.mark.parametrize('env_id', ['PongNoFrameskip-v0', 'SpaceInvadersNoFrameskip-v0'])
|
||||
@pytest.mark.parametrize('keep_dim', [True, False])
|
||||
def test_gray_scale_observation(env_id, keep_dim):
|
||||
gray_env = AtariPreprocessing(gym.make(env_id), screen_size=84, grayscale_obs=True)
|
||||
|
@@ -9,7 +9,7 @@ except ImportError:
|
||||
|
||||
|
||||
@pytest.mark.skipif(atari_py is None, reason='Only run this test when atari_py is installed')
|
||||
@pytest.mark.parametrize('env_id', ['Pong-v0', 'SpaceInvaders-v0'])
|
||||
@pytest.mark.parametrize('env_id', ['PongNoFrameskip-v0', 'SpaceInvadersNoFrameskip-v0'])
|
||||
@pytest.mark.parametrize('shape', [16, 32, (8, 5), [10, 7]])
|
||||
def test_resize_observation(env_id, shape):
|
||||
env = gym.make(env_id)
|
||||
|
Reference in New Issue
Block a user