From 8f987f2b78556387937693276dd30f2c88a713f3 Mon Sep 17 00:00:00 2001 From: yuliujq <47776208+yuliujq@users.noreply.github.com> Date: Sat, 4 Jan 2020 14:29:37 +0800 Subject: [PATCH 1/2] 'fskip' will not always return false fskip returns false at the end of PackedFunc, discards return true in 'cast' case --- src/relay/backend/build_module.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/relay/backend/build_module.cc b/src/relay/backend/build_module.cc index 102e4c299774..1b5c33c0d9aa 100644 --- a/src/relay/backend/build_module.cc +++ b/src/relay/backend/build_module.cc @@ -327,8 +327,9 @@ class RelayBuildModule : public runtime::ModuleNode { *rv = true; } } + } else { + *rv = false; } - *rv = false; }); pass_seqs.push_back(transform::EliminateCommonSubexpr(fskip)); pass_seqs.push_back(transform::CombineParallelConv2D(3)); From ba8291001757931a53126375d0ce6de95625240d Mon Sep 17 00:00:00 2001 From: yuliujq <47776208+yuliujq@users.noreply.github.com> Date: Tue, 7 Jan 2020 17:28:12 +0800 Subject: [PATCH 2/2] Update build_module.cc --- src/relay/backend/build_module.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/relay/backend/build_module.cc b/src/relay/backend/build_module.cc index 1b5c33c0d9aa..afb03d7ab105 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(); @@ -327,8 +328,6 @@ class RelayBuildModule : public runtime::ModuleNode { *rv = true; } } - } else { - *rv = false; } }); pass_seqs.push_back(transform::EliminateCommonSubexpr(fskip));