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
3a9de905
Commit
3a9de905
authored
May 20, 2019
by
Joshua Z. Zhang
Committed by
Tianqi Chen
May 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay][ONNX] fix #3134 converter where initializers were not registered as nodes (#3143)
parent
d4fb0a2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
+16
-1
python/tvm/relay/frontend/onnx.py
+16
-1
No files found.
python/tvm/relay/frontend/onnx.py
View file @
3a9de905
...
...
@@ -934,7 +934,7 @@ class GraphProto(object):
self
.
_renames
=
{}
self
.
_num_input
=
0
self
.
_num_param
=
0
self
.
_shape
=
shape
self
.
_shape
=
shape
if
shape
else
{}
self
.
_dtype
=
dtype
def
from_onnx
(
self
,
graph
,
opset
):
...
...
@@ -966,6 +966,9 @@ class GraphProto(object):
if
not
init_tensor
.
name
.
strip
():
raise
ValueError
(
"Tensor's name is required."
)
self
.
_params
[
init_tensor
.
name
]
=
self
.
_parse_array
(
init_tensor
)
self
.
_nodes
[
init_tensor
.
name
]
=
new_var
(
init_tensor
.
name
,
shape
=
self
.
_params
[
init_tensor
.
name
]
.
shape
,
dtype
=
self
.
_params
[
init_tensor
.
name
]
.
dtype
)
for
i
in
graph
.
input
:
# from onnx v0.2, GraphProto.input has type ValueInfoProto,
# and the name is 'i.name'
...
...
@@ -1179,6 +1182,18 @@ def from_onnx(model,
params : dict of str to tvm.NDArray
The parameter dict to be used by relay
"""
try
:
import
onnx
if
hasattr
(
onnx
.
checker
,
'check_model'
):
# try use onnx's own model checker before converting any model
try
:
onnx
.
checker
.
check_model
(
model
)
except
onnx
.
onnx_cpp2py_export
.
checker
.
ValidationError
as
e
:
import
warnings
# the checker is a bit violent about errors, so simply print warnings here
warnings
.
warn
(
str
(
e
))
except
ImportError
:
pass
g
=
GraphProto
(
shape
,
dtype
)
graph
=
model
.
graph
try
:
...
...
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