From 4073125d1387ac60aaff4dd9f6231cbfb5fcfc1e Mon Sep 17 00:00:00 2001 From: yuliujq <47776208+yuliujq@users.noreply.github.com> Date: Sat, 11 Jan 2020 08:21:57 +0800 Subject: [PATCH] [Bugfix] fskip of EliminateCommonSubexpr cannot always return false (#4620) * 'fskip' will not always return false fskip returns false at the end of PackedFunc, discards return true in 'cast' case * Update build_module.cc --- src/relay/backend/build_module.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/relay/backend/build_module.cc b/src/relay/backend/build_module.cc index 1883558f50f5..839dabcd0785 100644 --- a/src/relay/backend/build_module.cc +++ b/src/relay/backend/build_module.cc @@ -318,6 +318,7 @@ class RelayBuildModule : public runtime::ModuleNode { pass_seqs.push_back(transform::SimplifyInference()); PackedFunc fskip = PackedFunc([](TVMArgs args, TVMRetValue* rv) { Expr expr = args[0]; + *rv = false; if (expr.as()) { auto call_node = expr.as(); auto op_node = call_node->op.as(); @@ -328,7 +329,6 @@ class RelayBuildModule : public runtime::ModuleNode { } } } - *rv = false; }); pass_seqs.push_back(transform::EliminateCommonSubexpr(fskip)); pass_seqs.push_back(transform::CombineParallelConv2D(3));