• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This is the C++ adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
3  *
4  * Copyright 2022 Huawei Technologies Co., Ltd
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef MINDSPORE_LITE_TOOL_COMMON_FUNC_GRAPH_UTILS_H_
20 #define MINDSPORE_LITE_TOOL_COMMON_FUNC_GRAPH_UTILS_H_
21 
22 #include <string>
23 #include <vector>
24 #include <utility>
25 #include "ir/func_graph.h"
26 
27 namespace mindspore {
28 class FuncGraphUtils {
29  public:
30   static std::vector<std::string> GetFuncGraphOutputNames(const FuncGraphPtr &func_graph);
31   static void SetFuncGraphOutputNames(const FuncGraphPtr &func_graph, const std::vector<std::string> &output_names);
32   static AbstractBasePtr GetAbstractFromNode(const std::pair<AnfNodePtr, int64_t> &node);
33   static void SetOutputName(const std::pair<AnfNodePtr, int64_t> &node, const std::string &name);
34   static std::string GetOutputName(const std::pair<AnfNodePtr, int64_t> &node_index);
35   static tensor::TensorPtr GetParameterConstValue(const AnfNodePtr &anf_node);
36 };
37 }  // namespace mindspore
38 
39 #endif  // MINDSPORE_LITE_TOOL_COMMON_FUNC_GRAPH_UTILS_H_
40