You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We found what seems as a bug in ActionDiscretizeWrapper. The following piece of code won't raise any exceptions even through we believe it should:
classTestBug(tf.test.TestCase):
deftestBugWrapper(self):
obs_spec=array_spec.BoundedArraySpec((2, 3), np.int32, -10, 10)
action_spec=array_spec.BoundedArraySpec((1,), np.int32, -10, 10)
nested_env=random_py_environment.RandomPyEnvironment(
obs_spec,
action_spec,
reward_fn=lambda*_: np.array([1.0]),
batch_size=2)
env=wrappers.ActionDiscretizeWrapper(nested_env, num_actions=100)
self.assertNotEqual(env.batched, nested_env.batched) # Don't raise when it shouldself.assertNotEqual(nested_env.batch_size, env.batch_size) # Don't raise when it should
Issue comes from
classPyEnvironmentBaseWrapper(py_environment.PyEnvironment):
"""PyEnvironment wrapper forwards calls to the given environment."""def__getattr__(self, name):
"""Forward all other calls to the base environment."""returngetattr(self._env, name)
which doesn't forward the batched and batch_size properties to the wrapped environment as they are defined in the parent class.
Adding explicit calls to the properties would fix the issue:
Hi,
We found what seems as a bug in
ActionDiscretizeWrapper
. The following piece of code won't raise any exceptions even through we believe it should:Issue comes from
which doesn't forward the
batched
andbatch_size
properties to the wrapped environment as they are defined in the parent class.Adding explicit calls to the properties would fix the issue:
The text was updated successfully, but these errors were encountered: