From e721d121edd31bf996749ed0cddf731e596bb8c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 25 Nov 2019 12:20:15 +0900 Subject: [PATCH] [moco-lang] Refine error message with header (#9152) This will add comments and refine error message in headers Signed-off-by: SaeHie Park --- compiler/moco/lang/include/moco/IR/TFNodeImpl.h | 8 ++++++-- compiler/moco/lang/include/moco/IR/TFNodeVisitor.h | 8 ++++++-- compiler/moco/lang/include/moco/Names.h | 10 ++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/compiler/moco/lang/include/moco/IR/TFNodeImpl.h b/compiler/moco/lang/include/moco/IR/TFNodeImpl.h index 7ed0959..afc3060 100644 --- a/compiler/moco/lang/include/moco/IR/TFNodeImpl.h +++ b/compiler/moco/lang/include/moco/IR/TFNodeImpl.h @@ -39,7 +39,9 @@ template T TFNode::accept(TFNodeVisitorBase *v) const break; } - throw std::runtime_error{"NYI"}; + // TODO including oops will make oops dependent to modules that include this + // postpone decision to this or not + throw std::runtime_error{"Unsupported Node"}; } template T TFNode::accept(TFNodeMutableVisitorBase *v) @@ -56,7 +58,9 @@ template T TFNode::accept(TFNodeMutableVisitorBase *v) break; } - throw std::runtime_error{"NYI"}; + // TODO including oops will make oops dependent to modules that include this + // postpone decision to this or not + throw std::runtime_error{"Unsupported Node"}; } } // namespace moco diff --git a/compiler/moco/lang/include/moco/IR/TFNodeVisitor.h b/compiler/moco/lang/include/moco/IR/TFNodeVisitor.h index e4c8bff..8d23e44 100644 --- a/compiler/moco/lang/include/moco/IR/TFNodeVisitor.h +++ b/compiler/moco/lang/include/moco/IR/TFNodeVisitor.h @@ -45,8 +45,10 @@ template struct TFNodeVisitor : public TFNodeVisitorBase #include "TFNodes.lst" #undef TENSORFLOW_NODE + // TODO including oops will make oops dependent to modules that include this + // postpone decision to this or not /// @brief Default fallback - virtual T visit(const TFNode *) { throw std::runtime_error{"Not implemented, yet"}; } + virtual T visit(const TFNode *) { throw std::runtime_error{"Unsupported Node"}; } }; /** @@ -70,8 +72,10 @@ template struct TFNodeMutableVisitor : public TFNodeMutableVisitorB #include "TFNodes.lst" #undef TENSORFLOW_NODE + // TODO including oops will make oops dependent to modules that include this + // postpone decision to this or not /// @brief Default fallback - virtual T visit(TFNode *) { throw std::runtime_error{"Not implemented, yet"}; } + virtual T visit(TFNode *) { throw std::runtime_error{"Unsupported Node"}; } }; } // namespace moco diff --git a/compiler/moco/lang/include/moco/Names.h b/compiler/moco/lang/include/moco/Names.h index 6e15bbc..1addc81 100644 --- a/compiler/moco/lang/include/moco/Names.h +++ b/compiler/moco/lang/include/moco/Names.h @@ -47,7 +47,9 @@ public: { if (node_name.find(":") != std::string::npos) // tensor_name is already a form of name:0 { - throw std::runtime_error("Node name has already tensor index:" + node_name); + // TODO including oops will make oops dependent to modules that include this + // postpone decision to this or not + throw std::runtime_error("Error: Node name has already tensor index:" + node_name); } else { @@ -67,7 +69,11 @@ public: if (index != std::string::npos) return _name.substr(0, index); else - throw std::runtime_error{"Tensor name should be a name:number format: " + _name}; + { + // TODO including oops will make oops dependent to modules that include this + // postpone decision to this or not + throw std::runtime_error{"Error: Tensor name should be a 'name:number' format: " + _name}; + } }; private: -- 2.7.4