Add wrappers.vector.TransformObs/Action single obs/action space argument#1288
Add wrappers.vector.TransformObs/Action single obs/action space argument#1288pseudo-rnd-thoughts merged 5 commits intoFarama-Foundation:mainfrom
wrappers.vector.TransformObs/Action single obs/action space argument#1288Conversation
wrappers.vector.TransformObs/Action single obs/action space argument
There was a problem hiding this comment.
Thanks for the PR,
I think the __init__ can be significantly simpler,
if action_space is None:
if single_action_space is not None:
self.single_action_space = single_action_space
self.action_space = batch_space(single_action_space, self.num_envs)
else:
self.action_space = action_space
if single_action_space is not None:
self.single_action_space = single_action_space
if action_space != batch_space(single_action_space, self.num_envs):
warn("The action space and the batched single action space don't match as expected.")
self.func = funcThe vector wrapper will automatically do the variable forwarding so we don't need the new function either
Could you update and change for the transform obs wrapper
|
The extra stuff I'm doing with Also, I think you want is this: if action_space is None:
if single_action_space is not None:
self.single_action_space = single_action_space
self.action_space = batch_space(single_action_space, self.num_envs)
else:
self.action_space = action_space
if single_action_space is not None:
self.single_action_space = single_action_space
if self.action_space != batch_space(self.single_action_space, self.num_envs):
warn("The action space and the batched single action space don't match as expected.")
self.func = func |
|
If you're okay with the behaviour change, then I'll make the changes and resubmit. |
Yes, I think it should be fine |
pseudo-rnd-thoughts
left a comment
There was a problem hiding this comment.
Thanks for the update, looks good.
If you could add these changes then good to merge
Description
Fixes #1287
Type of change
Please delete options that are not relevant.
Checklist:
pre-commitchecks withpre-commit run --all-files(seeCONTRIBUTING.mdinstructions to set it up)