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
fc28f7ab
Commit
fc28f7ab
authored
Nov 10, 2019
by
Wei Chen
Committed by
Zhi
Nov 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Test][TF][Relay] Fix argument preparation for vm test mode (#4296)
parent
801cf0e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
tests/python/frontend/tensorflow/test_forward.py
+12
-3
No files found.
tests/python/frontend/tensorflow/test_forward.py
View file @
fc28f7ab
...
...
@@ -112,6 +112,14 @@ def run_tvm_graph(graph_def, input_data, input_node, num_output=1,
ex
=
relay
.
create_executor
(
mode
,
mod
=
mod
,
ctx
=
tvm
.
cpu
(),
target
=
"llvm"
)
inputs
=
[]
for
param
in
mod
[
'main'
]
.
params
:
found
=
False
for
i
,
n
in
enumerate
(
input_node
):
if
n
==
param
.
name_hint
:
found
=
True
inputs
.
append
(
tvm
.
nd
.
array
(
input_data
[
i
]))
break
# Interpreter doesn't bind constants, so still need to find in params
if
not
found
:
inputs
.
append
(
tvm
.
nd
.
array
(
params
[
param
.
name_hint
]))
result
=
ex
.
evaluate
()(
*
inputs
)
return
vmobj_to_list
(
result
)
...
...
@@ -2099,19 +2107,20 @@ def test_forward_floor():
def
test_forward_relu
():
ishape
=
(
1
,
3
,
10
,
10
)
inp_array
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
ishape
)
.
astype
(
np
.
float32
)
for
mode
in
[
'graph_runtime'
,
'vm'
]:
with
tf
.
Graph
()
.
as_default
():
in1
=
tf
.
placeholder
(
shape
=
inp_array
.
shape
,
dtype
=
inp_array
.
dtype
)
tf
.
nn
.
relu
(
in1
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'Relu:0'
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'Relu:0'
,
mode
=
mode
)
def
test_forward_leaky_relu
():
ishape
=
(
1
,
3
,
10
,
10
)
inp_array
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
ishape
)
.
astype
(
np
.
float32
)
for
mode
in
[
'graph_runtime'
,
'vm'
]:
with
tf
.
Graph
()
.
as_default
():
in1
=
tf
.
placeholder
(
shape
=
inp_array
.
shape
,
dtype
=
inp_array
.
dtype
)
tf
.
nn
.
leaky_relu
(
in1
,
alpha
=
0.4
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'LeakyRelu:0'
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'LeakyRelu:0'
,
mode
=
mode
)
def
test_forward_elu
():
...
...
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