2
0

mslite 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. clean() {
  5. echo "mslite clean"
  6. rm -rf "./third_party/source/mindspore"
  7. }
  8. sync() {
  9. echo "mslite sync"
  10. mkdir -p "./third_party/source/mindspore/mindspore/lite/schema/"
  11. curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/lite/schema/model.fbs" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/lite/schema/model.fbs"
  12. curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/lite/schema/ops.fbs" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/lite/schema/ops.fbs"
  13. curl --silent --show-error --location --output "./third_party/source/mindspore/mindspore/lite/schema/ops_types.fbs" "https://github.com/mindspore-ai/mindspore/raw/master/mindspore/lite/schema/ops_types.fbs"
  14. }
  15. schema() {
  16. echo "mslite schema"
  17. [[ $(grep -U $'\x0D' ./source/mslite-schema.js) ]] && crlf=1
  18. node ./tools/flatc.js --text --root mslite --out ./source/mslite-schema.js ./third_party/source/mindspore/mindspore/lite/schema/model.fbs
  19. if [[ -n ${crlf} ]]; then
  20. unix2dos --quiet --newfile ./source/mslite-schema.js ./source/mslite-schema.js
  21. fi
  22. }
  23. metadata() {
  24. echo "mslite metadata"
  25. [[ $(grep -U $'\x0D' ./source/mslite-metadata.json) ]] && crlf=1
  26. node ./tools/mslite-script.js
  27. if [[ -n ${crlf} ]]; then
  28. unix2dos --quiet --newfile ./source/mslite-metadata.json ./source/mslite-metadata.json
  29. fi
  30. }
  31. while [ "$#" != 0 ]; do
  32. command="$1" && shift
  33. case "${command}" in
  34. "clean") clean;;
  35. "sync") sync;;
  36. "schema") schema;;
  37. "metadata") metadata;;
  38. esac
  39. done