1 /** 2 * Copyright 2023 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_LITE_SRC_COMMON_DRAW_ADAPTER_GRAPH_H_ 18 #define MINDSPORE_LITE_SRC_COMMON_DRAW_ADAPTER_GRAPH_H_ 19 20 #include <utility> 21 #include <vector> 22 #include <string> 23 #include <unordered_map> 24 #include "src/common/log_adapter.h" 25 #include "src/common/draw/graphviz_graph.h" 26 #include "src/tensor.h" 27 #include "include/errorcode.h" 28 29 namespace mindspore::lite { 30 class AdapterNode { 31 public: 32 virtual ~AdapterNode() = default; 33 virtual std::string GetName() const = 0; 34 virtual std::vector<Tensor *> GetInputs() const = 0; 35 virtual Tensor *GetInput(const size_t &index) const = 0; 36 virtual size_t InputSize() const = 0; 37 virtual std::vector<Tensor *> GetOutputs() const = 0; 38 virtual Tensor *GetOutput(const size_t &index) const = 0; 39 virtual size_t OutputSize() const = 0; IsHighlight()40 virtual bool IsHighlight() const { return false; } 41 }; 42 43 class AdapterGraph { 44 public: 45 virtual ~AdapterGraph() = default; 46 virtual std::string GetName() const = 0; 47 virtual std::vector<AdapterNode *> GetNodes() const = 0; 48 virtual std::vector<Tensor *> GetInputs() const = 0; 49 virtual size_t InputSize() const = 0; 50 virtual std::vector<Tensor *> GetOutputs() const = 0; 51 virtual size_t OutputSize() const = 0; 52 }; 53 } // namespace mindspore::lite 54 55 #endif // MINDSPORE_LITE_SRC_COMMON_DRAW_ADAPTER_GRAPH_H_ 56