cntk 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. set -e
  3. root=$(cd $(dirname ${0})/..; pwd)
  4. node_modules=${root}/node_modules
  5. src=${root}/src
  6. tools=${root}/tools
  7. third_party=${root}/third_party
  8. identifier=cntk
  9. bold() {
  10. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  11. }
  12. git_sync() {
  13. mkdir -p "${third_party}"
  14. if [ -d "${third_party}/${1}" ]; then
  15. git -C "${third_party}/${1}" fetch -p --quiet
  16. git -C "${third_party}/${1}" reset --quiet --hard origin/master
  17. else
  18. echo "Clone ${2}..."
  19. git -C "${third_party}" clone --recursive ${2} ${1}
  20. fi
  21. git -C "${third_party}" submodule update --init
  22. }
  23. clean() {
  24. bold "cntk clean"
  25. rm -rf ${third_party}/cntk
  26. }
  27. sync() {
  28. bold "cntk sync"
  29. git_sync cntk https://github.com/Microsoft/CNTK.git
  30. }
  31. schema() {
  32. bold "cntk schema"
  33. ${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case -r cntk -o ${src}/cntk-proto.js ${third_party}/${identifier}/Source/CNTKv2LibraryDll/proto/CNTK.proto
  34. node ${tools}/update_pbjs.js array ${src}/cntk-proto.js value float 1
  35. }
  36. while [ "$#" != 0 ]; do
  37. command="$1" && shift
  38. case "${command}" in
  39. "clean") clean;;
  40. "sync") sync;;
  41. "schema") schema;;
  42. esac
  43. done