xmodel 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. clean() {
  5. echo "xmodel clean"
  6. rm -rf "./third_party/source/xmodel"
  7. }
  8. sync() {
  9. echo "xmodel sync"
  10. mkdir -p ./third_party/source/xmodel/src/vai_runtime/xir/src/xir/proto
  11. curl --silent --show-error --location --output "./third_party/source/xmodel/src/vai_runtime/xir/src/xir/proto/graph_proto_v2.proto" "https://github.com/Xilinx/Vitis-AI/raw/master/src/vai_runtime/xir/src/xir/proto/graph_proto_v2.proto"
  12. }
  13. schema() {
  14. echo "xmodel schema"
  15. [[ $(grep -U $'\x0D' ./source/xmodel-proto.js) ]] && crlf=1
  16. node ./tools/protoc.js --binary --text --root xmodel --out ./source/xmodel-proto.js ./third_party/source/xmodel/src/vai_runtime/xir/src/xir/proto/graph_proto_v2.proto
  17. rm -rf ${temp}
  18. if [[ -n ${crlf} ]]; then
  19. unix2dos --quiet --newfile ./source/xmodel-proto.js ./source/xmodel-proto.js
  20. fi
  21. }
  22. while [ "$#" != 0 ]; do
  23. command="$1" && shift
  24. case "${command}" in
  25. "clean") clean;;
  26. "sync") sync;;
  27. "schema") schema;;
  28. esac
  29. done