More type stubs (#18511)
authorJon Malmaud <malmaud@gmail.com>
Mon, 1 Apr 2019 22:56:21 +0000 (15:56 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 1 Apr 2019 23:03:58 +0000 (16:03 -0700)
commit1b25fdbcd0cd838096dbb8aa3943255e96556dc4
treebd41c4a86451c3f738bf043d4147bd72b23ce39a
parentaa23b8c664e9a833238d17f4fbc3fc3222dd0ac3
More type stubs (#18511)

Summary:
Added stubs for:

* The `device` module
* The `cuda` module
* Parts of the `optim` module
* Began adding stubs for the `autograd` module. I'll annotate more later but `no_grad` and friends are probably the most used exports from it so it seemed like a good place to start.

This would close #16996, although comments on that issue reference other missing stubs so maybe it's worth keeping open as an umbrella issue.

The big remaining missing package is `nn`.

Also added a `py.typed` file so mypy will pick up on the type stubs. That closes #17639.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18511

Differential Revision: D14715053

Pulled By: ezyang

fbshipit-source-id: 9e4882ac997063650e6ce47604b3eaf1232c61c9
12 files changed:
.flake8
setup.py
torch/__init__.pyi.in
torch/autograd/__init__.pyi [new file with mode: 0644]
torch/autograd/grad_mode.pyi [new file with mode: 0644]
torch/cuda/__init__.pyi [new file with mode: 0644]
torch/optim/__init__.pyi [new file with mode: 0644]
torch/optim/adam.pyi [new file with mode: 0644]
torch/optim/lr_scheduler.pyi [new file with mode: 0644]
torch/optim/optimizer.pyi [new file with mode: 0644]
torch/optim/sgd.pyi [new file with mode: 0644]
torch/py.typed [new file with mode: 0644]