You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

callbacks.h 1.6 kB

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