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

Add setup_context staticmethod to autograd.Function #89859

Closed
wants to merge 12 commits into from

Conversation

zou3519
Copy link
Contributor

@zou3519 zou3519 commented Nov 29, 2022

Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 29, 2022

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/89859

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit b7f36c2:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@zou3519 zou3519 added module: autograd Related to torch.autograd, and the autograd engine in general release notes: autograd release notes category and removed module: autograd Related to torch.autograd, and the autograd engine in general labels Nov 29, 2022
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
@zou3519 zou3519 requested a review from samdow November 29, 2022 20:23
test/test_autograd.py Outdated Show resolved Hide resolved
test/test_autograd.py Outdated Show resolved Hide resolved
test/test_autograd.py Outdated Show resolved Hide resolved
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
test/test_autograd.py Outdated Show resolved Hide resolved
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
Copy link
Contributor

@soulitzer soulitzer left a comment

Choose a reason for hiding this comment

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

Looks good! But curious what Alban thinks about inputs being expanded.

Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

cc ezyang albanD gqchen pearu nikitaved soulitzer Lezcano Varal7

[ghstack-poisoned]
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

[ghstack-poisoned]
Py_INCREF(outputs);
PyTuple_SET_ITEM(result.get(), 0, (PyObject*)ctx);
PyTuple_SET_ITEM(
result.get(), 1, (PyObject*)unpacked_input.input_tuple.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: don't need cast unpacked_input.input_tuple.get() or outputs

Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

[ghstack-poisoned]
@zou3519 zou3519 added the ciflow/trunk Trigger trunk jobs on your pull request label Dec 7, 2022
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in eb314f9.

kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
Adds a setup_context staticmethod to autograd.Function.
If it exists, then the user splits the ctx-specific logic from the
forward() and puts it in the setup_context staticmethod.

Docs will come later when we remove the feature flag.

Test Plan:
- some light tests
Pull Request resolved: pytorch#89859
Approved by: https://github.com/soulitzer
@facebook-github-bot facebook-github-bot deleted the gh/zou3519/568/head branch June 8, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: autograd release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants