Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
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
Model registry
Operate
Environments
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
llvm
hpvm-release
Commits
0a3b3254
Commit
0a3b3254
authored
5 years ago
by
Hashim Sharif
Browse files
Options
Downloads
Patches
Plain Diff
Handling DepthwiseConv2D for Promise API translation
parent
292db054
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/projects/keras/frontend/promise_translator.py
+22
-6
22 additions, 6 deletions
llvm/projects/keras/frontend/promise_translator.py
llvm/projects/keras/frontend/utils.py
+22
-0
22 additions, 0 deletions
llvm/projects/keras/frontend/utils.py
with
44 additions
and
6 deletions
llvm/projects/keras/frontend/promise_translator.py
+
22
−
6
View file @
0a3b3254
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
numpy
as
np
import
numpy
as
np
import
sys
import
sys
from
keras
import
backend
as
K
from
keras
import
backend
as
K
from
frontend.utils
import
*
class
State
:
class
State
:
...
@@ -599,13 +599,29 @@ class PromiseRtTranslator:
...
@@ -599,13 +599,29 @@ class PromiseRtTranslator:
# FIX: ADD code for TensorAdd and ACTIVATION
# FIX: ADD code for TensorAdd and ACTIVATION
# TODO: ADD code for TensorAdd and ACTIVATION
# TODO: ADD code for TensorAdd and ACTIVATION
print
(
promise_layer_str
)
input_var
=
output_var
if
nodeHasBias
(
conv_op
):
output_var2
=
self
.
getVariableName
(
conv_op
)
promise_layer_str
+=
"
void*
"
+
output_var2
+
"
=
"
promise_layer_str
+=
"
tensorAdd(
"
+
input_var
+
"
,
"
promise_layer_str
+=
conv_op
.
layer_name
+
"
_b
"
promise_layer_str
+=
"
);
\n
"
# Update variable that holds input for next operation
input_var
=
output_var2
if
nodeHasActivation
(
conv_op
):
activation_type
=
conv_op
.
activation_type
output_var
=
self
.
getVariableName
(
conv_op
)
promise_layer_str
+=
genActivationCallStr
(
input_var
,
output_var
,
activation_type
)
print
(
promise_layer_str
)
self
.
program_str
+=
promise_layer_str
self
.
program_str
+=
promise_layer_str
self
.
appendLayerString
(
"
DepthwiseConv
"
,
state
)
self
.
appendLayerString
(
"
DepthwiseConv
"
,
state
)
state
.
clear
()
state
.
clear
()
...
...
This diff is collapsed.
Click to expand it.
llvm/projects/keras/frontend/utils.py
+
22
−
0
View file @
0a3b3254
...
@@ -17,3 +17,25 @@ def nodeHasActivation(cur_node):
...
@@ -17,3 +17,25 @@ def nodeHasActivation(cur_node):
return
True
return
True
else
:
else
:
return
False
return
False
def
genActivationCallStr
(
input_var
,
output_var
,
activation_type
):
func_name
=
""
if
activation_type
==
"
tanh
"
:
func_name
=
"
Tanh
"
if
activation_type
==
"
relu
"
:
func_name
=
"
Relu
"
if
activation_type
==
"
softmax
"
:
func_name
=
"
Softmax
"
inst_str
=
"
void*
"
+
output_var
+
"
=
"
inst_str
+=
"
tensor
"
+
func_name
+
"
(
"
+
input_var
+
"
);
\n
"
print
(
"
***** inst_str =
"
,
inst_str
,
"
\n
"
)
return
inst_str
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