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

Deprecate variadic inputs of checkpoint_sequential #21006

Closed
wants to merge 8 commits into from

Conversation

Projects
None yet
4 participants
@sublee
Copy link
Contributor

commented May 28, 2019

I've reported inconsistency between checkpoint_sequential and nn.Sequential at #19260. Both should provide the same input signature but they don't. I think the consistency is important and I agree with @apaszke that nn.Sequential's semantics should be kept instead of checkpoint_sequential.

I hope checkpoint_sequential raises TypeError on variadic arguments since PyTorch 1.2.0. But for now, it's okay just to warn as DeprecationWarning. I've talked about this approach with @soumith.

Please review this pull request. Any comment will be my pleasure.

@sublee

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2019

To test DeprecationWarning, I've used assertWarns in common_utils.py. But the test was failed (https://circleci.com/gh/pytorch/pytorch/1813423). The reason is that warnings.catch_warnings() misses already registered warnings in Python 2.7.

I fixed this problem by modifying assertWarns and assertWarnsRegex. I adopted the approach of reset_warning_registry.py reported in https://bugs.python.org/issue21724.

# This interface will be changed at PyTorch 1.2.0.
# See also: https://github.com/pytorch/pytorch/issues/19260
if not inputs:
warnings.warn('no input to checkpoint_sequential has been deprecated, '

This comment has been minimized.

Copy link
@soumith

soumith May 29, 2019

Member

"no input" -> "giving no inputs"
"will be raised since PyTorch 1.2.0" -> "will be raised since PyTorch 1.3.0" (we need atleast 1 stable version to deprecate things, right now it is 1.1.0)

This comment has been minimized.

Copy link
@sublee

sublee May 29, 2019

Author Contributor

Great feedback and fix. I also capitalized the warning message for multiple inputs just like "Giving no inputs". Thank you so much!

@facebook-github-bot
Copy link
Contributor

left a comment

@soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot

This comment has been minimized.

Copy link
Contributor

commented May 29, 2019

@soumith merged this pull request in ffdce79.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.