pytorch/docs
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
..
caffe2 Fix interpreter lines for files with python2-only syntax. 2019-07-09 10:51:43 -07:00
cpp Synchronize with ShipIt. 2020-01-21 13:39:28 -05:00
source [Dist Autograd] Functional API for Dist Autograd and Dist Optimizer (#33711) 2020-02-26 19:08:28 -08:00
.gitignore .gitignore for the docs folder 2019-10-08 12:18:30 -07:00
libtorch.rst Update libtorch docs (#21150) 2019-05-30 12:49:56 -07:00
make.bat Convert all tabs to spaces, add CI. (#18959) 2019-04-09 08:12:26 -07:00
Makefile Rewrite http://pytorch.org -> https://pytorch.org throughout project (#12636) 2018-10-15 13:03:27 -07:00
requirements.txt Revert D19320493: Javadoc changes 2020-01-09 14:23:30 -08:00