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
73f87ae0
Commit
73f87ae0
authored
Apr 29, 2019
by
Gemfield
Committed by
Tianqi Chen
Apr 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
porting new upsample test case from nnvm to relay (#3115)
parent
f1fcbaf9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
tests/python/frontend/onnx/test_forward.py
+30
-0
No files found.
tests/python/frontend/onnx/test_forward.py
View file @
73f87ae0
...
@@ -427,9 +427,39 @@ def _test_upsample_bilinear():
...
@@ -427,9 +427,39 @@ def _test_upsample_bilinear():
tvm_out
=
get_tvm_output
(
model
,
in_array
,
target
,
ctx
,
out_shape
,
'float32'
)
tvm_out
=
get_tvm_output
(
model
,
in_array
,
target
,
ctx
,
out_shape
,
'float32'
)
tvm
.
testing
.
assert_allclose
(
out_array
,
tvm_out
,
rtol
=
1e-5
,
atol
=
1e-5
)
tvm
.
testing
.
assert_allclose
(
out_array
,
tvm_out
,
rtol
=
1e-5
,
atol
=
1e-5
)
def
_test_upsample_bilinear_opset9
():
scale
=
2
in_shape
=
(
1
,
1
,
3
,
3
)
out_shape
=
(
1
,
1
,
3
*
scale
,
3
*
scale
)
y
=
helper
.
make_node
(
"Upsample"
,
[
'in'
,
'scales'
],
[
'out'
],
mode
=
'linear'
)
scales
=
[
1.0
,
1.0
,
2.0
,
2.0
]
in_array
=
np
.
random
.
uniform
(
size
=
in_shape
)
.
astype
(
np
.
float32
)
out_array
=
topi
.
testing
.
bilinear_resize_python
(
in_array
,
(
3
*
scale
,
3
*
scale
),
"NCHW"
)
ref_array
=
np
.
array
(
scales
)
ref_node
=
helper
.
make_node
(
'Constant'
,
inputs
=
[],
outputs
=
[
'scales'
],
value
=
onnx
.
helper
.
make_tensor
(
name
=
'const_tensor'
,
data_type
=
TensorProto
.
FLOAT
,
dims
=
ref_array
.
shape
,
vals
=
ref_array
.
flatten
()
.
astype
(
float
)))
graph
=
helper
.
make_graph
([
ref_node
,
y
],
'upsample_bilinear_opset9_test'
,
inputs
=
[
helper
.
make_tensor_value_info
(
"in"
,
TensorProto
.
FLOAT
,
list
(
in_shape
))],
outputs
=
[
helper
.
make_tensor_value_info
(
"out"
,
TensorProto
.
FLOAT
,
list
(
out_shape
))])
model
=
helper
.
make_model
(
graph
,
producer_name
=
'upsample_bilinear_opset9_test'
)
for
target
,
ctx
in
ctx_list
():
tvm_out
=
get_tvm_output
(
model
,
in_array
,
target
,
ctx
,
out_shape
,
'float32'
)
tvm
.
testing
.
assert_allclose
(
out_array
,
tvm_out
,
rtol
=
1e-5
,
atol
=
1e-5
)
def
test_upsample
():
def
test_upsample
():
_test_upsample_nearest
()
_test_upsample_nearest
()
_test_upsample_bilinear
()
_test_upsample_bilinear
()
_test_upsample_bilinear_opset9
()
def
_test_softmax
(
inshape
,
axis
):
def
_test_softmax
(
inshape
,
axis
):
opname
=
'Softmax'
opname
=
'Softmax'
...
...
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