diff options
Diffstat (limited to 'runtimes/neurun/src/dumper/dot/DotNodeInfo.cc')
-rw-r--r-- | runtimes/neurun/src/dumper/dot/DotNodeInfo.cc | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc b/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc deleted file mode 100644 index aefe12e2a..000000000 --- a/runtimes/neurun/src/dumper/dot/DotNodeInfo.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <sstream> - -#include "DotNodeInfo.h" -#include "graph/Graph.h" -#include "graph/operation/LowerInfo.h" -#include "backend/interface/IConfig.h" - -namespace neurun -{ -namespace dumper -{ -namespace dot -{ - -const std::string DotNodeInfo::NODE_SHAPE = "rect"; -const std::string DotNodeInfo::BG_COLOR_SCHEME = "pastel18"; -// RED BLUE ORANGE YELLOW GREEN PUPLE CYAN PINK -const std::string DotNodeInfo::BG_COLORS[8] = {"1", "2", "5", "6", "3", "4", "7", "8"}; - -DotNodeInfo::DotNodeInfo(const neurun::graph::Graph &graph, - const neurun::model::operation::Index &index, - const neurun::model::operation::Node &node) - : _index(index), _node(node), _lower_info(graph.getLowerInfo(index)) -{ - addBackendLabel(); -} - -std::string DotNodeInfo::index_str() const -{ - std::stringstream ss; - ss << "node" << _index.value(); - - return ss.str(); -} - -std::string DotNodeInfo::label() const -{ - std::stringstream ss; - ss << _index.value() << " : " << _node.getName() << std::endl; - for (auto label : _labels) - { - ss << label << std::endl; - } - - return ss.str(); -} - -std::string DotNodeInfo::dot_shape() const { return NODE_SHAPE; } - -std::string DotNodeInfo::bg_color_scheme() const { return BG_COLOR_SCHEME; } - -std::string DotNodeInfo::bg_color() const -{ - if (!_lower_info) - return DEFAULT_BG_COLOR; - assert(_lower_info != nullptr); - const auto &backend = _lower_info->backend(); - assert(backend != nullptr); - - std::string backend_id = backend->config()->id(); - // TODO : This is just workaround it can be made more efficient. - if (backend_id == "acl_cl") - { - return BG_COLORS[RED]; - } - else if (backend_id == "cpu") - { - return BG_COLORS[BLUE]; - } - else - { - return DEFAULT_BG_COLOR; - } -} - -void DotNodeInfo::addBackendLabel() -{ - if (!_lower_info) - return; - - std::string label; - const auto &backend = _lower_info->backend(); - assert(backend != nullptr); - - label += "[Backend] : "; - label += backend->config()->id(); - _labels.emplace_back(label); -} - -} // namespace dot -} // namespace dumper -} // namespace neurun |