summaryrefslogtreecommitdiff
path: root/compiler/locop
diff options
context:
space:
mode:
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>2019-08-27 10:11:24 +0900
committerGitHub Enterprise <noreply-CODE@samsung.com>2019-08-27 10:11:24 +0900
commite0bc4ffc948af65b4496f59d86a3c05db5c42ec9 (patch)
treebd0800bff713fd2a31d799a5e5fb30b53e51237b /compiler/locop
parent797a85537cb26a845115db59eb88f7e54ef09c1d (diff)
downloadnnfw-e0bc4ffc948af65b4496f59d86a3c05db5c42ec9.tar.gz
nnfw-e0bc4ffc948af65b4496f59d86a3c05db5c42ec9.tar.bz2
nnfw-e0bc4ffc948af65b4496f59d86a3c05db5c42ec9.zip
[locop] Show Graph Input/Output (#6911)
LinearV1 Graph Format now shows graph input/output metadata, too. Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
Diffstat (limited to 'compiler/locop')
-rw-r--r--compiler/locop/src/FormattedGraph.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/compiler/locop/src/FormattedGraph.cpp b/compiler/locop/src/FormattedGraph.cpp
index 82023e37a..e5ed3cb07 100644
--- a/compiler/locop/src/FormattedGraph.cpp
+++ b/compiler/locop/src/FormattedGraph.cpp
@@ -15,6 +15,7 @@
*/
#include "locop/FormattedGraph.h"
+#include "locop/FormattedTensorShape.h"
#include <pp/Format.h>
@@ -37,6 +38,13 @@ std::string symbol_lookup(const SymbolTable &tbl, const loco::Node *node)
return tbl.lookup(node);
};
+// TODO Use locop::fmt<TensorShapeFormat ...>
+locop::FormattedTensorShape<locop::TensorShapeFormat::Bracket>
+formatted_tensor_shape(const loco::TensorShape *ptr)
+{
+ return locop::FormattedTensorShape<locop::TensorShapeFormat::Bracket>{ptr};
+}
+
} // namespace
namespace
@@ -244,6 +252,45 @@ void FormattedGraphImpl<Formatter::LinearV1>::dump(std::ostream &os) const
node_summary_builder = stdex::make_unique<BuiltinNodeSummaryBuilder>(&symbols);
}
+ // Print Graph Input(s)
+ for (uint32_t n = 0; n < _graph->inputs()->size(); ++n)
+ {
+ auto input = _graph->inputs()->at(n);
+
+ std::string name = input->name();
+
+ std::string shape = "?";
+ if (input->shape() != nullptr)
+ {
+ shape = pp::fmt(formatted_tensor_shape(input->shape()));
+ }
+
+ // TODO Print dtype
+ os << pp::fmt("In #", n, " { name: ", name, ", shape: ", shape, " }") << std::endl;
+ }
+
+ // Print Graph Output(s)
+ for (uint32_t n = 0; n < _graph->outputs()->size(); ++n)
+ {
+ auto output = _graph->outputs()->at(n);
+
+ std::string name = output->name();
+
+ std::string shape = "?";
+ if (output->shape() != nullptr)
+ {
+ shape = pp::fmt(formatted_tensor_shape(output->shape()));
+ }
+
+ // TODO Print dtype
+ os << pp::fmt("Out #", n, " { name: ", name, ", shape: ", shape, " }") << std::endl;
+ }
+
+ if (_graph->inputs()->size() + _graph->outputs()->size() != 0)
+ {
+ os << std::endl;
+ }
+
for (auto it = clusters.begin(); it != clusters.end(); ++it)
{
std::vector<loco::Node *> cluster_outputs;