Exemplo n.º 1
0
 def test_reraise_exception_in_step(self):
     crash_at_step = 3
     constructor = functools.partial(MockEnvironmentCrashInStep,
                                     crash_at_step)
     env = ProcessEnvironment(constructor)
     env.start()
     env.reset()
     action_spec = env.action_spec()
     env.step(action_spec.sample())
     env.step(action_spec.sample())
     with self.assertRaises(Exception):
         env.step(action_spec.sample())
Exemplo n.º 2
0
 def test_close_no_hang_after_init(self):
     constructor = functools.partial(
         RandomAlfEnvironment,
         ts.TensorSpec((3, 3), torch.float32),
         ts.BoundedTensorSpec([1], torch.float32, minimum=-1.0,
                              maximum=1.0),
         episode_end_probability=0,
         min_duration=2,
         max_duration=2)
     env = ProcessEnvironment(constructor)
     env.start()
     env.close()
Exemplo n.º 3
0
 def test_reraise_exception_in_reset(self):
     constructor = MockEnvironmentCrashInReset
     env = ProcessEnvironment(constructor)
     env.start()
     with self.assertRaises(Exception):
         env.reset()