[Feature Request] Support tuple values in TensorDictModule in_keys
arguments.
#1099
Open
1 task done
Labels
enhancement
New feature or request
Motivation
One limitation that is found when passing a dictionary as
in_keys
to the currentTensorDictModule
is that a specific key in the inputTensorDict
cannot be used more than once in the wrapped function (or wrappedModule
'sforward
).For instance, one can do:
but the following will crash as expected:
I would clearly see cases where passing the same input value to 2 different arguments in the wrapped function/module would be desirable.
Could you clarify whether that is a specific design choice or whether there is any reason this feature would cause a problem?
Solution
A simple solution would be to allow tuples and lists a values for the
in_keys
argument and parse accordingly. This can be achieved by iterating over said values and building the lists of in_keys and keywords:In our second example, this would result in:
Additional context
I haven't identified undesired side effects that would come with this new support of various in_keys.
Checklist
The text was updated successfully, but these errors were encountered: