2
0

cntk 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. bold() {
  5. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  6. }
  7. clean() {
  8. bold "cntk clean"
  9. rm -rf "./third_party/src/cntk"
  10. }
  11. sync() {
  12. bold "cntk sync"
  13. case ${OSTYPE} in
  14. linux*|darwin*)
  15. [ -d "./third_party/src/cntk" ] || git clone --quiet --recursive https://github.com/Microsoft/CNTK.git "./third_party/src/cntk"
  16. pushd "./third_party/src/cntk" > /dev/null
  17. git pull --quiet --prune
  18. git submodule sync --quiet
  19. git submodule update --quiet --init --recursive
  20. popd > /dev/null
  21. ;;
  22. *)
  23. [ -d "./third_party/src/cntk" ] || git clone --quiet https://github.com/Microsoft/CNTK.git "./third_party/src/cntk"
  24. pushd "./third_party/src/cntk" > /dev/null
  25. git pull --quiet --prune
  26. popd > /dev/null
  27. ;;
  28. esac
  29. }
  30. schema() {
  31. bold "cntk schema"
  32. [[ $(grep -U $'\x0D' ./src/cntk-proto.js) ]] && crlf=1
  33. 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
  34. node ./tools/update_pbjs.js array ./src/cntk-proto.js value float 1
  35. if [[ -n ${crlf} ]]; then
  36. unix2dos --quiet --newfile ./src/cntk-proto.js ./src/cntk-proto.js
  37. fi
  38. }
  39. while [ "$#" != 0 ]; do
  40. command="$1" && shift
  41. case "${command}" in
  42. "clean") clean;;
  43. "sync") sync;;
  44. "schema") schema;;
  45. esac
  46. done