FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CaffeOnACL/scripts/split_caffe_proto.py at master · rootkit/CaffeOnACL · GitHub
rootkit
CaffeOnACL
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CaffeOnACL
/
scripts
/
split_caffe_proto.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (29 loc) · 941 Bytes
Breadcrumbs
CaffeOnACL
/
scripts
/
split_caffe_proto.py
Copy path
File metadata and controls
35 lines (29 loc) · 941 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/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
))
Back
|
FazBrowse Home
|
New Git URL