[tf2tflite] driver can takes customop.conf as param (#6272)
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Wed, 7 Aug 2019 06:39:22 +0000 (15:39 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 7 Aug 2019 06:39:22 +0000 (15:39 +0900)
* [tf2tflite] driver can takes customop.conf as param

This commit enable Driver to take customop.conf as the 5th param.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
* optional param: '--customop <customop.conf path>'

* remove strcmp, parse conf before calling import

* nyi error

compiler/tf2tflite/src/Driver.cpp

index a6dba61..8174b44 100644 (file)
@@ -74,6 +74,12 @@ struct LoggingContext
   }
 };
 
+void print_help()
+{
+  std::cerr << "Usage: tf2tflite <path/to/info> <path/to/pb> <path/to/tflite/model> " << std::endl
+            << "Options: --customop <path/to/customop.conf>" << std::endl;
+}
+
 } // namespace
 
 #define LOGGER(name) \
@@ -85,9 +91,10 @@ int main(int argc, char **argv)
 {
   LOGGER(l);
 
-  if (argc != 4)
+  // TODO We need better args parsing in future
+  if (!(argc == 4 or argc == 6))
   {
-    std::cerr << "ERROR: tf2tflite <path/to/info> <path/to/pb> <path/to/tflite/model>" << std::endl;
+    print_help();
     return 255;
   }
 
@@ -117,6 +124,20 @@ int main(int argc, char **argv)
     }
   }
 
+  if (argc == 6) // optional parameter: path of customop.conf
+  {
+    if (std::string{argv[4]} == "--customop")
+    {
+      // TODO fill info from customop.conf
+      throw std::runtime_error("Not yet implemented");
+    }
+    else
+    {
+      print_help();
+      return 255;
+    }
+  }
+
   std::cout << "Read '" << info_path << "' - Done" << std::endl;
 
   std::cout << "Import from '" << tf_path << "'" << std::endl;