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.

config.h 2.1 kB

5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 { Inference = 0, Train = 1, Code_Unknown = 99 };
  22. class Configurator {
  23. public:
  24. static Configurator *GetInstance() {
  25. static Configurator configurator;
  26. return &configurator;
  27. }
  28. void set_code_path(const std::string &code_path) { code_path_ = code_path; }
  29. std::string code_path() const { return code_path_; }
  30. void set_target(Target target) { target_ = target; }
  31. Target target() const { return target_; }
  32. void set_code_mode(CodeMode code_mode) { code_mode_ = code_mode; }
  33. CodeMode code_mode() const { return code_mode_; }
  34. void set_debug_mode(bool debug) { debug_mode_ = debug; }
  35. bool debug_mode() const { return debug_mode_; }
  36. void set_support_parallel(bool parallel) { support_parallel_ = parallel; }
  37. bool support_parallel() const { return support_parallel_; }
  38. int ParseProjDir(std::string model_path);
  39. std::string proj_dir() const { return proj_dir_; }
  40. private:
  41. Configurator() = default;
  42. ~Configurator() = default;
  43. std::string code_path_;
  44. Target target_{kTargetUnknown};
  45. CodeMode code_mode_{Code_Unknown};
  46. bool support_parallel_{false};
  47. bool debug_mode_{false};
  48. std::string proj_dir_;
  49. };
  50. } // namespace mindspore::lite::micro
  51. #endif // MICRO_CODER_CONFIG_H