Skip to content

Conversation

@zou3519
Copy link
Contributor

@zou3519 zou3519 commented Dec 6, 2022

Stack from ghstack:

Motivation

  • These were previously defined in functorch. They are not
    functorch-specific, so I'm moving them to torch.autograd.forward_ad and
    the autograd python bindings.
  • I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:

  • moved the tests of these from test/functorch/test_eager_transforms.py
    to test/test_autograd.py

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Dec 6, 2022

🔗 Helpful Links

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

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

❌ 1 Failures

As of commit fb114c3:

The following jobs have failed:

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

…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
@zou3519 zou3519 added the topic: not user facing topic category label Dec 6, 2022
@zou3519 zou3519 requested a review from samdow December 6, 2022 14:49
…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
# Private helper function to enable or disable fwd grad.
# If you're a user and want to use this, please file an issue to discuss the use case.
@contextlib.contextmanager
def _enable_fwd_grad(enabled=True):
Copy link
Contributor

@soulitzer soulitzer Dec 12, 2022

Choose a reason for hiding this comment

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

Maybe we should be consistent with the API for backward AD. This function looks like it is analogous to _set_grad_enabled, so we should name it _set_fwd_grad_enabled and don't have a default value. (If it were analogous to enable_grad, it shouldn't take any arguments and always sets it to True.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
…orward_ad"

Motivation
- These were previously defined in functorch. They are not
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
- I need this to avoid some of my cyclic import problems.

Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.

Test Plan:
- moved the tests of these from test/functorch/test_eager_transforms.py
to test/test_autograd.py

[ghstack-poisoned]
@zou3519
Copy link
Contributor Author

zou3519 commented Dec 13, 2022

@pytorchbot merge -f "test failures look unrelated"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@albanD
Copy link
Collaborator

albanD commented Dec 13, 2022

Comments like

// This is only used for custom Function implementation
need to be updated following this

@zou3519
Copy link
Contributor Author

zou3519 commented Dec 13, 2022

@albanD will do, added to followups (#90224)

zou3519 added a commit that referenced this pull request Dec 13, 2022
Addresses
#90240 (comment)

This was the only comment I found after grepping the codebase, but
please let me know if I missed others.

Test Plan:
- code reading

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Dec 13, 2022
Addresses
#90240 (comment)

This was the only comment I found after grepping the codebase, but
please let me know if I missed others.

Test Plan:
- code reading

ghstack-source-id: 7d94a9d
Pull Request resolved: #90790
zou3519 added a commit that referenced this pull request Dec 16, 2022
…being used in custom Function"

Addresses
#90240 (comment)

This was the only comment I found after grepping the codebase, but
please let me know if I missed others.

Test Plan:
- code reading

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request Dec 16, 2022
…stom Function"

Addresses
#90240 (comment)

This was the only comment I found after grepping the codebase, but
please let me know if I missed others.

Test Plan:
- code reading

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Dec 17, 2022
…on (#90790)

Addresses
#90240 (comment)

This was the only comment I found after grepping the codebase, but
please let me know if I missed others.

Test Plan:
- code reading
Pull Request resolved: #90790
Approved by: https://github.com/soulitzer
@facebook-github-bot facebook-github-bot deleted the gh/zou3519/573/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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants