pytorch/torch
Pieter Noordhuis 9b69da2b55 Allow for iterations where no module parameter is used (#19821)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19821

It is possible that not a single parameter is used during an
iteration. If this is the case, the `prepare_for_backward` function
marks all parameters as unused, kicks off reduction of all buckets,
*and* finalizes the reduction.

This is different from the prior implementation where we assumed that
autograd would produce a gradient for at least a single parameter.
We then used the autograd callback mechanism to queue a finalizer
callback. Now, this finalizer may be executed in line.

Reviewed By: mrshenli

Differential Revision: D15113272

fbshipit-source-id: dc91458b569cd8c106ddaeea558464b515683550
2019-04-27 22:57:59 -07:00
..
_thnn Turn on F401: Unused import warning. (#18598) 2019-03-30 09:01:17 -07:00
autograd Profiler: add Self CPU Time Total, CPU time total and other general improvements (#19378) 2019-04-25 20:53:55 -07:00
backends Add device-specific cuFFT plan caches (#19300) 2019-04-18 06:39:35 -07:00
contrib Remove GraphExecutor's python bindings (#19141) 2019-04-13 08:42:24 -07:00
csrc Allow for iterations where no module parameter is used (#19821) 2019-04-27 22:57:59 -07:00
cuda add torch.cuda.synchronize(device=None) (#19573) 2019-04-23 08:40:38 -07:00
distributed Add support for reduce-scatter in c10d (#18844) 2019-04-26 13:46:57 -07:00
distributions Fix precision issue with expansion that prefers 'probs' over 'logits' (#18614) 2019-04-05 13:07:01 -07:00
for_onnx Turn on F401: Unused import warning. (#18598) 2019-03-30 09:01:17 -07:00
jit use fully qualified name for ScriptClasses (#19239) 2019-04-26 19:17:21 -07:00
legacy Remove torch/legacy (#11823) 2018-09-20 14:00:54 -07:00
lib Fix CUDA stream syncing bug in allgather and reduce_scatter (#19631) 2019-04-27 08:35:56 -07:00
multiprocessing fixes multiprocessing serialization for integer nn.Parameter (#18639) 2019-04-01 17:15:42 -07:00
nn update F.grid_sample doc for clarity (#19754) 2019-04-26 16:01:24 -07:00
onnx Removing unused arg f from _model_to_graph(). (#19647) 2019-04-26 09:40:52 -07:00
optim Revert D14577575: [pytorch][PR] Fix lack of state init for adagrad and add share_memory flag 2019-04-26 15:43:04 -07:00
sparse Correct conv and pooling docstrings in nn module (#17052) 2019-02-15 06:58:02 -08:00
testing Bool Tensor for CUDA (#18166) 2019-04-02 16:17:05 -07:00
utils DataLoader docs update to describe how workers are managed, including Windows. (#18091) 2019-04-26 16:01:30 -07:00
__config__.py Add torch.__config__.show(), reporting detailed version of all libraries. (#18579) 2019-04-09 11:13:24 -07:00
__init__.py add/move a few apis in torch.hub (#18758) 2019-04-10 23:10:39 -07:00
__init__.pyi.in Add torch.unique_consecutive (#19060) 2019-04-10 07:36:08 -07:00
_jit_internal.py Respect order of Parameters in rnn.py (#18198) 2019-04-18 11:18:20 -07:00
_ops.py Override the resolve_library_path in FBCode (#17497) 2019-03-12 22:09:24 -07:00
_six.py Turn on F401: Unused import warning. (#18598) 2019-03-30 09:01:17 -07:00
_storage_docs.py Bool tensor. Part 0: Boolean storage implementation (#16810) 2019-02-19 08:22:13 -08:00
_tensor_docs.py Rename potri to cholesky_inverse (#19498) 2019-04-22 08:18:39 -07:00
_tensor_str.py Add MKL-DNN Tensor (#17748) 2019-04-08 21:41:38 -07:00
_torch_docs.py Add base support to torch.logspace, default base=10 (#19542) 2019-04-23 15:06:34 -07:00
_utils_internal.py Override the resolve_library_path in FBCode (#17497) 2019-03-12 22:09:24 -07:00
_utils.py flake8 fix 2019-04-03 14:14:18 -07:00
abi-check.cpp Fixes for Torch Script C++ API (#11682) 2018-09-17 09:54:50 -07:00
CMakeLists.txt use fully qualified name for ScriptClasses (#19239) 2019-04-26 19:17:21 -07:00
extension.h Remove deprecated variable_tensor_functions (#15003) 2018-12-11 17:16:11 -08:00
functional.py Rename potri to cholesky_inverse (#19498) 2019-04-22 08:18:39 -07:00
hub.py hub minor fixes (#19247) 2019-04-17 21:04:33 -07:00
py.typed More type stubs (#18511) 2019-04-01 16:03:58 -07:00
quasirandom.py Introduce SobolEngine (#10505) 2019-03-26 07:53:07 -07:00
random.py Turn on F401: Unused import warning. (#18598) 2019-03-30 09:01:17 -07:00
README.txt
script.h Use torch:: instead of at:: in all C++ APIs (#13523) 2018-11-06 14:32:25 -08:00
serialization.py Serialization supports pathlib.Path object for the input argument (#18562) 2019-03-28 21:01:15 -07:00
storage.py Bool tensor. Part 0: Boolean storage implementation (#16810) 2019-02-19 08:22:13 -08:00
tensor.py Rename potri to cholesky_inverse (#19498) 2019-04-22 08:18:39 -07:00

Note [TH abstraction violation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TH/THC provide some hpp headers, which are proper C++ headers rather than
C headers.  These headers serve double duty as *internal implementation
detail* headers, whose contents should largely not be used by external
clients.

Ideally, we would not install these headers at all; instead, you should
use public functions (in headers like `THTensor.h`, NOT `THTensor.hpp`)
to manipulate these structs.  However, there are a few places
in torch/csrc where we violate this abstraction.  They are marked with
a pointer to this note.  Each of those sites will have to be refactored
when we refactor the guts of THTensor and related structures.