Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
4503f77b
Commit
4503f77b
authored
Jul 04, 2018
by
Siva
Committed by
Tianqi Chen
Jul 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NNVM][TENSORFLOW] Sigmoid op support #1367 (#1369)
parent
28acb184
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
nnvm/python/nnvm/frontend/tensorflow.py
+1
-0
nnvm/tests/python/frontend/tensorflow/test_forward.py
+38
-0
No files found.
nnvm/python/nnvm/frontend/tensorflow.py
View file @
4503f77b
...
...
@@ -513,6 +513,7 @@ _convert_map = {
'Relu6'
:
_relu6
(),
'DepthwiseConv2dNative'
:
_depthwise_conv
(),
'Shape'
:
_shape
(),
'Sigmoid'
:
AttrCvt
(
'sigmoid'
),
}
...
...
nnvm/tests/python/frontend/tensorflow/test_forward.py
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
...
...
@@ -330,6 +331,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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment