Ver código fonte

Add torch script

Lutz Roeder 7 anos atrás
pai
commit
cbace6bf7e
2 arquivos alterados com 46 adições e 0 exclusões
  1. 45 0
      tools/torch
  2. 1 0
      tools/update

+ 45 - 0
tools/torch

@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -e
+
+root=$(cd $(dirname ${0})/..; pwd)
+node_modules=${root}/node_modules
+src=${root}/src
+tools=${root}/tools
+third_party=${root}/third_party
+
+identifier=torch
+
+bold() {
+    echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)" 
+}
+
+git_sync() {
+    mkdir -p "${third_party}"
+    if [ -d "${third_party}/${1}" ]; then
+        git -C "${third_party}/${1}" fetch -p --quiet
+        git -C "${third_party}/${1}" reset --quiet --hard origin/master
+    else
+        echo "Clone ${2}..."
+        git -C "${third_party}" clone --recursive ${2}
+    fi
+    git -C "${third_party}" submodule update --init
+}
+
+clean() {
+    bold "torch clean"
+    rm -rf ${third_party}/${identifier}
+}
+
+sync() {
+    bold "torch sync"
+    git_sync torch https://github.com/torch/torch7.git
+}
+
+while [ "$#" != 0 ]; do
+    command="$1" && shift
+    case "${command}" in
+        "clean") clean;;
+        "sync") sync;;
+    esac
+done

+ 1 - 0
tools/update

@@ -15,3 +15,4 @@ ${tools}/pytorch sync install schema metadata
 ${tools}/sklearn sync install metadata
 ${tools}/tf sync install schema metadata
 ${tools}/tflite sync install schema
+${tools}/torch sync