pytorch/docs/source/notes
Richard Zou 264f5ed516 [autograd.Function] Add docs on the functorch interaction (#91452)
This PR:
- Updates autograd.Function.forward docs to reflect how you either
  define a forward with ctx or a separate forward and setup_context
- Updates the "Extending Autograd" docs to suggest the usage of
  autograd.Function with separate forward and setup_context. This should
  be the default because there is a low barrier to go from this to
  an autograd.Function that is fully supported by functorch transforms.
- Adds a new "Extending torch.func with autograd.Function" doc that
  explains how to use autograd.Function with torch.func. It also
  explains how to use generate_vmap_rule and how to manually write a
  vmap staticmethod.

While writing this, I noticed that the implementation of
setup_context staticmethod/generate_vmap_rule/vmap staticmethod are a
bit inconsistent with the other method/attributes on autograd.Function:
- https://github.com/pytorch/pytorch/issues/91451
- I'm happy to fix those if we think it is a problem, either in this PR
  or a followup (this PR is getting long, I want some initial docs
  out that I can point early adopters at, and fixing the problems in the
  future isn't really BC-breaking).

Test Plan:
- view docs preview
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91452
Approved by: https://github.com/soulitzer
2023-01-04 00:28:19 +00:00
..
amp_examples.rst [AMP] Use generic autocast in example, specify dtype (#79579) 2022-06-17 21:32:51 +00:00
autograd.rst Improve Autograd Documentation Clarity (#89401) 2022-12-06 06:45:04 +00:00
broadcasting.rst
cpu_threading_runtimes.svg
cpu_threading_torchscript_inference.rst
cpu_threading_torchscript_inference.svg
cuda.rst [cuBLAS] Add an option to disable reduced precision reductions for BF16 GEMM (#89172) 2022-12-21 18:58:28 +00:00
ddp.rst Update DDP docs for Dynamo/DDPOptimizer (#89096) 2022-11-30 05:50:12 +00:00
extending.func.rst [autograd.Function] Add docs on the functorch interaction (#91452) 2023-01-04 00:28:19 +00:00
extending.rst [autograd.Function] Add docs on the functorch interaction (#91452) 2023-01-04 00:28:19 +00:00
faq.rst Update faq.rst so OOM section mentions checkpoint (#62709) 2021-08-05 07:40:08 -07:00
gradcheck.rst
hip.rst Tweak formatting of note on macros (#89598) 2022-11-28 20:42:30 +00:00
large_scale_deployments.rst
modules.rst Fix typo under docs directory (#87583) 2022-10-24 23:52:44 +00:00
mps.rst update mps note with more details (#78669) 2022-06-02 20:53:19 +00:00
multiprocessing.rst
numerical_accuracy.rst [cuBLAS] Add an option to disable reduced precision reductions for BF16 GEMM (#89172) 2022-12-21 18:58:28 +00:00
randomness.rst Improve reproducibility docs for RNG (#78849) 2022-06-06 14:53:59 +00:00
serialization.rst Fix missing indentation in serialization.rst (#91253) 2022-12-21 20:14:44 +00:00
windows.rst Remove remaining THC code (#69039) 2021-12-08 12:18:08 -08:00