Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EzPC-Custom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rasoul Akhavan Mahdavi
EzPC-Custom
Commits
2aa79b12
Commit
2aa79b12
authored
4 years ago
by
Bhatu
Browse files
Options
Downloads
Patches
Plain Diff
Minor improvements to compiler scripts, handle const to var better for some ops
parent
4346e966
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Athos/CompilerScripts/compile_tf.py
+4
-2
4 additions, 2 deletions
Athos/CompilerScripts/compile_tf.py
Athos/CompilerScripts/grappler.py
+13
-0
13 additions, 0 deletions
Athos/CompilerScripts/grappler.py
Athos/CompilerScripts/parse_config.py
+1
-1
1 addition, 1 deletion
Athos/CompilerScripts/parse_config.py
with
18 additions
and
3 deletions
Athos/CompilerScripts/compile_tf.py
+
4
−
2
View file @
2aa79b12
...
...
@@ -120,11 +120,12 @@ def compile(model_fname, input_t_info, output_t_names, scaling_factor, save_weig
)
tf_graph_io
.
dump_graph_def_pb
(
optimized_graph_def
,
"
optimised_
"
+
model_
f
name
optimized_graph_def
,
"
optimised_
"
+
model_name
+
"
.pb
"
)
DumpTFMtData
.
save_graphdef
(
optimized_graph_def
)
DumpTFMtData
.
save_sizeinfo
(
optimized_graph_def
,
sess
,
feed_dict
)
print
(
"
Model compilation done.
"
)
weights_path
=
""
if
save_weights
:
weights_fname
=
(
model_name
...
...
@@ -140,8 +141,9 @@ def compile(model_fname, input_t_info, output_t_names, scaling_factor, save_weig
DumpTFMtData
.
save_weights
(
optimized_graph_def
,
sess
,
feed_dict
,
weights_fname
,
scaling_factor
)
weights_path
=
os
.
path
.
join
(
model_dir
,
weights_fname
)
os
.
chdir
(
cwd
)
return
return
weights_path
def
parse_args
():
...
...
This diff is collapsed.
Click to expand it.
Athos/CompilerScripts/grappler.py
+
13
−
0
View file @
2aa79b12
...
...
@@ -61,6 +61,9 @@ def get_white_list(graph):
mean_axes_ops
=
set
(
i
.
inputs
[
1
].
op
.
name
for
i
in
graph
.
get_operations
()
if
i
.
type
==
"
Mean
"
)
sum_axes_ops
=
set
(
i
.
inputs
[
1
].
op
.
name
for
i
in
graph
.
get_operations
()
if
i
.
type
==
"
Sum
"
)
split_dim_ops
=
set
(
i
.
inputs
[
0
].
op
.
name
for
i
in
graph
.
get_operations
()
if
i
.
type
==
"
Split
"
)
...
...
@@ -69,14 +72,24 @@ def get_white_list(graph):
for
i
in
graph
.
get_operations
()
if
i
.
type
==
"
ConcatV2
"
or
i
.
type
==
"
Concat
"
)
argmax_axes_ops
=
set
(
i
.
inputs
[
1
].
op
.
name
for
i
in
graph
.
get_operations
()
if
i
.
type
==
"
ArgMax
"
)
divisor_ops
=
set
(
i
.
inputs
[
1
].
op
.
name
for
i
in
graph
.
get_operations
()
if
i
.
type
in
[
"
FloorDiv
"
,
"
RealDiv
"
]
)
white_list
=
(
transp_perm_ops
|
padding_ops
|
slice_begin_ops
|
slice_size_ops
|
mean_axes_ops
|
sum_axes_ops
|
split_dim_ops
|
concat_axes_ops
|
argmax_axes_ops
|
divisor_ops
)
return
list
(
white_list
)
...
...
This diff is collapsed.
Click to expand it.
Athos/CompilerScripts/parse_config.py
+
1
−
1
View file @
2aa79b12
...
...
@@ -115,7 +115,7 @@ def get_shape_list(shape_string):
if
shape_string
==
""
:
return
shape
for
i
in
shape_string
.
split
(
"
,
"
):
assert
i
.
isnumeric
(),
"
Given input shape has non-integer value
s
"
assert
i
.
isnumeric
(),
"
Given input shape has non-integer value
: {}
"
.
format
(
i
)
shape
.
append
(
int
(
i
))
return
shape
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment