1 /** 2 * Copyright 2022 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 #ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_DUMP_UTILS_H_ 17 #define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_DUMP_UTILS_H_ 18 19 #include <string> 20 #include <memory> 21 #include <utility> 22 #include <functional> 23 24 #include "ir/anf.h" 25 #include "ir/dtype/type.h" 26 #include "include/common/visible.h" 27 #include "utils/callback_handler.h" 28 29 namespace mindspore { 30 COMMON_EXPORT std::string GetNodeFuncStr(const AnfNodePtr &nd); 31 COMMON_EXPORT std::string GetKernelNodeName(const AnfNodePtr &anf_node); 32 33 class COMMON_EXPORT AnfDumpHandler { 34 HANDLER_DEFINE(std::string, PrintInputTypeShapeFormat, AnfNodePtr); 35 HANDLER_DEFINE(std::string, PrintOutputTypeShapeFormat, AnfNodePtr); 36 HANDLER_DEFINE(std::string, PrintInputKernelObjectTypes, AnfNodePtr); 37 HANDLER_DEFINE(std::string, PrintOutputKernelObjectTypes, AnfNodePtr); 38 HANDLER_DEFINE(ValuePtr, InStrategyValue, AnfNodePtr); 39 HANDLER_DEFINE(ValuePtr, InStrategyStageValue, AnfNodePtr); 40 HANDLER_DEFINE(ValuePtr, OutStrategyValue, AnfNodePtr); 41 HANDLER_DEFINE(std::string, ValueNodeStr, ValueNodePtr); 42 HANDLER_DEFINE(void, DumpDat, std::string, FuncGraphPtr); 43 }; 44 } // namespace mindspore 45 #endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_DUMP_UTILS_H_ 46