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
ba4d081c
Commit
ba4d081c
authored
Sep 24, 2019
by
Jon Soifer
Committed by
Jared Roesch
Sep 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay][Frontend][ONNX] Add Erf to ONNX frontend (#3988)
* Add Erf to ONNX frontend * dummy change to retrigger CI
parent
3f7cbed8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletions
+28
-1
python/tvm/relay/frontend/onnx.py
+9
-1
tests/python/frontend/onnx/test_forward.py
+19
-0
No files found.
python/tvm/relay/frontend/onnx.py
View file @
ba4d081c
...
...
@@ -896,6 +896,13 @@ class Tile(Elemwise):
reps
=
attr
.
pop
(
'repeats'
)
# The number of times repeating the tensor data.
return
_op
.
tile
(
inputs
[
0
],
reps
)
class
Erf
(
OnnxOpConverter
):
"""Operator converter for Erf
"""
@classmethod
def
_impl_v1
(
cls
,
inputs
,
attr
,
params
):
return
_op
.
erf
(
inputs
[
0
])
# compatible operators that do NOT require any conversion.
_identity_list
=
[]
...
...
@@ -1015,7 +1022,8 @@ def _get_convert_map(opset):
'Equal'
:
Equal
.
get_converter
(
opset
),
'Not'
:
Not
.
get_converter
(
opset
),
'And'
:
And
.
get_converter
(
opset
),
'Tile'
:
Tile
.
get_converter
(
opset
)
'Tile'
:
Tile
.
get_converter
(
opset
),
'Erf'
:
Erf
.
get_converter
(
opset
)
}
...
...
tests/python/frontend/onnx/test_forward.py
View file @
ba4d081c
...
...
@@ -28,6 +28,7 @@ from nnvm.testing.config import ctx_list
import
onnx
from
onnx
import
helper
,
TensorProto
import
unittest
import
scipy
def
get_tvm_output
(
graph_def
,
input_data
,
target
,
ctx
,
output_shape
=
None
,
output_dtype
=
'float32'
):
""" Generic function to execute and get tvm output"""
...
...
@@ -1225,6 +1226,23 @@ def test_tile():
z
=
np
.
tile
(
x
,
repeats
)
verify_tile
(
x
,
z
,
repeats
=
repeats
)
def
verify_erf
(
indata
,
outdata
):
node
=
helper
.
make_node
(
'Erf'
,
inputs
=
[
'in'
],
outputs
=
[
'out'
])
graph
=
helper
.
make_graph
([
node
],
'erf_test'
,
inputs
=
[
helper
.
make_tensor_value_info
(
'in'
,
TensorProto
.
FLOAT
,
list
(
indata
.
shape
))],
outputs
=
[
helper
.
make_tensor_value_info
(
'out'
,
TensorProto
.
FLOAT
,
list
(
outdata
.
shape
))])
model
=
helper
.
make_model
(
graph
,
producer_name
=
'erf_test'
)
for
target
,
ctx
in
ctx_list
():
tvm_out
=
get_tvm_output
(
model
,
[
indata
],
target
,
ctx
,
outdata
.
shape
)
tvm
.
testing
.
assert_allclose
(
outdata
,
tvm_out
)
def
test_erf
():
x
=
np
.
random
.
rand
(
2
,
3
,
4
,
6
)
.
astype
(
np
.
float32
)
z
=
scipy
.
special
.
erf
(
x
)
verify_erf
(
x
,
z
)
if
__name__
==
'__main__'
:
test_flatten
()
...
...
@@ -1272,3 +1290,4 @@ if __name__ == '__main__':
test_not
()
test_and
()
test_tile
()
test_erf
()
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