Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree Spec #13

Open
joeryjoery opened this issue Mar 13, 2023 · 1 comment
Open

Tree Spec #13

joeryjoery opened this issue Mar 13, 2023 · 1 comment

Comments

@joeryjoery
Copy link

Hi, I was wondering if there were plans to by default support tree like structures in dm_env.specs.

This would be extremely relevant to jax-based environments, or generic environments utilizing deepmind/tree, to specify any arbitrary shape of agent-environment IO.

@joeryjoery
Copy link
Author

joeryjoery commented Mar 13, 2023

Forgot to clarify. I'm aware that tuple, dicts, etc. are already supported as valid specs. The reason why I'm suggesting an explicit Tree spec is for my type-checker to OK when I return an explicit dataclass as a spec.

For example:

@dataclass
class MyAction
    a: jax.Array
    b: jax.Array

def action_spec(self) -> specs.Spec:
    return MyAction(a=specs.Array(...), b=specs.Array(...))  # mismatching types, specs.Array != jax.Array

I would find it confusing and more complicated to read if I had to add a | specs.Array type for all my dataclass type-hints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant