def test_singleagent_env(self): ev = RolloutWorker( env_creator=lambda _: MockEnv3(NUM_STEPS), policy_spec=EchoPolicy, callbacks=LastInfoCallback, ) ev.sample()
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
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)
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