reenable rand_like fusion when there is no broadcast (#16087)
authorNatalia Gimelshein <ngimelshein@nvidia.com>
Tue, 19 Feb 2019 18:56:44 +0000 (10:56 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 19 Feb 2019 19:12:25 +0000 (11:12 -0800)
commit19117f6a0a7e30390e2b0efbba1dbc0f7018ff26
treebbaf38db679426ffb1b1396624cf2c851adbafcc
parent43d5cd4d340c41970244c653aa2d1a5f81246c28
reenable rand_like fusion when there is no broadcast (#16087)

Summary:
Reenables rand_like fusion if no tensor is broadcasted in the fusion group. This is a sufficient but not necessary condition for fused rand_like to produce correct results, and it has an unpleasant side effect of falling back to non-fused path if rand_like was optimistically included in the fusion group, but there is a broadcast in the fusion group not necessarily related to rand_like. E.g. before this PR, if the network had (biasAdd -> relu -> dropout), fuser could fuse biasAdd and relu, now it will try fusing the whole thing (if dropout is expressed via rand_like) and fall back every time.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16087

Differential Revision: D13720232

Pulled By: zou3519

fbshipit-source-id: 1e19203bec4a59257bfc7078b054a19f00fab4ad
test/test_jit.py
torch/csrc/jit/autodiff.cpp
torch/csrc/jit/fuser/executor.cpp
torch/csrc/jit/passes/graph_fuser.cpp