diff options
author | 박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com> | 2019-09-05 16:38:51 +0900 |
---|---|---|
committer | GitHub Enterprise <noreply-CODE@samsung.com> | 2019-09-05 16:38:51 +0900 |
commit | 780fd11c81d1d1af777844d42bad9de4b7ded475 (patch) | |
tree | 9c612e11fbf5b4e4e843deaac178b9d60b9f7702 /compiler | |
parent | dfce893b570d472eea0b867c1833e4f1d82ef274 (diff) | |
download | nnfw-780fd11c81d1d1af777844d42bad9de4b7ded475.tar.gz nnfw-780fd11c81d1d1af777844d42bad9de4b7ded475.tar.bz2 nnfw-780fd11c81d1d1af777844d42bad9de4b7ded475.zip |
[locop] Show value domain (#7202)
LinearV1 Graph Formatter now shows domain if domain(shape) is known.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/locop/src/FormattedGraph.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/compiler/locop/src/FormattedGraph.cpp b/compiler/locop/src/FormattedGraph.cpp index 4b69a5259..ef483ba26 100644 --- a/compiler/locop/src/FormattedGraph.cpp +++ b/compiler/locop/src/FormattedGraph.cpp @@ -17,6 +17,8 @@ #include "locop/FormattedGraph.h" #include "locop/FormattedTensorShape.h" +#include <loco/Service/ShapeInference.h> + #include <pp/Format.h> #include <stdex/Memory.h> @@ -31,6 +33,30 @@ using locop::SymbolTable; namespace { +std::string str(const loco::Domain &domain) +{ + // TODO Generate! + switch (domain) + { + case loco::Domain::Unknown: + return "Unknown"; + case loco::Domain::Tensor: + return "Tensor"; + case loco::Domain::Feature: + return "Feature"; + case loco::Domain::Filter: + return "Filter"; + case loco::Domain::DepthwiseFilter: + return "DWFilter"; + case loco::Domain::Bias: + return "Bias"; + default: + break; + } + + throw std::invalid_argument{"domain"}; +} + // TODO Use locop::fmt<TensorShapeFormat ...> locop::FormattedTensorShape<locop::TensorShapeFormat::Bracket> formatted_tensor_shape(const loco::TensorShape *ptr) @@ -312,7 +338,17 @@ void FormattedGraphImpl<Formatter::LinearV1>::dump(std::ostream &os) const os << "; " << node_summary.comments().at(n) << std::endl; } - os << symbol(node) << " = " << node_summary << std::endl; + os << symbol(node); + + if (loco::shape_known(node)) + { + auto node_shape = loco::shape_get(node); + os << " : " << str(node_shape.domain()) << "(...)"; + // TODO Show DataType + // TODO Show Shape details + } + + os << " = " << node_summary << std::endl; } os << std::endl; } |