示例#1
0
 def test_does_not_support_dict_obs_space(self):
     """Test that policy raises error if passed a dict obs space."""
     env = GymEnv(DummyDictEnv(act_space_type='discrete'))
     with pytest.raises(ValueError):
         qf = SimpleQFunction(env.spec,
                              name='does_not_support_dict_obs_space')
         DiscreteQFArgmaxPolicy(env_spec=env.spec, qf=qf)
示例#2
0
 def setup_method(self):
     super().setup_method()
     self.env = GymEnv(DummyDiscreteEnv())
     self.qf = SimpleQFunction(self.env.spec)
     self.policy = DiscreteQFArgmaxPolicy(env_spec=self.env.spec,
                                          qf=self.qf)
     self.sess.run(tf.compat.v1.global_variables_initializer())
     self.env.reset()
示例#3
0
 def setUp(self):
     super().setUp()
     self.env = TfEnv(DummyDiscreteEnv())
     self.qf = SimpleQFunction(self.env.spec)
     self.policy = DiscreteQfDerivedPolicy(
         env_spec=self.env.spec, qf=self.qf)
     self.sess.run(tf.global_variables_initializer())
     self.env.reset()
示例#4
0
 def test_invalid_action_spaces(self):
     """Test that policy raises error if passed a dict obs space."""
     env = GymEnv(DummyDictEnv(act_space_type='box'))
     with pytest.raises(ValueError):
         qf = SimpleQFunction(env.spec)
         DiscreteQFArgmaxPolicy(env_spec=env.spec, qf=qf)