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
e722dbcb
Commit
e722dbcb
authored
Mar 30, 2018
by
Wenhao Hu
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Onnx opset support (#416)
parent
f4789db6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
nnvm/python/nnvm/frontend/onnx.py
+0
-0
nnvm/tests/ci_build/install/ubuntu_install_onnx.sh
+2
-2
nnvm/tests/python/frontend/onnx/test_forward.py
+2
-2
nnvm/tests/python/frontend/onnx/test_graph.py
+2
-2
nnvm/tutorials/from_onnx.py
+2
-2
No files found.
nnvm/python/nnvm/frontend/onnx.py
View file @
e722dbcb
This diff is collapsed.
Click to expand it.
nnvm/tests/ci_build/install/ubuntu_install_onnx.sh
View file @
e722dbcb
pip2 install onnx>
=
0.2
.0
pip2 install onnx>
=
1.1
.0
pip3 install onnx>
=
0.2
.0
pip3 install onnx>
=
1.1
.0
pip2 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
pip2 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
pip2 install torchvision
pip2 install torchvision
...
...
nnvm/tests/python/frontend/onnx/test_forward.py
View file @
e722dbcb
...
@@ -14,8 +14,8 @@ def verify_onnx_forward_impl(graph_file, data_shape, out_shape):
...
@@ -14,8 +14,8 @@ def verify_onnx_forward_impl(graph_file, data_shape, out_shape):
c2_out
=
prepared_backend
.
run
(
W
)[
0
]
c2_out
=
prepared_backend
.
run
(
W
)[
0
]
return
c2_out
return
c2_out
def
get_tvm_output
(
graph
,
x
,
target
,
ctx
,
dtype
=
'float32'
):
def
get_tvm_output
(
model
,
x
,
target
,
ctx
,
dtype
=
'float32'
):
new_sym
,
params
=
nnvm
.
frontend
.
from_onnx
(
graph
)
new_sym
,
params
=
nnvm
.
frontend
.
from_onnx
(
model
)
shape_dict
=
{
'input_0'
:
x
.
shape
}
shape_dict
=
{
'input_0'
:
x
.
shape
}
graph
,
lib
,
params
=
nnvm
.
compiler
.
build
(
new_sym
,
target
,
shape_dict
,
params
=
params
)
graph
,
lib
,
params
=
nnvm
.
compiler
.
build
(
new_sym
,
target
,
shape_dict
,
params
=
params
)
m
=
graph_runtime
.
create
(
graph
,
lib
,
ctx
)
m
=
graph_runtime
.
create
(
graph
,
lib
,
ctx
)
...
...
nnvm/tests/python/frontend/onnx/test_graph.py
View file @
e722dbcb
...
@@ -5,8 +5,8 @@ from nnvm.compiler import graph_util, graph_attr
...
@@ -5,8 +5,8 @@ from nnvm.compiler import graph_util, graph_attr
from
model_zoo
import
super_resolution
,
super_resolution_sym
from
model_zoo
import
super_resolution
,
super_resolution_sym
def
compare_graph
(
onnx_file
,
nnvm_sym
,
ishape
):
def
compare_graph
(
onnx_file
,
nnvm_sym
,
ishape
):
onnx_
graph
=
onnx
.
load
(
onnx_file
)
onnx_
model
=
onnx
.
load
(
onnx_file
)
onnx_sym
,
params
=
nnvm
.
frontend
.
from_onnx
(
onnx_
graph
)
onnx_sym
,
params
=
nnvm
.
frontend
.
from_onnx
(
onnx_
model
)
g1
=
nnvm
.
graph
.
create
(
onnx_sym
)
g1
=
nnvm
.
graph
.
create
(
onnx_sym
)
g2
=
nnvm
.
graph
.
create
(
nnvm_sym
)
g2
=
nnvm
.
graph
.
create
(
nnvm_sym
)
ishapes
=
{
'input_0'
:
ishape
}
ishapes
=
{
'input_0'
:
ishape
}
...
...
nnvm/tutorials/from_onnx.py
View file @
e722dbcb
...
@@ -44,9 +44,9 @@ model_url = ''.join(['https://gist.github.com/zhreshold/',
...
@@ -44,9 +44,9 @@ model_url = ''.join(['https://gist.github.com/zhreshold/',
'super_resolution_0.2.onnx'
])
'super_resolution_0.2.onnx'
])
download
(
model_url
,
'super_resolution.onnx'
,
True
)
download
(
model_url
,
'super_resolution.onnx'
,
True
)
# now you have super_resolution.onnx on disk
# now you have super_resolution.onnx on disk
onnx_
graph
=
onnx
.
load
(
'super_resolution.onnx'
)
onnx_
model
=
onnx
.
load
(
'super_resolution.onnx'
)
# we can load the graph as NNVM compatible model
# we can load the graph as NNVM compatible model
sym
,
params
=
nnvm
.
frontend
.
from_onnx
(
onnx_
graph
)
sym
,
params
=
nnvm
.
frontend
.
from_onnx
(
onnx_
model
)
######################################################################
######################################################################
# Load a test image
# Load a test image
...
...
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