Improved checking of running environments. (#9197)
author이성재/On-Device Lab(SR)/Principal Engineer/삼성전자 <sj925.lee@samsung.com>
Tue, 26 Nov 2019 05:31:38 +0000 (14:31 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Tue, 26 Nov 2019 05:31:38 +0000 (14:31 +0900)
- Check if `$flatc` path is executable.
- Check if `*.fbs` files actually exists.

Signed-off-by: Sung-Jae Lee <sj925.lee@samsung.com>
tools/nnpackage_tool/tflite2circle/tflite2circle.sh

index 85b77cc..6ad2ef9 100755 (executable)
@@ -10,6 +10,16 @@ flatc=${flatc:-"$nnfw_root/build/externals/FLATBUFFERS/build/flatc"}
 tflite_schema=${tflite_schema:-"$nnfw_root/externals/TENSORFLOW-1.12/tensorflow/contrib/lite/schema/schema.fbs"}
 circle_schema=${circle_schema:-"$nnfw_root/nnpackage/schema/circle_schema.fbs"}
 
+if ! [ -x "$flatc" ]; then
+  echo "Please make sure `flatc` is in path."
+  exit 2
+fi
+
+if ! { [ -e "$tflite_schema" ] && [ -e "$circle_schema" ]; }; then
+  echo "Please make sure that the `*.fbs` paths are set properly."
+  exit 3
+fi
+
 usage() {
   echo "Usage: $progname [options] tflite"
   echo "Convert tflite to circle"