nn.Module.forward has no docstring #43057
Labels
module: nn
Related to torch.nn
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃悰 Bug
from 1.5.1 to 1.6, the definition of
nn.Module.forward
changed and no longer contains a docstring.forward
in 1.5.1forward
in 1.6In our code base, instead of adding docstrings to functions that implement methods of a superclass, we have an
@implements
decorator that uses the docstring of the superclass.for reference
When we update from
torch==1.5.1
totorch==1.6.0
, the assertionassert super_method.__doc__
fails.To Reproduce
Steps to reproduce the behavior:
in 1.5.1 the following can be successfully executed
in 1.6.0 the same statement raises an AssertionError
Expected behavior
In the reproduction steps, an error should not be raised. Ideally,
forward
would have a docstringEnvironment
conda
,pip
, source): pipAdditional context
As an example of a solution, if the single line comments above the definition for
_forward_unimplemented
are moved to be the docstring for that function, the AssertionError in the Reproduce steps is no longer raised.Current - raises AssertionError with
assert getattr(nn.Module, nn.Module.forward.__name__, None).__doc__
Example solution - AssertionError no longer raised.
cc @albanD @mruberry
The text was updated successfully, but these errors were encountered: