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