Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
4503f77b
Commit
4503f77b
authored
6 years ago
by
Siva
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[NNVM][TENSORFLOW] Sigmoid op support #1367 (#1369)
parent
28acb184
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nnvm/python/nnvm/frontend/tensorflow.py
+1
-0
1 addition, 0 deletions
nnvm/python/nnvm/frontend/tensorflow.py
nnvm/tests/python/frontend/tensorflow/test_forward.py
+38
-0
38 additions, 0 deletions
nnvm/tests/python/frontend/tensorflow/test_forward.py
with
39 additions
and
0 deletions
nnvm/python/nnvm/frontend/tensorflow.py
+
1
−
0
View file @
4503f77b
...
...
@@ -513,6 +513,7 @@ _convert_map = {
'
Relu6
'
:
_relu6
(),
'
DepthwiseConv2dNative
'
:
_depthwise_conv
(),
'
Shape
'
:
_shape
(),
'
Sigmoid
'
:
AttrCvt
(
'
sigmoid
'
),
}
...
...
This diff is collapsed.
Click to expand it.
nnvm/tests/python/frontend/tensorflow/test_forward.py
+
38
−
0
View file @
4503f77b
...
...
@@ -13,6 +13,7 @@ from tensorflow.python.framework import constant_op
from
tensorflow.python.ops
import
nn_ops
from
tensorflow.python.ops
import
array_ops
from
tensorflow.python.ops
import
gen_array_ops
from
tensorflow.python.ops
import
math_ops
from
tensorflow.core.framework
import
graph_pb2
import
nnvm.testing.tf
...
...
@@ -329,6 +330,42 @@ def _test_forward_concat_v2():
_test_concat_v2
([
t1
,
t2
],
1
)
#######################################################################
# Sigmoid
# -------
def
_test_sigmoid
(
data
):
"""
One iteration of sigmoid
"""
with
tf
.
Graph
().
as_default
():
in_data
=
constant_op
.
constant
(
data
,
shape
=
data
.
shape
,
dtype
=
data
.
dtype
)
# pylint: disable=unused-variable
sigmoid_out
=
math_ops
.
sigmoid
(
in_data
)
# pylint: enable=unused-variable
with
tf
.
Session
()
as
sess
:
graph_def
=
tf
.
graph_util
.
convert_variables_to_constants
(
sess
,
sess
.
graph
.
as_graph_def
(
add_shapes
=
True
),
[
'
Sigmoid
'
],
)
tf_output
=
run_tf_graph
(
sess
,
data
,
'
Const:0
'
,
'
Sigmoid:0
'
)
tvm_output
=
run_tvm_graph
(
graph_def
,
data
,
"
Const
"
,
tf_output
.
shape
,
data
.
dtype
)
np
.
testing
.
assert_allclose
(
tf_output
,
tvm_output
,
atol
=
1e-5
,
rtol
=
1e-5
)
sess
.
close
()
def
test_forward_sigmoid
():
"""
Sigmoid
"""
_test_sigmoid
(
np
.
random
.
uniform
(
size
=
(
3
,
4
,
4
,
3
)).
astype
(
'
float32
'
))
#######################################################################
# Multi Input to graph
# --------------------
...
...
@@ -437,6 +474,7 @@ if __name__ == '__main__':
test_forward_pooling
()
test_forward_reshape
()
test_forward_squeeze
()
test_forward_sigmoid
()
if
tf
.
__version__
==
'
1.4.1
'
:
_test_forward_concat_v2
()
test_forward_multi_input
()
...
...
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