pytorch/docs/source/notes
Omkar Salpekar 24dd800e6a [Dist Autograd] Functional API for Dist Autograd and Dist Optimizer (#33711)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33711

Fixed #33480

This makes `dist_autograd.backward` and `dist_optimizer.step` functional by making the user explicitly pass in the `context_id` as opposed to relying on the confusing thread_local context_id.

This diff incorporates these API changes and all places where these functions are called.

More concretely, this code:

```
with dist_autograd.context():
    # Forward pass.
    dist_autograd.backward([loss.sum()])
    dist_optim.step()
```

should now be written as follows:

```
with dist_autograd.context() as context_id:
    # Forward pass.
    dist_autograd.backward(context_id, [loss.sum()])
    dist_optim.step(context_id)
```

Test Plan: Ensuring all existing dist_autograd and dist_optimizer tests pass with the new API. Also added a new test case for input checking.

Differential Revision: D20011710

fbshipit-source-id: 216e12207934a2a79c7223332b97c558d89d4d65
2020-02-26 19:08:28 -08:00
..
amp_examples.rst [WIP] Reanimate gradient scaling API with original scale update heuristic (#33366) 2020-02-25 19:00:34 -08:00
autograd.rst Update distributed autograd design doc with appropriate links. (#29927) 2019-11-15 21:10:53 -08:00
broadcasting.rst [docs] Update broadcasting and cuda semantics notes (#6904) 2018-04-24 13:41:24 -04:00
cpu_threading_runtimes.svg Update CPU threading doc (#33083) 2020-02-11 14:13:51 -08:00
cpu_threading_torchscript_inference.rst Update CPU threading doc (#33083) 2020-02-11 14:13:51 -08:00
cpu_threading_torchscript_inference.svg Threading and CPU Inference note 2019-07-29 15:45:49 -07:00
cuda.rst Comprehensive-ish instrumentation for CUDA memory allocator (#27361) 2019-10-08 15:42:48 -07:00
ddp.rst Adding DDP Design Note 2020-01-15 14:10:45 -08:00
distributed_autograd.rst [Dist Autograd] Functional API for Dist Autograd and Dist Optimizer (#33711) 2020-02-26 19:08:28 -08:00
extending.rst Fix typos, via a Levenshtein-type corrector (#31523) 2020-01-17 16:03:19 -08:00
faq.rst Use "length of the RNN input" instead of "length of the RNN" 2019-05-24 09:03:50 -07:00
large_scale_deployments.rst Thread local debug info 2019-08-12 14:53:57 -07:00
multiprocessing.rst Add IterableDataset (#19228) 2019-06-20 20:12:44 -07:00
randomness.rst Update randomness.rst (#21337) 2019-06-04 07:38:00 -07:00
rref.rst Fix RRef design doc warning (#30240) 2019-11-21 16:22:39 -08:00
serialization.rst code syntax error in document (serialization.rst) (#937) 2017-03-06 10:06:04 -05:00
windows.rst Update MKL to 2020.0.166 for Windows (#33690) 2020-02-24 22:43:34 -08:00