pytorch/caffe2
Elias Ellison ca76c82ce3 Add early returns to JIT (#19179)
Summary:
Add early returns to JIT with minimal changes to compiler.cpp and an IR->IR pass that will transform the graph so that there is only one return value.

In compiler.cpp, record when a block will exit so that in the following example will work:
```
if cond:
    a = torch.zeros([2])
else:
    return 2
a += 2
...
```
To match block outputs with values that will not be used, like in the above example with `a`, I add a Bottom Type that subtypes everything else. This allows shape propagation to continue to work, and makes it so that we don't need many extra nodes filling up the graph.

The IR transform currently doesn't work on Loops, I didn't add that to this PR to avoid too much complexity, but will add it as a stack (and it should be very little extra code). the IR  transform is commented at the top of the file.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19179

Differential Revision: D16519819

Pulled By: eellison

fbshipit-source-id: 322a27f69966d1fd074ebe723c3e948b458b0e68
2019-07-26 16:42:43 -07:00
..
contrib Reduce number of processes spawned for gloo_test.TestCase.test_forked_cw (#23221) 2019-07-24 11:31:20 -07:00
core Add support to serialize qtensor in JIT. (#23356) 2019-07-26 15:52:15 -07:00
cuda_rtc
db
distributed
experiments
ideep Removed work around for convolution transpose op since the bug has be… (#22184) 2019-06-25 14:34:34 -07:00
image
mobile Remove API-level guard on NeuralNetworks.h (#22429) 2019-07-01 22:09:11 -07:00
mpi
observers
onnx Add support for onnx tensor index export (#21716) 2019-07-23 17:11:28 -07:00
operators Open source 3D depthwise conv (#23164) 2019-07-24 17:56:56 -07:00
opt caffe2/caffe2/fb/operators/cc_amrc: drop SIMD OpenMP vectorization 2019-07-23 17:25:00 -07:00
perfkernels
predictor BlackBoxPredictor OSS part N: ThreadLocalPtr, InferenceGraph (#23257) 2019-07-24 14:35:30 -07:00
proto Add support to serialize qtensor in JIT. (#23356) 2019-07-26 15:52:15 -07:00
python hook up dropout sparse with replacement operator 2019-07-23 14:34:25 -07:00
quantization Fbgemm fp16 tensor support (#23101) 2019-07-19 17:08:03 -07:00
queue
serialize
sgd support both regularizable and sofmax re-weighting on sparse features in dot product (#22176) 2019-06-24 21:27:33 -07:00
share
test
transforms
utils BlackBoxPredictor OSS part 5: glow transforms 2019-07-23 16:39:23 -07:00
video update video input (#22471) 2019-07-05 00:56:33 -07:00
.clang-format
__init__.py
CMakeLists.txt Add early returns to JIT (#19179) 2019-07-26 16:42:43 -07:00
README.md
release-notes.md
requirements.txt
VERSION_NUMBER

Caffe2

Jenkins Build Status

Caffe2 is a lightweight, modular, and scalable deep learning framework. Building on the original Caffe, Caffe2 is designed with expression, speed, and modularity in mind.

Questions and Feedback

Please use Github issues (https://github.com/pytorch/pytorch/issues) to ask questions, report bugs, and request new features.

Further Resources on Caffe2.ai