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
broadcasting.rst
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
cuda.rst
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
large_scale_deployments.rst
multiprocessing.rst
randomness.rst
rref.rst Fix RRef design doc warning (#30240) 2019-11-21 16:22:39 -08:00
serialization.rst
windows.rst Update MKL to 2020.0.166 for Windows (#33690) 2020-02-24 22:43:34 -08:00