1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 #ifndef TENSORFLOW_LITE_TOCO_MODEL_CMDLINE_FLAGS_H_ 16 #define TENSORFLOW_LITE_TOCO_MODEL_CMDLINE_FLAGS_H_ 17 18 #include <string> 19 #include <unordered_map> 20 #include <vector> 21 22 #include "tensorflow/lite/toco/args.h" 23 #include "tensorflow/lite/toco/model_flags.pb.h" 24 #include "tensorflow/lite/toco/types.pb.h" 25 26 namespace toco { 27 // Parse and remove arguments for models (in toco). Returns true if parsing 28 // is successful. msg has the usage string if there was an error or 29 // "--help" was specified 30 bool ParseModelFlagsFromCommandLineFlags( 31 int* argc, char* argv[], string* msg, 32 ParsedModelFlags* parsed_model_flags_ptr); 33 // Populate the ModelFlags proto with model data. 34 void ReadModelFlagsFromCommandLineFlags( 35 const ParsedModelFlags& parsed_model_flags, ModelFlags* model_flags); 36 // Parse the global model flags to a static 37 void ParseModelFlagsOrDie(int* argc, char* argv[]); 38 // Get the global parsed model flags 39 ParsedModelFlags* GlobalParsedModelFlags(); 40 41 } // namespace toco 42 43 #endif // TENSORFLOW_LITE_TOCO_MODEL_CMDLINE_FLAGS_H_ 44