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
a94f69fa
Unverified
Commit
a94f69fa
authored
Mar 20, 2020
by
Andrew Liu
Committed by
GitHub
Mar 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay][TF] Support for Atan/Atan2 in Relay Tensorflow frontend converter. (#5104)
* add Atan/Atan2 op * fix bug and testing
parent
2b661231
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
python/tvm/relay/frontend/tensorflow.py
+7
-0
tests/python/frontend/tensorflow/test_forward.py
+22
-0
No files found.
python/tvm/relay/frontend/tensorflow.py
View file @
a94f69fa
...
...
@@ -1535,6 +1535,11 @@ def _batch_to_space_nd():
return
_impl
def
_atan2
():
def
_impl
(
inputs
,
attr
,
params
):
divide
=
_elemwise
(
"divide"
)(
inputs
,
attr
,
params
)
return
get_relay_op
(
"atan"
)(
divide
)
return
_impl
def
_prod
():
def
_impl
(
inputs
,
attr
,
params
):
...
...
@@ -1615,6 +1620,8 @@ _convert_map = {
'ArgMax'
:
_argx
(
_op
.
argmax
,
'argmax'
),
'ArgMin'
:
_argx
(
_op
.
argmin
,
'argmin'
),
'Assert'
:
_assert
(),
'Atan'
:
AttrCvt
(
'atan'
),
'Atan2'
:
_atan2
(),
'AvgPool'
:
_pooling
(
'avg_pool'
),
'AvgPool3D'
:
_pool3d
(
'avg_pool3d'
),
'BatchMatMul'
:
_batch_matmul
(),
...
...
tests/python/frontend/tensorflow/test_forward.py
View file @
a94f69fa
...
...
@@ -2669,6 +2669,26 @@ def test_forward_tan():
tf
.
tan
(
in_data
,
name
=
"tan"
)
compare_tf_with_tvm
([
np_data
],
[
'in_data:0'
],
'tan:0'
)
def
test_forward_atan
():
"""test operator tan """
tf
.
disable_eager_execution
()
np_data
=
np
.
random
.
uniform
(
1
,
100
,
size
=
(
2
,
3
,
5
))
.
astype
(
np
.
float32
)
tf
.
reset_default_graph
()
in_data
=
tf
.
placeholder
(
tf
.
float32
,
(
2
,
3
,
5
),
name
=
"in_data"
)
tf
.
atan
(
in_data
,
name
=
"atan"
)
compare_tf_with_tvm
([
np_data
],
[
'in_data:0'
],
'atan:0'
)
def
test_forward_atan2
():
"""test operator tan """
tf
.
disable_eager_execution
()
np_data_1
=
np
.
random
.
uniform
(
1
,
100
,
size
=
(
2
,
3
,
5
))
.
astype
(
np
.
float32
)
np_data_2
=
np
.
random
.
uniform
(
1
,
100
,
size
=
(
2
,
3
,
5
))
.
astype
(
np
.
float32
)
tf
.
reset_default_graph
()
in_data_1
=
tf
.
placeholder
(
tf
.
float32
,
(
2
,
3
,
5
),
name
=
"in_data_1"
)
in_data_2
=
tf
.
placeholder
(
tf
.
float32
,
(
2
,
3
,
5
),
name
=
"in_data_2"
)
tf
.
atan2
(
in_data_1
,
in_data_2
,
name
=
"atan2"
)
compare_tf_with_tvm
([
np_data_1
,
np_data_2
],
[
'in_data_1:0'
,
'in_data_2:0'
],
'atan2:0'
)
def
test_forward_sin
():
"""test operator sin """
...
...
@@ -3116,6 +3136,8 @@ if __name__ == '__main__':
test_forward_left_shift
()
test_forward_truncatemod
()
test_forward_one_hot
()
test_forward_atan
()
test_forward_atan2
()
# Activations
test_forward_sigmoid
()
...
...
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