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.

coder_config.h 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * Copyright 2021 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_LITE_MICRO_CODER_CONFIG_H
  17. #define MINDSPORE_LITE_MICRO_CODER_CONFIG_H
  18. #include <string>
  19. namespace mindspore::lite::micro {
  20. enum Target { kX86 = 0, kARM32M = 1, kARM32A = 2, kARM64 = 3, kAllTargets = 4, kTargetUnknown = 99 };
  21. enum CodeMode { Code_Normal = 0, Code_Android = 1, Code_Unknown = 99 };
  22. class Configurator {
  23. public:
  24. static Configurator *GetInstance() {
  25. static Configurator configurator;
  26. return &configurator;
  27. }
  28. void set_module_name(const std::string &module_name) { module_name_ = module_name; }
  29. std::string module_name() const { return module_name_; }
  30. void set_code_path(const std::string &code_path) { code_path_ = code_path; }
  31. std::string code_path() const { return code_path_; }
  32. void set_subgraph_(const std::string &subgraph) { sub_graph_ = subgraph; }
  33. std::string sub_graph() { return sub_graph_; }
  34. void set_target(Target target) { target_ = target; }
  35. Target target() const { return target_; }
  36. void set_code_mode(CodeMode code_mode) { code_mode_ = code_mode; }
  37. CodeMode code_mode() const { return code_mode_; }
  38. void set_debug_mode(bool debug) { debug_mode_ = debug; }
  39. bool debug_mode() const { return debug_mode_; }
  40. void set_is_weight_file(bool flag) { is_weight_file_ = flag; }
  41. bool is_weight_file() const { return is_weight_file_; }
  42. private:
  43. Configurator() = default;
  44. ~Configurator() = default;
  45. bool is_weight_file_{false};
  46. std::string module_name_;
  47. std::string code_path_;
  48. std::string sub_graph_;
  49. Target target_{kTargetUnknown};
  50. CodeMode code_mode_{Code_Unknown};
  51. bool debug_mode_{false};
  52. };
  53. } // namespace mindspore::lite::micro
  54. #endif // MICRO_CODER_CONFIG_H