Ejemplo n.º 1
0
 def test_singleagent_env(self):
     ev = RolloutWorker(
         env_creator=lambda _: MockEnv3(NUM_STEPS),
         policy_spec=EchoPolicy,
         callbacks=LastInfoCallback,
     )
     ev.sample()
Ejemplo n.º 2
0
 def __init__(self, episode_length, num):
     super().__init__()
     self._skip_env_checking = True
     self.agents = [MockEnv3(episode_length) for _ in range(num)]
     self.dones = set()
     self.observation_space = self.agents[0].observation_space
     self.action_space = self.agents[0].action_space
Ejemplo n.º 3
0
 def test_singleagent_env(self):
     ev = RolloutWorker(
         env_creator=lambda _: MockEnv3(NUM_STEPS),
         policy_spec=EchoPolicy,
     )
     sample_batch = ev.sample()
     self.assertEqual(sample_batch.count, 100)
     # A batch of 100. 4 episodes, each 25.
     self.assertEqual(len(set(sample_batch["eps_id"])), 4)
Ejemplo n.º 4
0
 def __init__(self, episode_length, num):
     self.agents = [MockEnv3(episode_length) for _ in range(num)]
     self.dones = set()
     self.observation_space = self.agents[0].observation_space
     self.action_space = self.agents[0].action_space