diff options
author | Jonathan R. Williford <jonathan@neural.vision> | 2017-01-01 18:22:09 +0000 |
---|---|---|
committer | Jonathan R. Williford <jonathan@neural.vision> | 2017-01-01 18:49:46 +0000 |
commit | bae06073864dbe86970429d53e35335304626a70 (patch) | |
tree | 3c7d5270e115ff12951b155e5b99eac90af97c99 /scripts | |
parent | f731bc4a8fc63666ae2b997e435ceb2f13752403 (diff) | |
download | caffe-bae06073864dbe86970429d53e35335304626a70.tar.gz caffe-bae06073864dbe86970429d53e35335304626a70.tar.bz2 caffe-bae06073864dbe86970429d53e35335304626a70.zip |
Overhaul layer catalogue documentation.
Create scripts/split_caffe_proto.py file for splitting up the
caffe.proto file, so that parts of the file can be included from the
layer help pages.
Create separate pages for each layer and link each page from layers.md.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_docs.sh | 3 | ||||
-rwxr-xr-x | scripts/split_caffe_proto.py | 35 |
2 files changed, 38 insertions, 0 deletions
diff --git a/scripts/build_docs.sh b/scripts/build_docs.sh index 0e28bd71..4837587a 100755 --- a/scripts/build_docs.sh +++ b/scripts/build_docs.sh @@ -12,6 +12,9 @@ cd $ROOT_DIR # Gather docs. scripts/gather_examples.sh +# Split caffe.proto for inclusion by layer catalogue. +scripts/split_caffe_proto.py + # Generate developer docs. make docs diff --git a/scripts/split_caffe_proto.py b/scripts/split_caffe_proto.py new file mode 100755 index 00000000..7e9dc3e7 --- /dev/null +++ b/scripts/split_caffe_proto.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +import mmap +import re +import os +import errno + +script_path = os.path.dirname(os.path.realpath(__file__)) + +# a regex to match the parameter definitions in caffe.proto +r = re.compile(r'(?://.*\n)*message ([^ ]*) \{\n(?: .*\n|\n)*\}') + +# create directory to put caffe.proto fragments +try: + os.mkdir( + os.path.join(script_path, + '../docs/_includes/')) + os.mkdir( + os.path.join(script_path, + '../docs/_includes/proto/')) +except OSError as exception: + if exception.errno != errno.EEXIST: + raise + +caffe_proto_fn = os.path.join( + script_path, + '../src/caffe/proto/caffe.proto') + +with open(caffe_proto_fn, 'r') as fin: + + for m in r.finditer(fin.read(), re.MULTILINE): + fn = os.path.join( + script_path, + '../docs/_includes/proto/%s.txt' % m.group(1)) + with open(fn, 'w') as fout: + fout.write(m.group(0)) |