소스 검색

Update third_party folders

Lutz Roeder 6 년 전
부모
커밋
04e5ee4735
22개의 변경된 파일207개의 추가작업 그리고 230개의 파일을 삭제
  1. 8 10
      tools/armnn
  2. 8 10
      tools/bigdl
  3. 6 8
      tools/caffe
  4. 5 7
      tools/chainer
  5. 18 10
      tools/cntk
  6. 8 11
      tools/coreml
  7. 5 7
      tools/darknet
  8. 5 7
      tools/dl4j
  9. 12 12
      tools/keras
  10. 7 9
      tools/mlnet
  11. 1 1
      tools/mlnet-script.py
  12. 8 10
      tools/mnn
  13. 7 9
      tools/mxnet
  14. 5 7
      tools/ncnn
  15. 17 15
      tools/onnx
  16. 8 8
      tools/paddle
  17. 11 13
      tools/pytorch
  18. 13 15
      tools/sklearn
  19. 36 38
      tools/tf
  20. 1 1
      tools/tf-script.py
  21. 13 15
      tools/tflite
  22. 5 7
      tools/torch

+ 8 - 10
tools/armnn

@@ -9,17 +9,15 @@ bold() {
 
 clean() {
     bold "armnn clean"
-    rm -rf ./third_party/armnn
+    rm -rf ./third_party/src/armnn
 }
 
 sync() {
     bold "armnn sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/armnn" ]; then
-        git -C "./third_party/armnn" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --branch master --recursive https://github.com/ARM-software/armnn.git
-    fi
+    [ -d "./third_party/src/armnn" ] || git clone --quiet --branch master https://github.com/ARM-software/armnn.git "./third_party/src/armnn"
+    pushd "./third_party/src/armnn" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 schema() {
@@ -27,7 +25,7 @@ schema() {
     case "${OSTYPE}" in
         linux*)
             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}
+            flatc_dir=./third_party/bin/flatbuffers/${flatc_version}
             if [ ! -f "${flatc_dir}/flatc" ]; then
                 mkdir -p "${flatc_dir}"
                 pushd "${flatc_dir}" > /dev/null
@@ -44,7 +42,7 @@ schema() {
             ;;
         msys*)
             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}
+            flatc_dir=./third_party/bin/flatbuffers/${flatc_version}
             if [ ! -f "${flatc_dir}/flatc.exe" ]; then
                 mkdir -p "${flatc_dir}"
                 pushd "${flatc_dir}" > /dev/null
@@ -56,7 +54,7 @@ schema() {
             ;;
     esac
     [[ $(grep -U $'\x0D' ./src/armnn-schema.js) ]] && crlf=1
-    ${flatc} --no-js-exports -o ./tools/. --js ./third_party/armnn/src/armnnSerializer/ArmnnSchema.fbs
+    ${flatc} --no-js-exports -o ./tools/. --js ./third_party/src/armnn/src/armnnSerializer/ArmnnSchema.fbs
     mv ./tools/ArmnnSchema_generated.js ./src/armnn-schema.js
     cat <<EOT >> ./src/armnn-schema.js
 if (typeof module !== 'undefined' && typeof module.exports === 'object') {

+ 8 - 10
tools/bigdl

@@ -9,25 +9,23 @@ bold() {
 
 clean() {
     bold "bigdl clean"
-    rm -rf ./third_party/bigdl
+    rm -rf ./third_party/src/bigdl
 }
 
 sync() {
     bold "bigdl sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/bigdl" ]; then
-        git -C "./third_party/bigdl" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/intel-analytics/BigDL.git bigdl
-    fi
-    git -C "./third_party/bigdl" submodule sync --quiet
-    git -C "./third_party/bigdl" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/bigdl" ] || git clone --quiet --recursive https://github.com/intel-analytics/BigDL.git "./third_party/src/bigdl"
+    pushd "./third_party/src/bigdl" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 schema() {
     bold "bigdl schema"
     [[ $(grep -U $'\x0D' ./src/bigdl-proto.js) ]] && crlf=1
-    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r bigdl -o ./src/bigdl-proto.js ./third_party/bigdl/spark/dl/src/main/resources/serialization/bigdl.proto
+    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r bigdl -o ./src/bigdl-proto.js ./third_party/src/bigdl/spark/dl/src/main/resources/serialization/bigdl.proto
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/bigdl-proto.js ./src/bigdl-proto.js
     fi

+ 6 - 8
tools/caffe

@@ -10,23 +10,21 @@ bold() {
 
 clean() {
     bold "caffe clean"
-    rm -rf ./third_party/caffe
+    rm -rf "./third_party/src/caffe"
 }
 
 sync() {
     bold "caffe sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/caffe" ]; then
-        git -C "./third_party/caffe" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/BVLC/caffe.git
-    fi
+    [ -d "./third_party/src/caffe" ] || git clone --quiet https://github.com/BVLC/caffe.git "./third_party/src/caffe"
+    pushd "./third_party/src/caffe" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 schema() {
     bold "caffe schema"
     [[ $(grep -U $'\x0D' ./src/caffe-proto.js) ]] && crlf=1
-    sed 's/required float min = 1;/optional float min = 1;/g;s/required float max = 2;/optional float max = 2;/g' < ./third_party/caffe/src/caffe/proto/caffe.proto >./tools/caffe.proto
+    sed 's/required float min = 1;/optional float min = 1;/g;s/required float max = 2;/optional float max = 2;/g' < ./third_party/src/caffe/src/caffe/proto/caffe.proto >./tools/caffe.proto
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r caffe -o ./src/caffe-proto.js ./tools/caffe.proto
     rm ./tools/caffe.proto
     node ./tools/update_pbjs.js array ./src/caffe-proto.js data float 1

+ 5 - 7
tools/chainer

@@ -9,17 +9,15 @@ bold() {
 
 clean() {
     bold "chainer clean"
-    rm -rf ./chainer
+    rm -rf "./third_party/src/chainer"
 }
 
 sync() {
     bold "chainer sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/chainer" ]; then
-        git -C "./third_party/chainer" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/chainer/chainer.git
-    fi
+    [ -d "./third_party/src/chainer" ] || git clone --quiet https://github.com/chainer/chainer.git "./third_party/src/chainer"
+    pushd "./third_party/src/chainer" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 while [ "$#" != 0 ]; do

+ 18 - 10
tools/cntk

@@ -9,25 +9,33 @@ bold() {
 
 clean() {
     bold "cntk clean"
-    rm -rf "./third_party/cntk"
+    rm -rf "./third_party/src/cntk"
 }
 
 sync() {
     bold "cntk sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/cntk" ]; then
-        git -C "./third_party/cntk" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/Microsoft/CNTK.git cntk
-    fi
-    git -C "./third_party/cntk" submodule sync --quiet
-    git -C "./third_party/cntk" submodule update --quiet --init --recursive
+    case ${OSTYPE} in
+        linux*|darwin*)
+            [ -d "./third_party/src/cntk" ] || git clone --quiet --recursive https://github.com/Microsoft/CNTK.git "./third_party/src/cntk"
+            pushd "./third_party/src/cntk" > /dev/null
+            git pull --quiet --prune
+            git submodule sync --quiet
+            git submodule update --quiet --init --recursive
+            popd > /dev/null
+        ;;
+        *)
+            [ -d "./third_party/src/cntk" ] || git clone --quiet https://github.com/Microsoft/CNTK.git "./third_party/src/cntk"
+            pushd "./third_party/src/cntk" > /dev/null
+            git pull --quiet --prune
+            popd > /dev/null
+        ;;
+    esac
 }
 
 schema() {
     bold "cntk schema"
     [[ $(grep -U $'\x0D' ./src/cntk-proto.js) ]] && crlf=1
-    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r cntk -o ./src/cntk-proto.js ./third_party/cntk/Source/CNTKv2LibraryDll/proto/CNTK.proto
+    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r cntk -o ./src/cntk-proto.js ./third_party/src/cntk/Source/CNTKv2LibraryDll/proto/CNTK.proto
     node ./tools/update_pbjs.js array ./src/cntk-proto.js value float 1
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/cntk-proto.js ./src/cntk-proto.js

+ 8 - 11
tools/coreml

@@ -9,7 +9,7 @@ case "${OSTYPE}" in
 esac
 
 venv() {
-    venv_dir=./third_party/venv/coremltools
+    venv_dir=./third_party/env/coremltools
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${venv_dir}" in
         msys*) source ${venv_dir}/Scripts/activate;;
@@ -24,25 +24,22 @@ bold() {
 
 clean() {
     bold "coreml clean"
-    rm -rf ./third_party/venv/coremltools
-    rm -rf ./third_party/coremltools
+    rm -rf "./third_party/src/env/coremltools"
+    rm -rf "./third_party/src/coremltools"
 }
 
 sync() {
     bold "coreml sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/coremltools" ]; then
-        git -C "./third_party/coremltools" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/apple/coremltools.git
-    fi
+    [ -d "./third_party/src/coremltools" ] || git clone --quiet https://github.com/apple/coremltools.git "./third_party/src/coremltools"
+    pushd "./third_party/src/coremltools" > /dev/null
+    git pull --quiet --prune
     popd > /dev/null
 }
 
 schema() {
     bold "coreml schema"
     [[ $(grep -U $'\x0D' ./src/coreml-proto.js) ]] && crlf=1
-    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r coreml -o ./src/coreml-proto.js ./third_party/coremltools/mlmodel/format/Model.proto
+    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r coreml -o ./src/coreml-proto.js ./third_party/src/coremltools/mlmodel/format/Model.proto
     node ./tools/update_pbjs.js array ./src/coreml-proto.js floatValue float 2
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/coreml-proto.js ./src/coreml-proto.js
@@ -53,7 +50,7 @@ convert() {
     bold "coreml convert"
     venv
     ${python} -m pip install --quiet --upgrade six numpy protobuf
-    ${python} -m pip install --quiet ./third_party/coremltools
+    ${python} -m pip install --quiet ./third_party/src/coremltools
     ${python} -m pip install --quiet onnx
     ${python} -m pip install --quiet sklearn
     ${python} ./tools/coreml-script.py convert ${1}

+ 5 - 7
tools/darknet

@@ -9,17 +9,15 @@ bold() {
 
 clean() {
     bold "darknet clean"
-    rm -rf ./third_party/darknet
+    rm -rf "./third_party/src/darknet"
 }
 
 sync() {
     bold "darknet sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/darknet" ]; then
-        git -C "./third_party/darknet" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/pjreddie/darknet.git
-    fi
+    [ -d "./third_party/src/darknet" ] || git clone --quiet https://github.com/pjreddie/darknet.git "./third_party/src/darknet"
+    pushd "./third_party/src/darknet" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 while [ "$#" != 0 ]; do

+ 5 - 7
tools/dl4j

@@ -13,17 +13,15 @@ bold() {
 
 clean() {
     bold "deeplearning4j clean"
-    rm -rf "./third_party/dl4j"
+    rm -rf "./third_party/src/dl4j"
 }
 
 sync() {
     bold "deeplearning4j sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/dl4j" ]; then
-        git -C "./third_party/dl4j" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/eclipse/deeplearning4j.git dl4j
-    fi
+    [ -d "./third_party/src/dl4j" ] || git clone --quiet https://github.com/eclipse/deeplearning4j.git "./third_party/src/dl4j"
+    pushd "./third_party/src/dl4j" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 while [ "$#" != 0 ]; do

+ 12 - 12
tools/keras

@@ -13,7 +13,7 @@ bold() {
 }
 
 venv() {
-    venv_dir=./third_party/venv/keras
+    venv_dir=./third_party/env/keras
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${OSTYPE}" in
         msys*) source ${venv_dir}/Scripts/activate ;;
@@ -24,36 +24,36 @@ venv() {
 
 clean() {
     bold "keras clean"
-    rm -rf "./third_party/venv/keras"
-    rm -rf "./third_party/keras"
+    rm -rf "./third_party/env/keras"
+    rm -rf "./third_party/src/keras"
 }
 
 sync() {
     bold "keras sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/keras" ]; then
-        git -C "./third_party/keras" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/keras-team/keras.git
-    fi
-    git -C "./third_party/keras" submodule sync --quiet
-    git -C "./third_party/keras" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/keras" ] || git clone --quiet https://github.com/keras-team/keras.git "./third_party/src/keras"
+    pushd "./third_party/src/keras" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 install() {
     bold "keras install"
     venv
     ${python} -m pip install --quiet --upgrade tensorflow
-    ${python} -m pip install --quiet ./third_party/keras
+    ${python} -m pip install --quiet ./third_party/src/keras
     deactivate
 }
 
 metadata() {
     bold "keras metadata"
+    [[ $(grep -U $'\x0D' ./src/keras-metadata.json) ]] && crlf=1
     venv
     export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
     ${python} ./tools/keras-script.py metadata
     deactivate
+    if [[ -n ${crlf} ]]; then
+        unix2dos --quiet --newfile ./src/keras-metadata.json ./src/keras-metadata.json
+    fi
 }
 
 zoo() {

+ 7 - 9
tools/mlnet

@@ -14,19 +14,17 @@ bold() {
 
 clean() {
     bold "mlnet clean"
-    rm -rf ./third_party/mlnet
+    rm -rf "./third_party/src/mlnet"
 }
 
 sync() {
     bold "mlnet sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/mlnet" ]; then
-        git -C "./third_party/mlnet" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/dotnet/machinelearning.git mlnet
-    fi
-    git -C "./third_party/mlnet" submodule sync --quiet
-    git -C "./third_party/mlnet" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/mlnet" ] || git clone --quiet --recursive https://github.com/dotnet/machinelearning.git "./third_party/src/mlnet"
+    pushd "./third_party/src/mlnet" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 metadata() {

+ 1 - 1
tools/mlnet-script.py

@@ -12,7 +12,7 @@ def metadata():
     json_file = os.path.join(os.path.dirname(__file__), '../src/mlnet-metadata.json')
     json_data = open(json_file).read()
     json_root = json.loads(json_data)
-    manifest_file = os.path.join(os.path.dirname(__file__), '../third_party/mlnet/test/BaselineOutput/Common/EntryPoints/core_manifest.json')
+    manifest_file = os.path.join(os.path.dirname(__file__), '../third_party/src/mlnet/test/BaselineOutput/Common/EntryPoints/core_manifest.json')
     manifest_data = open(manifest_file).read()
     manifest_root = json.loads(manifest_data)
     schema_map = {}

+ 8 - 10
tools/mnn

@@ -9,17 +9,15 @@ bold() {
 
 clean() {
     bold "mnn clean"
-    rm -rf ./third_party/mnn
+    rm -rf "./third_party/src/mnn"
 }
 
 sync() {
     bold "mnn sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/mnn" ]; then
-        git -C "./third_party/mnn" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/alibaba/MNN.git mnn
-    fi
+    [ -d "./third_party/src/mnn" ] || git clone --quiet https://github.com/alibaba/MNN.git "./third_party/src/mnn"
+    pushd "./third_party/src/mnn" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 schema() {
@@ -27,7 +25,7 @@ schema() {
     case "${OSTYPE}" in
         linux*)
             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}
+            flatc_dir=./third_party/bin/flatbuffers/${flatc_version}
             if [ ! -f "${flatc_dir}/flatc" ]; then
                 mkdir -p "${flatc_dir}"
                 pushd "${flatc_dir}" > /dev/null
@@ -44,7 +42,7 @@ schema() {
             ;;
         msys*)
             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}
+            flatc_dir=./third_party/bin/flatbuffers/${flatc_version}
             if [ ! -f "${flatc_dir}/flatc.exe" ]; then
                 mkdir -p "${flatc_dir}"
                 pushd "${flatc_dir}" > /dev/null
@@ -56,7 +54,7 @@ schema() {
             ;;
     esac
     [[ $(grep -U $'\x0D' ./src/mnn-schema.js) ]] && crlf=1
-    ${flatc} --no-js-exports --gen-all -o ./tools/. --js ./third_party/mnn/schema/default/MNN.fbs
+    ${flatc} --no-js-exports --gen-all -o ./tools/. --js ./third_party/src/mnn/schema/default/MNN.fbs
     mv ./tools/MNN_generated.js ./src/mnn-schema.js
     cat <<EOT >> ./src/mnn-schema.js
 if (typeof module !== 'undefined' && typeof module.exports === 'object') {

+ 7 - 9
tools/mxnet

@@ -9,19 +9,17 @@ bold() {
 
 clean() {
     bold "mxnet clean"
-    rm -rf "./third_party/mxnet"
+    rm -rf "./third_party/src/mxnet"
 }
 
 sync() {
     bold "mxnet sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/mxnet" ]; then
-        git -C "./third_party/mxnet" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/apache/incubator-mxnet.git mxnet
-    fi
-    git -C "./third_party/mxnet" submodule sync --quiet
-    git -C "./third_party/mxnet" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/mxnet" ] || git clone --quiet --recursive https://github.com/apache/incubator-mxnet.git "./third_party/src/mxnet"
+    pushd "./third_party/src/mxnet" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 metadata() {

+ 5 - 7
tools/ncnn

@@ -9,17 +9,15 @@ bold() {
 
 clean() {
     bold "ncnn clean"
-    rm -rf "./third_party/ncnn"
+    rm -rf "./third_party/src/ncnn"
 }
 
 sync() {
     bold "ncnn sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/ncnn" ]; then
-        git -C "./third_party/ncnn" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/Tencent/ncnn.git ncnn
-    fi
+    [ -d "./third_party/src/ncnn" ] || git clone --quiet https://github.com/Tencent/ncnn.git "./third_party/src/ncnn"
+    pushd "./third_party/src/ncnn" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 while [ "$#" != 0 ]; do

+ 17 - 15
tools/onnx

@@ -15,7 +15,7 @@ bold() {
 }
 
 venv() {
-    venv_dir=./third_party/venv/onnx
+    venv_dir=./third_party/env/onnx
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${OSTYPE}" in
         msys*) source ${venv_dir}/Scripts/activate;;
@@ -25,21 +25,19 @@ venv() {
 }
 
 git_sync() {
-    mkdir -p "./third_party"
-    if [ -d "./third_party/${1}" ]; then
-        git -C "./third_party/${1}" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive ${2}
-    fi
-    git -C "./third_party/${1}" submodule sync --quiet
-    git -C "./third_party/${1}" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/${1}" ] || git clone --quiet --recursive ${2} "./third_party/src/${1}"
+    pushd "./third_party/src/${1}" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 clean() {
     bold "onnx clean"
-    rm -rf ./third_party/venv/onnx
-    rm -rf ./third_party/onnx
-    rm -rf ./third_party/onnxmltools
+    rm -rf "./third_party/env/onnx"
+    rm -rf "./third_party/src/onnx"
+    rm -rf "./third_party/src/onnxmltools"
 }
 
 sync() {
@@ -62,19 +60,23 @@ install() {
             export PATH=/usr/local/opt/[email protected]/bin:${PATH}
             protobuf="protobuf==3.7.1"
             ;;
+        msys*)
+            [ -n "$(which protoc)" ] || choco install --yes protoc --version=3.8.0
+            protobuf="protobuf==3.8.0"
+            ;;
     esac
     venv
     ${python} -m pip install --quiet --upgrade ${protobuf}
     export ONNX_ML=1
     export ONNX_NAMESPACE=onnx
-    ${python} -m pip install --quiet ./third_party/onnx
+    ${python} -m pip install --quiet "./third_party/src/onnx"
     deactivate
 }
 
 schema() {
     bold "onnx schema"
     [[ $(grep -U $'\x0D' ./src/onnx-proto.js) ]] && crlf=1
-    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r onnx -o ./src/onnx-proto.js ./third_party/onnx/onnx/onnx-ml.proto ./third_party/onnx/onnx/onnx-operators-ml.proto
+    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r onnx -o ./src/onnx-proto.js ./third_party/src/onnx/onnx/onnx-ml.proto ./third_party/src/onnx/onnx/onnx-operators-ml.proto
     node ./tools/update_pbjs.js array ./src/onnx-proto.js float_data float 1
     node ./tools/update_pbjs.js array ./src/onnx-proto.js double_data double 1
     if [[ -n ${crlf} ]]; then
@@ -97,7 +99,7 @@ metadata() {
 convert() {
     bold "onnx convert"
     venv
-    ${python} -m pip install --quiet ./third_party/onnxmltools
+    ${python} -m pip install --quiet ./third_party/src/onnxmltools
     export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
     ${python} ./tools/onnx-script.py convert ${1}
     deactivate

+ 8 - 8
tools/paddle

@@ -9,23 +9,23 @@ bold() {
 
 clean() {
     bold "paddle clean"
-    rm -rf ./third_party/paddle
+    rm -rf "./third_party/src/paddle"
 }
 
 sync() {
     bold "paddle sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/paddle" ]; then
-        git -C "./third_party/paddle" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/PaddlePaddle/Paddle.git paddle
-    fi
+    [ -d "./third_party/src/paddle" ] || git clone --quiet --recursive https://github.com/PaddlePaddle/Paddle.git "./third_party/src/paddle"
+    pushd "./third_party/src/paddle" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 schema() {
     bold "paddle schema"
     [[ $(grep -U $'\x0D' ./src/paddle-proto.js) ]] && crlf=1
-    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r paddle -o ./src/paddle-proto.js ./third_party/paddle/paddle/fluid/framework/framework.proto
+    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case -r paddle -o ./src/paddle-proto.js ./third_party/src/paddle/paddle/fluid/framework/framework.proto
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/paddle-proto.js ./src/paddle-proto.js
     fi

+ 11 - 13
tools/pytorch

@@ -13,7 +13,7 @@ bold() {
 }
 
 venv() {
-    venv_dir=./third_party/venv/pytorch
+    venv_dir=./third_party/env/pytorch
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${OSTYPE}" in
         msys*) source ${venv_dir}/Scripts/activate;;
@@ -23,21 +23,19 @@ venv() {
 }
 
 git_sync() {
-    mkdir -p "./third_party"
-    if [ -d "./third_party/${1}" ]; then
-        git -C "./third_party/${1}" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive ${2} ${1}
-    fi
-    git -C "./third_party/${1}" submodule sync --quiet
-    git -C "./third_party/${1}" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/${1}" ] || git clone --quiet --recursive ${2} "./third_party/src/${1}"
+    pushd "./third_party/src/${1}" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 clean() {
     bold "pytorch clean"
-    rm -rf ./third_party/venv/pytorch
-    rm -rf ./third_party/pytorch
-    rm -rf ./third_party/torchvision
+    rm -rf "./third_party/env/pytorch"
+    rm -rf "./third_party/src/pytorch"
+    rm -rf "./third_party/src/torchvision"
 }
 
 sync() {
@@ -58,7 +56,7 @@ install() {
 schema() {
     bold "caffe2 schema"
     [[ $(grep -U $'\x0D' ./src/caffe2-proto.js) ]] && crlf=1
-    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r caffe2 -o ./src/caffe2-proto.js ./third_party/pytorch/caffe2/proto/caffe2.proto
+    npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r caffe2 -o ./src/caffe2-proto.js ./third_party/src/pytorch/caffe2/proto/caffe2.proto
     node ./tools/update_pbjs.js enumeration ./src/caffe2-proto.js floats float 1
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/caffe2-proto.js ./src/caffe2-proto.js

+ 13 - 15
tools/sklearn

@@ -13,7 +13,7 @@ bold() {
 }
 
 venv() {
-    venv_dir=./third_party/venv/scikit-learn
+    venv_dir=./third_party/env/scikit-learn
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${OSTYPE}" in
         msys*) source ${venv_dir}/Scripts/activate;;
@@ -23,23 +23,21 @@ venv() {
 }
 
 git_sync() {
-    mkdir -p "./third_party"
-    if [ -d "./third_party/${1}" ]; then
-        git -C "./third_party/${1}" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive ${2} ${1}
-    fi
-    git -C "./third_party/${1}" submodule sync --quiet
-    git -C "./third_party/${1}" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/${1}" ] || git clone --quiet --recursive ${2} "./third_party/src/${1}"
+    pushd "./third_party/src/${1}" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 clean() {
     bold "sklearn clean"
-    rm -rf ./third_party/venv/scikit-learn
-    rm -rf ./third_party/numpy
-    rm -rf ./third_party/scikit-learn
-    rm -rf ./third_party/lightgbm
-    rm -rf ./third_party/xgboost
+    rm -rf "./third_party/env/scikit-learn"
+    rm -rf "./third_party/src/numpy"
+    rm -rf "./third_party/src/scikit-learn"
+    rm -rf "./third_party/src/lightgbm"
+    rm -rf "./third_party/src/xgboost"
 }
 
 sync() {
@@ -55,7 +53,7 @@ install() {
     venv
     ${python} -m pip install --quiet six cython pytest flake8 numpy scipy pylint astroid isort
     ${python} -m pip install --quiet --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
-    # ${python} -m pip install --quiet ./third_party/scikit-learn
+    # ${python} -m pip install --quiet ./third_party/src/scikit-learn
     deactivate
 }
 

+ 36 - 38
tools/tf

@@ -13,7 +13,7 @@ bold() {
 }
 
 venv() {
-    venv_dir=./third_party/venv/tensorflow
+    venv_dir=./third_party/env/tensorflow
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${OSTYPE}" in
         msys*) source ${venv_dir}/Scripts/activate;;
@@ -24,20 +24,18 @@ venv() {
 
 clean() {
     bold "tf clean"
-    rm -rf "./third_party/venv/tensorflow"
-    rm -rf "./third_party/tensorflow"
+    rm -rf "./third_party/env/tensorflow"
+    rm -rf "./third_party/src/tensorflow"
 }
 
 sync() {
     bold "tf sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/tensorflow" ]; then
-        git -C "./third_party/tensorflow" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/tensorflow/tensorflow.git
-    fi
-    git -C "./third_party/tensorflow" submodule sync --quiet
-    git -C "./third_party/tensorflow" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/tensorflow" ] || git clone --quiet --recursive https://github.com/tensorflow/tensorflow.git "./third_party/src/tensorflow"
+    pushd "./third_party/src/tensorflow" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 install() {
@@ -51,25 +49,25 @@ schema() {
     bold "tf schema"
     [[ $(grep -U $'\x0D' ./src/tf-proto.js) ]] && crlf=1
     npx pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --no-convert --no-verify --no-create --keep-case --decode-text -r tf -o ./src/tf-proto.js \
-        ./third_party/tensorflow/tensorflow/core/protobuf/saved_model.proto \
-        ./third_party/tensorflow/tensorflow/core/protobuf/meta_graph.proto \
-        ./third_party/tensorflow/tensorflow/core/protobuf/saver.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/graph.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/op_def.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/tensor_shape.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/types.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/node_def.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/versions.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/function.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/attr_value.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/tensor.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/variable.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/resource_handle.proto \
-        ./third_party/tensorflow/tensorflow/core/protobuf/saved_object_graph.proto \
-        ./third_party/tensorflow/tensorflow/core/protobuf/trackable_object_graph.proto \
-        ./third_party/tensorflow/tensorflow/core/protobuf/struct.proto \
-        ./third_party/tensorflow/tensorflow/core/protobuf/tensor_bundle.proto \
-        ./third_party/tensorflow/tensorflow/core/framework/tensor_slice.proto
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/saved_model.proto \
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/meta_graph.proto \
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/saver.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/graph.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/op_def.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/tensor_shape.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/types.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/node_def.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/versions.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/function.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/attr_value.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/tensor.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/variable.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/resource_handle.proto \
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/saved_object_graph.proto \
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/trackable_object_graph.proto \
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/struct.proto \
+        ./third_party/src/tensorflow/tensorflow/core/protobuf/tensor_bundle.proto \
+        ./third_party/src/tensorflow/tensorflow/core/framework/tensor_slice.proto
     if [[ -n ${crlf} ]]; then
         unix2dos --quiet --newfile ./src/tf-proto.js ./src/tf-proto.js
     fi
@@ -90,7 +88,7 @@ metadata() {
             ;;
         msys*)
             protoc_version=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | grep tag_name | cut -f 2 -d : | cut -f 2 -d '"' | cut -f 2 -d v)
-            protoc_dir=$(dirname $(mktemp -u))/protobuf/v${protoc_version}
+            protoc_dir=./third_party/bin/protobuf/v${protoc_version}
             if [ ! -f "${protoc_dir}/bin/protoc.exe" ]; then
                 mkdir -p "${protoc_dir}"
                 pushd "${protoc_dir}" > /dev/null
@@ -101,13 +99,13 @@ metadata() {
             protoc=${protoc_dir}/bin/protoc
             ;;
     esac
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/attr_value.proto --python_out=./tools
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/tensor.proto --python_out=./tools
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/types.proto --python_out=./tools
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/tensor_shape.proto --python_out=./tools
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/resource_handle.proto --python_out=./tools
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/api_def.proto --python_out=./tools
-    ${protoc} --proto_path ./third_party/tensorflow ./third_party/tensorflow/tensorflow/core/framework/op_def.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/attr_value.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/tensor.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/types.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/tensor_shape.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/resource_handle.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/api_def.proto --python_out=./tools
+    ${protoc} --proto_path ./third_party/src/tensorflow ./third_party/src/tensorflow/tensorflow/core/framework/op_def.proto --python_out=./tools
     touch ./tools/tensorflow/__init__.py
     touch ./tools/tensorflow/core/__init__.py
     touch ./tools/tensorflow/core/framework/__init__.py

+ 1 - 1
tools/tf-script.py

@@ -190,7 +190,7 @@ def metadata():
             return convert_shape(attr_value.shape)
         raise Exception()
 
-    tensorflow_repo_dir = os.path.join(os.path.dirname(__file__), '../third_party/tensorflow')
+    tensorflow_repo_dir = os.path.join(os.path.dirname(__file__), '../third_party/src/tensorflow')
     api_def_map = read_api_def_map(os.path.join(tensorflow_repo_dir, 'tensorflow/core/api_def/base_api'))
     input_file = os.path.join(tensorflow_repo_dir, 'tensorflow/core/ops/ops.pbtxt')
     ops_list = op_def_pb2.OpList()

+ 13 - 15
tools/tflite

@@ -13,7 +13,7 @@ bold() {
 }
 
 venv() {
-    venv_dir=./third_party/venv/tflite
+    venv_dir=./third_party/env/tflite
     [ -d "${venv_dir}" ] || ${python} -m venv ${venv_dir}
     case "${OSTYPE}" in
         msys*) source ${venv_dir}/Scripts/activate;;
@@ -24,20 +24,18 @@ venv() {
 
 clean() {
     bold "tflite clean"
-    rm -rf ./third_party/venv/tflite
-    rm -rf ./third_party/tensorflow
+    rm -rf "./third_party/env/tflite"
+    rm -rf "./third_party/src/tensorflow"
 }
 
 sync() {
     bold "tflite sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/tensorflow" ]; then
-        git -C "./third_party/tensorflow" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/tensorflow/tensorflow.git
-    fi
-    git -C "./third_party/tensorflow" submodule sync --quiet
-    git -C "./third_party/tensorflow" submodule update --quiet --init --recursive
+    [ -d "./third_party/src/tensorflow" ] || git clone --quiet --recursive https://github.com/tensorflow/tensorflow.git "./third_party/src/tensorflow"
+    pushd "./third_party/src/tensorflow" > /dev/null
+    git pull --quiet --prune
+    git submodule sync --quiet
+    git submodule update --quiet --init --recursive
+    popd > /dev/null
 }
 
 schema() {
@@ -45,7 +43,7 @@ schema() {
     case "${OSTYPE}" in
         linux*)
             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}
+            flatc_dir=./third_party/bin/flatbuffers/${flatc_version}
             if [ ! -f "${flatc_dir}/flatc" ]; then
                 mkdir -p "${flatc_dir}"
                 pushd "${flatc_dir}" > /dev/null
@@ -62,7 +60,7 @@ schema() {
             ;;
         msys*)
             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}
+            flatc_dir=./third_party/bin/flatbuffers/${flatc_version}
             if [ ! -f "${flatc_dir}/flatc.exe" ]; then
                 mkdir -p "${flatc_dir}"
                 pushd "${flatc_dir}" > /dev/null
@@ -74,7 +72,7 @@ schema() {
             ;;
     esac
     [[ $(grep -U $'\x0D' ./src/tflite-schema.js) ]] && crlf=1
-    sed 's/namespace tflite;/namespace TFLITE;/g' < ./third_party/tensorflow/tensorflow/lite/schema/schema.fbs > ./tools/tflite.schema.fbs
+    sed 's/namespace tflite;/namespace TFLITE;/g' < ./third_party/src/tensorflow/tensorflow/lite/schema/schema.fbs > ./tools/tflite.schema.fbs
     ${flatc} --no-js-exports --js ./tools/tflite.schema.fbs
     rm ./tools/tflite.schema.fbs
     mv ./tflite.schema_generated.js ./src/tflite-schema.js
@@ -93,7 +91,7 @@ visualize() {
     venv
     export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
     ${python} -m pip install --quiet tensorflow
-    ${python} ./third_party/tensorflow/tensorflow/lite/tools/visualize.py $@
+    ${python} ./third_party/src/tensorflow/tensorflow/lite/tools/visualize.py $@
     deactivate
 }
 

+ 5 - 7
tools/torch

@@ -9,17 +9,15 @@ bold() {
 
 clean() {
     bold "torch clean"
-    rm -rf ./third_party/torch
+    rm -rf "./third_party/src/torch"
 }
 
 sync() {
     bold "torch sync"
-    mkdir -p "./third_party"
-    if [ -d "./third_party/torch" ]; then
-        git -C "./third_party/torch" pull --quiet --prune
-    else
-        git -C "./third_party" clone --quiet --recursive https://github.com/torch/torch7.git torch
-    fi
+    [ -d "./third_party/src/torch" ] || git clone --quiet https://github.com/torch/torch7.git "./third_party/src/torch"
+    pushd "./third_party/src/torch" > /dev/null
+    git pull --quiet --prune
+    popd > /dev/null
 }
 
 while [ "$#" != 0 ]; do