Fix method stub creation for function attributes#37994
Closed
suo wants to merge 2 commits intogh/suo/331/basefrom
Closed
Fix method stub creation for function attributes#37994suo wants to merge 2 commits intogh/suo/331/basefrom
suo wants to merge 2 commits intogh/suo/331/basefrom
Conversation
Before, reassigning a method in a module (like `forward = _forward`) didn't work, because we look at the function object's name for our def name when building AST. Mkae that overrideable to handle cases like reassignment [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit fcaafde (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 5 times. |
zdevito
approved these changes
May 8, 2020
Contributor
zdevito
left a comment
There was a problem hiding this comment.
Sounds good, one potential bug
|
|
||
|
|
||
| def get_jit_def(fn, self_name=None): | ||
| def get_jit_def(fn, self_name=None, def_name_override=None): |
Contributor
There was a problem hiding this comment.
def_name_override should probably not be optional or an override, but actually just the name to use everytime. It seems like otherwise, it will cause bugs when people don't realize the same thing this bug addresses: that this is the name of the field of this method. For instance frontend.py:136 is probably wrong too but wasn't caught in this change.
Before, reassigning a method in a module (like `forward = _forward`) didn't work, because we look at the function object's name for our def name when building AST. Mkae that overrideable to handle cases like reassignment Differential Revision: [D21444535](https://our.internmc.facebook.com/intern/diff/D21444535) [ghstack-poisoned]
Contributor
SplitInfinity
pushed a commit
to SplitInfinity/pytorch
that referenced
this pull request
May 15, 2020
Summary: This commit removes a print statement added in pytorch#37994 that appears to be for debugging and was most likely not intended to be commited. Test Plan: Continuous integration.
facebook-github-bot
pushed a commit
that referenced
this pull request
May 15, 2020
Summary: **Summary** This commit removes a print statement added in #37994 that appears to be for debugging and was most likely not intended to be commited. **Test Plan** Continuous integration. Pull Request resolved: #38524 Differential Revision: D21587268 Pulled By: SplitInfinity fbshipit-source-id: 6bdcdce647c45f5c0a2ba179a3545a1c0cae1492
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: Pull Request resolved: pytorch#37994 Before, reassigning a method in a module (like `forward = _forward`) didn't work, because we look at the function object's name for our def name when building AST. Mkae that overrideable to handle cases like reassignment Test Plan: Imported from OSS Differential Revision: D21444535 Pulled By: suo fbshipit-source-id: 4f045f18b5a146edc8005689af525d7d7ed8dd5f
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
) Summary: **Summary** This commit removes a print statement added in pytorch#37994 that appears to be for debugging and was most likely not intended to be commited. **Test Plan** Continuous integration. Pull Request resolved: pytorch#38524 Differential Revision: D21587268 Pulled By: SplitInfinity fbshipit-source-id: 6bdcdce647c45f5c0a2ba179a3545a1c0cae1492
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Before, reassigning a method in a module (like
forward = _forward)didn't work, because we look at the function object's name for our def
name when building AST. Mkae that overrideable to handle cases like
reassignment
Differential Revision: D21444535