summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>2019-09-17 04:41:46 (GMT)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>2019-09-17 04:41:46 (GMT)
commitb34791bcdeec045511e0f6113135eee18fcfdec2 (patch)
tree8851ab1d1e76d0aee4545c85c7c57bd5c87c6dec
parentd752c054cfe04685e04b2ab4eec31c65b3fed3e4 (diff)
downloadnnfw-b34791bcdeec045511e0f6113135eee18fcfdec2.zip
nnfw-b34791bcdeec045511e0f6113135eee18fcfdec2.tar.gz
nnfw-b34791bcdeec045511e0f6113135eee18fcfdec2.tar.bz2
[exo-tflite] Modifying logging of each TFL nodes (#7507)
1) "TFL.xxx" -> "tfl.xxx", 2) op name printing in one method (opname()) Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
-rw-r--r--compiler/exo-tflite/src/TFLFormattedGraph.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/compiler/exo-tflite/src/TFLFormattedGraph.cpp b/compiler/exo-tflite/src/TFLFormattedGraph.cpp
index d6489f2..8b1cfde 100644
--- a/compiler/exo-tflite/src/TFLFormattedGraph.cpp
+++ b/compiler/exo-tflite/src/TFLFormattedGraph.cpp
@@ -26,6 +26,24 @@
namespace
{
+std::string opname(uint32_t opnum)
+{
+ static std::string prefix{"tfl."};
+
+ switch (static_cast<locoex::TFLOpcode>(opnum))
+ {
+#define TFL_NODE(OPCODE, CLASS) \
+ case locoex::TFLOpcode::OPCODE: \
+ return prefix + #OPCODE;
+#include "Dialect/IR/TFLNodes.lst"
+#undef TFL_NODE
+ default:
+ break;
+ };
+
+ return prefix + "Invalid";
+}
+
// TFLNodeSummaryBuilder with default implementation
class TFLNodeSummaryBuilderBase : public locop::NodeSummaryBuilder
{
@@ -39,12 +57,12 @@ public:
bool build(const loco::Node *, locop::NodeSummary &s) const final;
protected:
-#define TFL_NODE(OPCODE, CLASS) \
- virtual bool summary(const CLASS *, locop::NodeSummary &s) const \
- { \
- s.opname("NYI_" #CLASS); \
- s.state(locop::NodeSummary::State::PartiallyKnown); \
- return true; \
+#define TFL_NODE(OPCODE, CLASS) \
+ virtual bool summary(const CLASS *, locop::NodeSummary &s) const \
+ { \
+ s.comments().append("Emitted by Default TFLNodeSummaryBuilder"); \
+ s.state(locop::NodeSummary::State::PartiallyKnown); \
+ return true; \
}
#include "Dialect/IR/TFLNodes.lst"
#undef TFL_NODE
@@ -82,6 +100,7 @@ bool TFLNodeSummaryBuilderBase::build(const loco::Node *node, locop::NodeSummary
#define TFL_NODE(OPCODE, CLASS) \
if (dynamic_cast<const CLASS *>(node)) \
{ \
+ s.opname(opname(node->opnum())); \
return summary(dynamic_cast<const CLASS *>(node), s); \
}
#include "Dialect/IR/TFLNodes.lst"
@@ -92,7 +111,6 @@ bool TFLNodeSummaryBuilderBase::build(const loco::Node *node, locop::NodeSummary
bool TFLNodeSummaryBuilder::summary(const locoex::TFLAdd *node, locop::NodeSummary &s) const
{
- s.opname("TFL.ADD");
s.args().append("x", tbl()->lookup(node->x()));
s.args().append("y", tbl()->lookup(node->y()));
s.state(locop::NodeSummary::State::Complete);
@@ -102,7 +120,6 @@ bool TFLNodeSummaryBuilder::summary(const locoex::TFLAdd *node, locop::NodeSumma
bool TFLNodeSummaryBuilder::summary(const locoex::TFLAveragePool2D *node,
locop::NodeSummary &s) const
{
- s.opname("TFL.AVERAGE_POOL_2D");
s.args().append("input", tbl()->lookup(node->value()));
s.state(locop::NodeSummary::State::PartiallyKnown);
return true;
@@ -118,7 +135,6 @@ bool TFLNodeSummaryBuilder::summary(const locoex::TFLAveragePool2D *node,
bool TFLNodeSummaryBuilder::summary(const locoex::TFLMaxPool2D *node, locop::NodeSummary &s) const
{
- s.opname("TFL.MAX_POOL_2D");
s.args().append("input", tbl()->lookup(node->value()));
s.state(locop::NodeSummary::State::PartiallyKnown);
return true;
@@ -126,7 +142,6 @@ bool TFLNodeSummaryBuilder::summary(const locoex::TFLMaxPool2D *node, locop::Nod
bool TFLNodeSummaryBuilder::summary(const locoex::TFLMul *node, locop::NodeSummary &s) const
{
- s.opname("TFL.MUL");
s.args().append("x", tbl()->lookup(node->x()));
s.args().append("y", tbl()->lookup(node->y()));
s.state(locop::NodeSummary::State::Complete);
@@ -135,7 +150,6 @@ bool TFLNodeSummaryBuilder::summary(const locoex::TFLMul *node, locop::NodeSumma
bool TFLNodeSummaryBuilder::summary(const locoex::TFLRelu *node, locop::NodeSummary &s) const
{
- s.opname("TFL.RELU");
s.args().append("input", tbl()->lookup(node->features()));
s.state(locop::NodeSummary::State::Complete);
return true;