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 docstring for saved tensors default hooks #62361

Closed
wants to merge 3 commits into from

Conversation

Varal7
Copy link
Contributor

@Varal7 Varal7 commented Jul 28, 2021

Add documentation for the saved tensors default hooks introduced in #61834 / #62563

Sister PR: #62362 (will add a link from autograd.rst to notes/autograd in whatever PR does not land first)

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jul 28, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 7fb7f68 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-scanned failure(s)

ci.pytorch.org: 1 failed


This 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 to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@Varal7 Varal7 requested a review from zou3519 July 28, 2021 22:26
Varal7 added a commit that referenced this pull request Jul 29, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 2, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 2, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
Varal7 added a commit that referenced this pull request Aug 3, 2021
This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Differential Revision: [D29990129](https://our.internmc.facebook.com/intern/diff/D29990129)

[ghstack-poisoned]
@Varal7 Varal7 force-pushed the saved-tensors-docstring branch 2 times, most recently from 8eab06b to 8bdfcef Compare August 3, 2021 21:30
@facebook-github-bot
Copy link
Contributor

@Varal7 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

r"""Sets a pair of pack / unpack hooks for saved tensors.

Use these hooks to define how intermediary results of an operation
should be packed before saving, and unpacked on retrieval.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is where I would add a link to #62362 which defines the terms packing and unpacking.

facebook-github-bot pushed a commit that referenced this pull request Aug 4, 2021
Summary:
Pull Request resolved: #62410

This PR adds docstrings for CPU hooks introduced in #61928.

Also uncomments the warning about pinned memory in CUDA semantics docs.

Depends on: #62361.

For now docstrings are an orphan page at https://docs-preview.pytorch.org/62410/generated/torch.autograd.graph.set_save_on_cpu_hooks.html#torch-autograd-graph-set-save-on-cpu-hooks

Test Plan: Imported from OSS

Reviewed By: soulitzer

Differential Revision: D29990129

Pulled By: Varal7

fbshipit-source-id: 7a98eeee6a0abb11e2c2d9169cd1aa35ad7ba3f4
@Varal7 Varal7 force-pushed the saved-tensors-docstring branch 3 times, most recently from b8c1b9d to 1d4fe7e Compare August 4, 2021 05:42
docs/source/autograd.rst Outdated Show resolved Hide resolved
Adds documentation for the saved tensors default hooks introduced in #61834

ghstack-source-id: aa1104694c41ca2e609480e6623b3d03de44fa37
Pull Request resolved: #62922
Somehow autodoc can't find the `graph` module if it's imported
with an alias.
https://www.internalfb.com/intern/opensource/ci/job/log/265181241677988/

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 2a115fdb9e1d6d5537b7015b19739ee11efa497b
Pull Request resolved: #62923
docs/source/autograd.rst Show resolved Hide resolved
torch/autograd/graph.py Outdated Show resolved Hide resolved
torch._C._autograd._reset_default_hooks()


class save_on_cpu():
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you might be able to implement save_on_cpu in terms of saved_tensors_hooks but it doesn't save too many LOC

ghstack-source-id: d316e4f5419428eabe4086aad1be6b597a2c9f24
Pull Request resolved: #62924
@facebook-github-bot
Copy link
Contributor

@Varal7 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@Varal7 merged this pull request in 557047e.

alanwaketan pushed a commit that referenced this pull request Aug 17, 2021
Summary:
Add documentation for the saved tensors default hooks introduced in #61834 / #62563

Sister PR: #62362 (will add a link from autograd.rst to notes/autograd in whatever PR does not land first)

Pull Request resolved: #62361

Reviewed By: zou3519

Differential Revision: D30081997

Pulled By: Varal7

fbshipit-source-id: cb923e943e1d96db9669c1d863d693af30910c62
facebook-github-bot pushed a commit that referenced this pull request Aug 20, 2021
Summary:
Add section to the Autograd mechanics docs to describe the recently
exposed saved tensors (#52451), how to register packing / unpacking
hooks (#60975) and how to use default hooks (#61834)

Sister PR: #62361 (will add a link from autograd.rst to notes/autograd in whatever PR does not land first)

Pull Request resolved: #62362

Reviewed By: soulitzer

Differential Revision: D30453177

Pulled By: Varal7

fbshipit-source-id: f5759977b069ff0ef36a47b08856d297691a6caa
@github-actions github-actions bot deleted the saved-tensors-docstring branch February 12, 2024 21:21
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.

3 participants