Another dce fix (#22499)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22499
Another place where onnx export is running dead code elimination after making the jit graph invalid. Fixing it.
Reviewed By: houseroad
Differential Revision: D16111969
fbshipit-source-id: 5ba80340c06d091988858077f142ea4e3da0638c
diff --git a/torch/onnx/utils.py b/torch/onnx/utils.py
index 2aeb6ca..cb6dc08 100644
--- a/torch/onnx/utils.py
+++ b/torch/onnx/utils.py
@@ -351,7 +351,7 @@
if do_constant_folding and _export_onnx_opset_version == 9:
params_dict = torch._C._jit_pass_onnx_constant_fold(graph, params_dict)
- torch._C._jit_pass_dce(graph)
+ torch._C._jit_pass_dce_allow_deleting_nodes_with_side_effects(graph)
if verbose:
print(graph)