fd5314780de9eef2b3a6d489dab2119e5b66a6fc,gym/wrappers/test_atari_preprocessing.py,,test_atari_preprocessing,#,11

Before Change


@pytest.mark.skipif(atari_py is None, reason="Only run this test when atari_py is installed")
def test_atari_preprocessing():
    import cv2
    env1 = gym.make("PongNoFrameskip-v0")
    env2 = AtariPreprocessing(env1, screen_size=84, grayscale_obs=True)
    env3 = AtariPreprocessing(env1, screen_size=84, grayscale_obs=False)
    obs1 = env1.reset()
    assert obs1.shape == (210, 160, 3)
    obs2 = env2.reset()
    assert obs2.shape == (84, 84)
    obs3 = env3.reset()

After Change


    np.testing.assert_allclose(obs3, cv2.resize(obs1, (84, 84), interpolation=cv2.INTER_AREA))
    obs3_gray = cv2.cvtColor(obs3, cv2.COLOR_RGB2GRAY)
    // the edges of the numbers do not render quite the same in the grayscale, so we ignore them
    np.testing.assert_allclose(obs2[10:], obs3_gray[10:])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: openai/gym
Commit Name: fd5314780de9eef2b3a6d489dab2119e5b66a6fc
Time: 2019-08-23
Author: peterzhokhoff@gmail.com
File Name: gym/wrappers/test_atari_preprocessing.py
Class Name:
Method Name: test_atari_preprocessing


Project Name: rlworkgroup/garage
Commit Name: 7396eddab0151f368ad9d98eeed7c07868d67f47
Time: 2018-10-24
Author: jonashen@users.noreply.github.com
File Name: tests/garage/envs/test_normalized_gym.py
Class Name: TestNormalizedGym
Method Name: test_unflatten


Project Name: rlworkgroup/garage
Commit Name: 7396eddab0151f368ad9d98eeed7c07868d67f47
Time: 2018-10-24
Author: jonashen@users.noreply.github.com
File Name: tests/garage/envs/test_normalized_gym.py
Class Name: TestNormalizedGym
Method Name: test_flatten