paddle 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. clean() {
  5. echo "paddle clean"
  6. rm -rf "./third_party/source/paddle"
  7. rm -rf "./third_party/source/paddle-lite"
  8. }
  9. sync() {
  10. echo "paddle sync"
  11. mkdir -p "./third_party/source/paddle/paddle/fluid/framework"
  12. curl --silent --location --output "./third_party/source/paddle/paddle/fluid/framework/framework.proto" "https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/framework/framework.proto?raw=true"
  13. mkdir -p "./third_party/source/paddle-lite/lite/model_parser/flatbuffers"
  14. curl --silent --location --output "./third_party/source/paddle-lite/lite/model_parser/flatbuffers/framework.fbs" "https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/lite/model_parser/flatbuffers/framework.fbs?raw=true"
  15. curl --silent --location --output "./third_party/source/paddle-lite/lite/model_parser/flatbuffers/param.fbs" "https://github.com/PaddlePaddle/Paddle-Lite/blob/develop/lite/model_parser/flatbuffers/param.fbs?raw=true"
  16. }
  17. schema() {
  18. echo "paddle schema"
  19. [[ $(grep -U $'\x0D' ./source/paddle-proto.js) ]] && crlf=1
  20. node ./tools/protoc.js --root paddle --text --out ./source/paddle-proto.js ./third_party/source/paddle/paddle/fluid/framework/framework.proto
  21. node ./tools/flatc.js --text --root paddlelite --out ./source/paddle-schema.js ./third_party/source/paddle-lite/lite/model_parser/flatbuffers/param.fbs
  22. if [[ -n ${crlf} ]]; then
  23. unix2dos --quiet --newfile ./source/paddle-proto.js ./source/paddle-proto.js
  24. fi
  25. }
  26. while [ "$#" != 0 ]; do
  27. command="$1" && shift
  28. case "${command}" in
  29. "clean") clean;;
  30. "sync") sync;;
  31. "schema") schema;;
  32. esac
  33. done