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

[BUG] Problems with multidimensional nvec in MultiCategorical #2486

Open
matteobettini opened this issue Oct 10, 2024 · 0 comments
Open

[BUG] Problems with multidimensional nvec in MultiCategorical #2486

matteobettini opened this issue Oct 10, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@matteobettini
Copy link
Contributor

a = MultiCategorical([[3, 2],[1,4]])
a.to_one_hot_spec()
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/torchrl-3.11/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-28-5f9b780d3aaa>", line 1, in <module>
    a.to_one_hot_spec()
  File "/Users/Matteo/PycharmProjects/torchrl/torchrl/data/tensor_specs.py", line 3935, in to_one_hot_spec
    nvec = [_space.n for _space in self.space]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Matteo/PycharmProjects/torchrl/torchrl/data/tensor_specs.py", line 3935, in <listcomp>
    nvec = [_space.n for _space in self.space]
            ^^^^^^^^
AttributeError: 'BoxList' object has no attribute 'n'

It might be worth checking if in general this spec is compatible with multidimensional nvecs

Solution to this is needed to support #2485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants