test_monitor.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:gym-adv 作者: lerrel 项目源码 文件源码
def test_only_complete_episodes_written():
    with helpers.tempdir() as temp:
        env = gym.make('CartPole-v0')

        env.monitor.start(temp, video_callable=False)
        env.reset()
        d = False
        while not d:
            _, _, d, _ = env.step(env.action_space.sample())

        env.reset()
        env.step(env.action_space.sample())

        env.monitor.close()

        # Only 1 episode should be written
        results = monitoring.load_results(temp)
        assert len(results['episode_lengths']) == 1, "Found {} episodes written; expecting 1".format(len(results['episode_lengths']))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号