-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
nn.Module.forward signature with **kwargs #23732
Comments
Adding a pytorch/torch/nn/modules/module.py Line 529 in b2f6e2b
This being said, I don't think there is any problem exposing the kwargs in the base forward |
There is nothing that prevents it but you gain nothing from this change as well because forward is always overriden. |
True, no gain in functionality, just a change to be consistent I guess. I am going to try to change Thank you :) |
Currently it could be solved if programmers write OR Pass a dict
For example, IMO should be easy to implement in a backward compatible way. |
@saareliad right, that's what the documentation says. The Besides, current solution forces developers to rewrite their current, key-worded model to be keyword-args-less and I think since pytorch is aiming to be python-first, this should not take place. I followed the data-flow path and basically started to change some code to incorporate kwargs pytorch/torch/csrc/autograd/python_function.cpp Line 1056 in b2f6e2b
and in the function itself to unpack the
and I stumbled upon #16940 |
Hi there!
The other day I was working on improving
utils.checkpoint
module and I found out there is no way right now to pass**kwargs
to checkpointed function. This is probably in order to by compliant with thenn.Module.forward
method.Now, I could not think about any argument against having
**kwargs
inforward
method and many people overload this method with**kwargs
because it is nice and lit :) I was about to change it and create pull request but before I do it I decided to go smart and ask you guys if there is some obvious reason why we should not do it. Otherwise, I am more than happy to start working on it.Thanks :- )
The text was updated successfully, but these errors were encountered: