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

style: make torch.nn imports more uniform #626

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

DaniBodor
Copy link
Collaborator

@DaniBodor DaniBodor commented Jul 9, 2024

  • All functions from torch.nn.functional are now explicitly imported by name and used directly.
  • In all other cases where classes from torch.nn are used, we do from torch import nn and then use nn.<Class> throughout.

Note that this was also changed in one docstring in fba9e56. Not sure if that messes up the rendering of the documents. That commit can easily be dropped if needed.

fix #269

@DaniBodor DaniBodor linked an issue Jul 9, 2024 that may be closed by this pull request
@DaniBodor DaniBodor requested a review from gcroci2 July 11, 2024 13:17
Copy link
Collaborator

@gcroci2 gcroci2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For being sure that Sphinx is able to solve the reference, you should use the fully qualified name (:class:torch.nn.Module). But it may be able to solve it also with the short version - not entirely clear. You should see after #625 is merged (now the trainer module is not correctly rendered) by activating the branch on readthedocs. Maybe just revert it for simplicity.

@DaniBodor
Copy link
Collaborator Author

DaniBodor commented Jul 11, 2024

Maybe just revert it for simplicity.

I reverted it.

@DaniBodor DaniBodor merged commit fe0bdfa into dev Jul 11, 2024
6 checks passed
@DaniBodor DaniBodor deleted the 269_unify_torch_imports_dbodor branch July 11, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify torch imports
2 participants