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
c4439a80
Commit
c4439a80
authored
May 16, 2019
by
Siva
Committed by
Tianqi Chen
May 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TENSORLFOW] PlaceholderWithDefault (limited) implementation. (#3184)
parent
76ae2dc6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
python/tvm/relay/frontend/tensorflow.py
+3
-3
tests/python/frontend/tensorflow/test_forward.py
+19
-0
No files found.
python/tvm/relay/frontend/tensorflow.py
View file @
c4439a80
...
...
@@ -1740,7 +1740,7 @@ class GraphProto(object):
for
node
in
graph
.
node
:
node_name_prefix
=
node
.
name
.
rsplit
(
'/'
,
1
)[
0
]
control_flow_node_map
[
node_name_prefix
]
.
add
(
node
.
op
)
if
node
.
op
==
'Placeholder'
:
if
node
.
op
==
'Placeholder'
or
node
.
op
==
'PlaceholderWithDefault'
:
# Give priority to user argument.
if
shape
and
node
.
name
in
shape
:
self
.
_input_shapes
[
node
.
name
]
=
list
(
shape
[
node
.
name
])
...
...
@@ -1800,7 +1800,7 @@ class GraphProto(object):
attr
=
self
.
_parse_attr
(
node
.
attr
)
elif
node
.
op
!=
"Placeholder"
:
elif
node
.
op
!=
"Placeholder"
and
node
.
op
!=
'PlaceholderWithDefault'
:
# Pass the parsed shapes instead
attr
[
"_output_shapes"
]
=
output_shapes
=
self
.
_output_shapes
[
node
.
name
]
...
...
@@ -1925,7 +1925,7 @@ class GraphProto(object):
"""
missing_operators
=
set
()
for
node
in
graph
.
node
:
if
node
.
op
==
"Placeholder"
:
if
node
.
op
==
"Placeholder"
or
node
.
op
==
'PlaceholderWithDefault'
:
pass
elif
node
.
op
==
"Const"
:
pass
...
...
tests/python/frontend/tensorflow/test_forward.py
View file @
c4439a80
...
...
@@ -1541,6 +1541,24 @@ def test_forward_reduce_prod():
_test_forward_reduce_prod
((
5
,
5
),
0
,
True
)
_test_forward_reduce_prod
((
5
,
5
),
1
,
True
)
#######################################################################
# PlaceholderWithDefault
# ----------------------
def
test_placeholder
():
with
tf
.
Graph
()
.
as_default
():
in_data1
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
(
3
,
4
,
5
))
.
astype
(
np
.
float32
)
var1
=
tf
.
Variable
(
in_data1
,
name
=
'in1'
)
var2
=
array_ops
.
placeholder_with_default
(
var1
,
None
,
name
=
'place1'
)
in_data2
=
np
.
random
.
uniform
(
-
5
,
5
,
size
=
(
3
,
4
,
5
))
.
astype
(
np
.
float32
)
place1
=
array_ops
.
placeholder
(
shape
=
in_data1
.
shape
,
dtype
=
in_data1
.
dtype
,
name
=
'in2'
)
out1
=
tf
.
math
.
add
(
var1
,
var2
,
name
=
'out1'
)
out2
=
tf
.
math
.
add
(
out1
,
place1
,
name
=
'out2'
)
compare_tf_with_tvm
([
in_data1
,
in_data2
],
[
'place1:0'
,
'in2:0'
],
'out2:0'
,
init_global_variables
=
True
)
#######################################################################
# Main
# ----
...
...
@@ -1590,6 +1608,7 @@ if __name__ == '__main__':
test_forward_multi_input
()
test_forward_multi_output
()
test_forward_variable
()
test_placeholder
()
# NN
test_forward_convolution
()
...
...
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