1 /** 2 * Copyright 2019-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_UTILS_CALLBACKS_H_ 17 #define MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CALLBACKS_H_ 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 #include <memory> 23 #include "ir/tensor.h" 24 #include "include/common/visible.h" 25 26 namespace mindspore { 27 namespace callbacks { 28 29 using mindspore::tensor::TensorPtr; 30 // define the python callback module and function 31 extern const char PYTHON_MOD_CALLBACK_MODULE[]; 32 extern const char PYTHON_FUN_PROCESS_CHECKPOINT[]; 33 extern const char PYTHON_FUN_PROCESS_SUMMARY[]; 34 35 COMMON_EXPORT extern const char kSummary[]; 36 COMMON_EXPORT extern const char kCheckPoint[]; 37 38 const int kCallbackOk = 0; 39 const int kCallbackFalied = 1; 40 41 bool GetParameterShape(const FuncGraphPtr &anf_graph, const std::string ¶m_name, 42 const std::shared_ptr<std::vector<int>> &shape); 43 COMMON_EXPORT uint32_t SummarySaveCallback(uint32_t, const std::map<std::string, TensorPtr> &); 44 } // namespace callbacks 45 } // namespace mindspore 46 47 #endif // MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CALLBACKS_H_ 48