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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
tests/python/frontend/tensorflow/test_forward.py
+19
-10
No files found.
tests/python/frontend/tensorflow/test_forward.py
View file @
fc28f7ab
...
@@ -112,7 +112,15 @@ def run_tvm_graph(graph_def, input_data, input_node, num_output=1,
...
@@ -112,7 +112,15 @@ 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"
)
ex
=
relay
.
create_executor
(
mode
,
mod
=
mod
,
ctx
=
tvm
.
cpu
(),
target
=
"llvm"
)
inputs
=
[]
inputs
=
[]
for
param
in
mod
[
'main'
]
.
params
:
for
param
in
mod
[
'main'
]
.
params
:
inputs
.
append
(
tvm
.
nd
.
array
(
params
[
param
.
name_hint
]))
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
)
result
=
ex
.
evaluate
()(
*
inputs
)
return
vmobj_to_list
(
result
)
return
vmobj_to_list
(
result
)
else
:
else
:
...
@@ -2099,19 +2107,20 @@ def test_forward_floor():
...
@@ -2099,19 +2107,20 @@ def test_forward_floor():
def
test_forward_relu
():
def
test_forward_relu
():
ishape
=
(
1
,
3
,
10
,
10
)
ishape
=
(
1
,
3
,
10
,
10
)
inp_array
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
ishape
)
.
astype
(
np
.
float32
)
inp_array
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
ishape
)
.
astype
(
np
.
float32
)
with
tf
.
Graph
()
.
as_default
()
:
for
mode
in
[
'graph_runtime'
,
'vm'
]
:
in1
=
tf
.
placeholder
(
shape
=
inp_array
.
shape
,
dtype
=
inp_array
.
dtype
)
with
tf
.
Graph
()
.
as_default
():
tf
.
nn
.
relu
(
in1
)
in1
=
tf
.
placeholder
(
shape
=
inp_array
.
shape
,
dtype
=
inp_array
.
dtype
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'Relu:0'
)
tf
.
nn
.
relu
(
in1
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'Relu:0'
,
mode
=
mode
)
def
test_forward_leaky_relu
():
def
test_forward_leaky_relu
():
ishape
=
(
1
,
3
,
10
,
10
)
ishape
=
(
1
,
3
,
10
,
10
)
inp_array
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
ishape
)
.
astype
(
np
.
float32
)
inp_array
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
ishape
)
.
astype
(
np
.
float32
)
with
tf
.
Graph
()
.
as_default
():
for
mode
in
[
'graph_runtime'
,
'vm'
]:
in1
=
tf
.
placeholder
(
shape
=
inp_array
.
shape
,
dtype
=
inp_array
.
dtype
)
with
tf
.
Graph
()
.
as_default
():
tf
.
nn
.
leaky_relu
(
in1
,
alpha
=
0.4
)
in1
=
tf
.
placeholder
(
shape
=
inp_array
.
shape
,
dtype
=
inp_array
.
dtype
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'LeakyRelu:0'
)
tf
.
nn
.
leaky_relu
(
in1
,
alpha
=
0.4
)
compare_tf_with_tvm
(
inp_array
,
'Placeholder:0'
,
'LeakyRelu:0'
,
mode
=
mode
)
def
test_forward_elu
():
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