Adding torch.futures to API docs (#40051)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/40051

Test Plan: Imported from OSS

Differential Revision: D22055031

Pulled By: mrshenli

fbshipit-source-id: ce8a79ba4ffdc7dbed6d4c62b1c33b96764c89e7
This commit is contained in:
Shen Li
2020-06-17 17:54:18 -07:00
committed by Facebook GitHub Bot
parent 693ab77c00
commit 74142f76fa
3 changed files with 26 additions and 8 deletions

24
docs/source/futures.rst Normal file
View File

@ -0,0 +1,24 @@
.. currentmodule:: torch.futures
.. _futures-docs:
torch.futures
=============
.. warning::
The ``torch.futures`` package is experimental and subject to change.
This package provides a :class:`~torch.futures.Future` type that encapsulates
an asynchronous execution and a set of utility functions to simplify operations
on :class:`~torch.futures.Future` objects. Currently, the
:class:`~torch.futures.Future` type is primarily used by the
:ref:`distributed-rpc-framework`.
.. automodule:: torch.futures
.. autoclass:: Future
:members:
.. autofunction:: collect_all
.. autofunction:: wait_all

View File

@ -39,6 +39,7 @@ PyTorch is an optimized tensor library for deep learning using GPUs and CPUs.
torch.cuda.amp <amp>
torch.distributed <distributed>
torch.distributions <distributions>
futures
torch.hub <hub>
torch.jit <jit>
nn.init
@ -64,7 +65,7 @@ PyTorch is an optimized tensor library for deep learning using GPUs and CPUs.
.. toctree::
:maxdepth: 1
:caption: Libraries
torchaudio <https://pytorch.org/audio>
torchtext <https://pytorch.org/text>
torchvision/index

View File

@ -1,7 +1,3 @@
"""
The ``torch.futures`` package contains a ``Future`` type and corresponding
utility functions.
"""
import torch
@ -10,9 +6,6 @@ class Future(torch._C.Future):
Wrapper around a ``torch._C.Future`` which encapsulates an asynchronous
execution of a callable, e.g. :meth:`~torch.distributed.rpc.rpc_async`. It
also exposes a set of APIs to add callback functions and set results.
.. warning::
The ``torch.futures.Future`` is experimental and subject to change.
"""
def __new__(cls):
return super(Future, cls).__new__(cls)