-
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
Add deprecation messages for functorch.* function transforms #92279
Conversation
This PR: - adds deprecation warnings when calling the functorch APIs - adds documentation saying that those APIs are deprecated It does this by creating thin wrappers around the original APIs that (1) raise deprecation warnings and (2) have an additional line in their documentation that they are deprecated. NB: - PyTorch actually suppresses all DeprecationWarning by default. So the warnings themselves are less important than the docs. Test Plan: - New tests - the functorch.* APIs are still tested for correctness because that's what test/functorch/* use (as opposed to directly calling the torch.func.* APIs) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/92279
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 274f415: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR: - adds deprecation warnings when calling the functorch APIs - adds documentation saying that those APIs are deprecated It does this by creating thin wrappers around the original APIs that (1) raise deprecation warnings and (2) have an additional line in their documentation that they are deprecated. NB: - Python surpresses DeprecationWarning, so we use UserWarning instead. Test Plan: - New tests - the functorch.* APIs are still tested for correctness because that's what test/functorch/* use (as opposed to directly calling the torch.func.* APIs) [ghstack-poisoned]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, just small details
torch/_functorch/deprecated.py
Outdated
|
||
def warn_deprecated(api, new_api=None): | ||
warning = get_warning(api, new_api, replace_newlines=True) | ||
warnings.warn(warning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to pass in stacklevel=2 so that the line number in the warning points to functorch.vmap()
call and not warn_deprecated('vmap', 'torch.vmap')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR: - adds deprecation warnings when calling the functorch APIs - adds documentation saying that those APIs are deprecated It does this by creating thin wrappers around the original APIs that (1) raise deprecation warnings and (2) have an additional line in their documentation that they are deprecated. NB: - Python surpresses DeprecationWarning, so we use UserWarning instead. Test Plan: - New tests - the functorch.* APIs are still tested for correctness because that's what test/functorch/* use (as opposed to directly calling the torch.func.* APIs) [ghstack-poisoned]
This PR: - adds deprecation warnings when calling the functorch APIs - adds documentation saying that those APIs are deprecated It does this by creating thin wrappers around the original APIs that (1) raise deprecation warnings and (2) have an additional line in their documentation that they are deprecated. NB: - Python surpresses DeprecationWarning, so we use UserWarning instead. Test Plan: - New tests - the functorch.* APIs are still tested for correctness because that's what test/functorch/* use (as opposed to directly calling the torch.func.* APIs) [ghstack-poisoned]
This PR: - adds deprecation warnings when calling the functorch APIs - adds documentation saying that those APIs are deprecated It does this by creating thin wrappers around the original APIs that (1) raise deprecation warnings and (2) have an additional line in their documentation that they are deprecated. NB: - Python surpresses DeprecationWarning, so we use UserWarning instead. Test Plan: - New tests - the functorch.* APIs are still tested for correctness because that's what test/functorch/* use (as opposed to directly calling the torch.func.* APIs) [ghstack-poisoned]
Stack from ghstack (oldest at bottom):
This PR:
It does this by creating thin wrappers around the original APIs that (1)
raise deprecation warnings and (2) have an additional line in their
documentation that they are deprecated.
NB:
Test Plan:
what test/functorch/* use (as opposed to directly calling the
torch.func.* APIs)