-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
WIPLabel your PR/Issue with WIP for some long outstanding Issues/PRs that are work in progressLabel your PR/Issue with WIP for some long outstanding Issues/PRs that are work in progress
Description
We use 3 different ways of doing the same:
F.foo()nn.functional.foo()torch.nn.functional.foo()
and these could also be imported:
from torch.nn.functional import foo; foo()
Asking others it appears that F is not quite liked, so it's 2, 3 or 4.
2 and 3 often lead to longer lines which autoformatter wraps, leading to 3 lines of code instead of 1 and which gives less readable code.
So it seems that option 4 might be the best outcome.
For 2, the global update would be easy:
find . -type d -name ".git" -prune -o -type f -exec perl -pi -e 's|from torch.nn import functional as F||' {} \;
find . -type d -name ".git" -prune -o -type f -exec perl -pi -e 's|import torch.nn.functional as F||' {} \;
find . -type d -name ".git" -prune -o -type f -exec perl -pi -e 's| F\.| nn.functional.|g' {} \;
make fixup
For 4, it will take much more work, but can be semi-automated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
WIPLabel your PR/Issue with WIP for some long outstanding Issues/PRs that are work in progressLabel your PR/Issue with WIP for some long outstanding Issues/PRs that are work in progress