def test_pg_compilation(self): """Test whether a PGTrainer can be built with both frameworks.""" config = pg.DEFAULT_CONFIG.copy() config["num_workers"] = 0 # Run locally. num_iterations = 2 for _ in framework_iterator(config): trainer = pg.PGTrainer(config=config, env="CartPole-v0") for i in range(num_iterations): trainer.train() check_compute_single_action(trainer, include_prev_action_reward=True)
def test_pg_compilation(self): """Test whether a PGTrainer can be built with both frameworks.""" config = pg.DEFAULT_CONFIG.copy() config["num_workers"] = 1 config["rollout_fragment_length"] = 500 num_iterations = 1 for _ in framework_iterator(config): for env in ["FrozenLake-v0", "CartPole-v0"]: trainer = pg.PGTrainer(config=config, env=env) for i in range(num_iterations): print(trainer.train()) check_compute_single_action( trainer, include_prev_action_reward=True)
def test_pg_compilation(self): """Test whether a PGTrainer can be built with both frameworks.""" config = pg.DEFAULT_CONFIG.copy() config["num_workers"] = 0 num_iterations = 2 for fw in framework_iterator(config): # For tf, build with fake-GPUs. config["_fake_gpus"] = fw == "tf" config["num_gpus"] = 2 if fw == "tf" else 0 trainer = pg.PGTrainer(config=config, env="CartPole-v0") for i in range(num_iterations): print(trainer.train()) check_compute_single_action(trainer, include_prev_action_reward=True)