bug fix for node with writers in create autodiff subgraph (#18491)
authorElias Ellison <eellison@fb.com>
Wed, 27 Mar 2019 23:02:10 +0000 (16:02 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 27 Mar 2019 23:08:03 +0000 (16:08 -0700)
commitad1ebf70827e367c8d0eae8852e11f2289301607
tree3c81bb36231609b6f3c641b067aa3dd75a9bad32
parentd74b11ce0ed33a13bb6befff03c83a3d115255b1
bug fix for node with writers in create autodiff subgraph (#18491)

Summary:
Previously we were moving nodes with writers into differentiable subgraphs, without necessarily preserving whether or not they were written to. This can lead to bugs with CSE, which needs that context.

I'm not completely sure if there's anything else we can do to be more aggresive here - inline these nodes and not run CSE and just run constant pooling, or possibly something else, but I think we should land this correctness condition first and then possibly think further.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18491

Differential Revision: D14648562

Pulled By: eellison

fbshipit-source-id: bc1e444774ccdb708e22f0e06a477a221a231f9e
test/test_jit.py
torch/csrc/jit/passes/create_autodiff_subgraphs.cpp