Quellcode durchsuchen

TensorFlow Lite script Git Bash support

Lutz Roeder vor 6 Jahren
Ursprung
Commit
3c297f3ec3
1 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen
  1. 15 2
      tools/tflite

+ 15 - 2
tools/tflite

@@ -54,8 +54,16 @@ schema() {
             FLATC=flatc
             ;;
         msys*)
-            echo "msys flatc not supported" 1>&2
-            exit 1
+            FLATC_VERSION=$(curl -s https://api.github.com/repos/google/flatbuffers/releases/latest | grep tag_name | cut -f 2 -d : | cut -f 2 -d '"')
+            FLATC_DIR=$(dirname $(mktemp -u))/flatbuffers/${FLATC_VERSION}
+            if [ ! -f "${FLATC_DIR}/flatc.exe" ]; then
+                mkdir -p "${FLATC_DIR}"
+                pushd "${FLATC_DIR}" > /dev/null
+                curl -sL -O https://github.com/google/flatbuffers/releases/download/${FLATC_VERSION}/flatc_windows_exe.zip
+                unzip flatc_windows_exe.zip
+                popd > /dev/null
+            fi
+            FLATC=${FLATC_DIR}/flatc.exe
             ;;
     esac
     sed 's/namespace tflite;/namespace TFLITE;/g' <${third_party}/tensorflow/tensorflow/lite/schema/schema.fbs >${tools}/tflite.schema.fbs
@@ -67,6 +75,11 @@ if (typeof module !== 'undefined' && typeof module.exports === 'object') {
   module.exports = TFLITE;
 }
 EOT
+    case "${OSTYPE}" in
+        msys*)
+            unix2dos --quiet --newfile ${src}/tflite-schema.js ${src}/tflite-schema.js
+            ;;
+    esac
 }
 
 visualize() {