From 2732a5e5341d67960285e1d73b3c823202575556 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Wed, 3 Jul 2019 16:30:35 -0700 Subject: [PATCH] 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 --- torch/onnx/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/onnx/utils.py b/torch/onnx/utils.py index 2aeb6ca490c9c3..cb6dc08244101f 100644 --- a/torch/onnx/utils.py +++ b/torch/onnx/utils.py @@ -351,7 +351,7 @@ def _model_to_graph(model, args, verbose=False, training=False, 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)