forked from lutzroeder/netron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
caffe
executable file
·37 lines (31 loc) · 1.1 KB
/
caffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
clean() {
echo "caffe clean"
rm -rf "./third_party/source/caffe"
}
sync() {
echo "caffe sync"
mkdir -p "./third_party/source/caffe/src/caffe/proto"
curl --silent --location --output "./third_party/source/caffe/src/caffe/proto/caffe.proto" "https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto?raw=true"
}
schema() {
echo "caffe schema"
[[ $(grep -U $'\x0D' ./source/caffe-proto.js) ]] && crlf=1
temp=$(mktemp -d)
sed 's/required float min = 1;/optional float min = 1;/g;s/required float max = 2;/optional float max = 2;/g' < ./third_party/source/caffe/src/caffe/proto/caffe.proto > ${temp}/caffe.proto
node ./tools/protoc.js --text --root caffe --out ./source/caffe-proto.js ${temp}/caffe.proto
rm -rf ${temp}
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/caffe-proto.js ./source/caffe-proto.js
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"schema") schema;;
esac
done