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 17 #ifndef MINDSPORE_LITE_MICRO_CODER_CONFIG_H 18 #define MINDSPORE_LITE_MICRO_CODER_CONFIG_H 19 20 #include <string> 21 22 namespace mindspore::lite::micro { 23 enum Target { kX86 = 0, kARM32M = 1, kARM32A = 2, kARM64 = 3, kAllTargets = 4, kTargetUnknown = 99 }; 24 enum CodeMode { Inference = 0, Train = 1, Code_Unknown = 99 }; 25 26 class Configurator { 27 public: GetInstance()28 static Configurator *GetInstance() { 29 static Configurator configurator; 30 return &configurator; 31 } 32 set_code_path(const std::string & code_path)33 void set_code_path(const std::string &code_path) { code_path_ = code_path; } code_path()34 std::string code_path() const { return code_path_; } 35 set_target(Target target)36 void set_target(Target target) { target_ = target; } target()37 Target target() const { return target_; } 38 set_code_mode(CodeMode code_mode)39 void set_code_mode(CodeMode code_mode) { code_mode_ = code_mode; } code_mode()40 CodeMode code_mode() const { return code_mode_; } 41 set_debug_mode(bool debug)42 void set_debug_mode(bool debug) { debug_mode_ = debug; } debug_mode()43 bool debug_mode() const { return debug_mode_; } 44 set_support_parallel(bool parallel)45 void set_support_parallel(bool parallel) { support_parallel_ = parallel; } support_parallel()46 bool support_parallel() const { return support_parallel_; } 47 48 int ParseProjDir(std::string model_path); proj_dir()49 std::string proj_dir() const { return proj_dir_; } 50 51 private: 52 Configurator() = default; 53 ~Configurator() = default; 54 std::string code_path_; 55 Target target_{kTargetUnknown}; 56 CodeMode code_mode_{Code_Unknown}; 57 bool support_parallel_{false}; 58 bool debug_mode_{false}; 59 std::string proj_dir_; 60 }; 61 } // namespace mindspore::lite::micro 62 63 #endif // MICRO_CODER_CONFIG_H 64