summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>2019-09-17 17:33:12 +0900
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>2019-09-17 17:33:12 +0900
commitb1e12cf6012c371c5b88572e936e2512f142bbf2 (patch)
tree44c2461300e3b703f6d6515c212ab4fae92ab55a
parent4d4f85e1561eaf7dfd9f4126e24b85af24168d55 (diff)
downloadnnfw-b1e12cf6012c371c5b88572e936e2512f142bbf2.tar.gz
nnfw-b1e12cf6012c371c5b88572e936e2512f142bbf2.tar.bz2
nnfw-b1e12cf6012c371c5b88572e936e2512f142bbf2.zip
[logo] Simplifying `BiasEncode - BiasDecode` subgraph (#7481)
* [logo] Simplifying `BiasEncode - BiasDecode` subgraph With this commit, logo will Simplifying `BiasEncode - BiasDecode` subgraph into loco::Forward Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com> * make code shorter * remove 'using namespace loco;'
-rw-r--r--compiler/logo/src/Passes/SimplifyDomainConversionPass.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/logo/src/Passes/SimplifyDomainConversionPass.cpp b/compiler/logo/src/Passes/SimplifyDomainConversionPass.cpp
index 6bc12d131..f4343c70a 100644
--- a/compiler/logo/src/Passes/SimplifyDomainConversionPass.cpp
+++ b/compiler/logo/src/Passes/SimplifyDomainConversionPass.cpp
@@ -48,6 +48,8 @@ void set_input_null(loco::Node *node)
casted->input(nullptr);
else if (auto casted = dynamic_cast<loco::FeatureDecode *>(node))
casted->input(nullptr);
+ else if (auto casted = dynamic_cast<loco::BiasDecode *>(node))
+ casted->input(nullptr);
else
assert(false && "not supported node type");
}
@@ -128,6 +130,16 @@ bool SimplifyDomainConversionPass::run(loco::Graph *g)
}
}
+ // Let's find `BiasEncode -- BiasDecode` pattern
+ void visit(loco::BiasDecode *decode_node) final
+ {
+ if (auto encode_node = dynamic_cast<loco::BiasEncode *>(decode_node->input()))
+ {
+ assert(encode_node->input() != nullptr);
+ candidates.insert({decode_node, encode_node->input()});
+ }
+ }
+
void visit(loco::Node *) final { return; }
using SimplifyingInfo = std::pair<loco::Node * /* end node of subgraph that will be replaced*/,