a4f6690b9c4290a7f47761100523ff2ef5335964,tests/agents_tests/test_trpo.py,TestTRPO,_test_abc,#TestTRPO#Any#Any#Any#Any#,183

Before Change



        // Test
        n_test_runs = 5
        for _ in range(n_test_runs):
            total_r = 0.0
            obs = test_env.reset()
            done = False
            reward = 0.0
            while not done:
                action = agent.act(obs)
                obs, reward, done, _ = test_env.step(action)
                total_r += reward
            agent.stop_episode()

            if require_success:
                self.assertAlmostEqual(total_r, successful_return)

        // Save
        agent.save(self.agent_dirname)

    def make_agent(self, env, gpu):
        policy, vf = self.make_model(env)

After Change



        // Test
        n_test_runs = 10
        eval_returns = run_evaluation_episodes(
            test_env,
            agent,
            n_steps=None,
            n_episodes=n_test_runs,
            max_episode_len=max_episode_len,
        )
        if require_success:
            n_succeeded = np.sum(np.asarray(eval_returns) >= successful_return)
            self.assertEqual(n_succeeded, n_test_runs)

        // Save
        agent.save(self.agent_dirname)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 22

Instances


Project Name: chainer/chainerrl
Commit Name: a4f6690b9c4290a7f47761100523ff2ef5335964
Time: 2019-04-28
Author: muupan@gmail.com
File Name: tests/agents_tests/test_trpo.py
Class Name: TestTRPO
Method Name: _test_abc


Project Name: chainer/chainerrl
Commit Name: a4f6690b9c4290a7f47761100523ff2ef5335964
Time: 2019-04-28
Author: muupan@gmail.com
File Name: tests/agents_tests/test_trpo.py
Class Name: TestTRPO
Method Name: _test_abc


Project Name: chainer/chainerrl
Commit Name: d5e51a64f3dad62ec34a726da2d357c6d135f890
Time: 2018-10-09
Author: muupan@gmail.com
File Name: tests/agents_tests/test_a2c.py
Class Name: TestA2C
Method Name: _test_abc


Project Name: chainer/chainerrl
Commit Name: 38c115e1bf3862010daf57107b90deee7626c8de
Time: 2018-10-09
Author: muupan@gmail.com
File Name: tests/agents_tests/test_ppo.py
Class Name: TestPPO
Method Name: _test_abc