[Static Runtime] SR clones graph input (#63704)
authorMike Iovine <mikeiovine@fb.com>
Tue, 24 Aug 2021 01:43:17 +0000 (18:43 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 24 Aug 2021 01:45:41 +0000 (18:45 -0700)
commitd96ef8c1b1860185f0bd91699f71a087cf9e9efe
treee599efdd415c8c5a0b078b9ab32ea831c770edd6
parent195c60d84460d16311ad606e504eda17b795a820
[Static Runtime] SR clones graph input (#63704)

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

Previously SR did not clone the graph. This was leading to subtle bugs in `testStaticRuntime`; static runtime would modify its graph, and the graph used by the JIT interpreter would change as well. The JIT interpreter would then crash if SR-only ops were added!

Cloning the graph is more consistent with the behavior of the `Module` ctor.

Test Plan: `buck test caffe2/benchmarks/static_runtime/...`

Reviewed By: hlu1

Differential Revision: D30463294

fbshipit-source-id: b771551a1f55f95fde79373b23babcf3e5ddf726
torch/csrc/jit/runtime/static/impl.cpp