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] Slightly incorrect documentation of TensorDictModule #1156

Open
davidegraff opened this issue Dec 24, 2024 · 0 comments
Open

[BUG] Slightly incorrect documentation of TensorDictModule #1156

davidegraff opened this issue Dec 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@davidegraff
Copy link

Describe the bug

The documentation for TensorDictModule is not quite correct. In the param spec, it says:

out_keys (iterable of str) – keys to be written to the input tensordict. The length of out_keys must match the number of tensors returned by the embedded module. Using “_” as a key avoid writing tensor to output

Specifically, the usage of the word "must" is incorrect as it implies failure to match the length of the module output with the number of supplied keys will produce an error. But the TensorDictModule actually silently ignores this possible error via the zip() call in tensordict/nn/common.py#L1058.

Solution

I'm not really sure what the right move is here. The current approach works, but the documentation should be changed to reflect the fact that this "error" will be silently ignored. I personally think it would be nice if this actually did raise a ValueError, but that likely wouldn't be backwards compatible. Just wanted to bring this up!

@davidegraff davidegraff added the bug Something isn't working label Dec 24, 2024
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