This is an automated email from the ASF dual-hosted git repository.
skm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new d02c9eb Use modern onnx API to load model from file (#12777)
d02c9eb is described below
commit d02c9eb825e3e9b678363392fca542e9c39f3dcb
Author: Alexander Pivovarov <[email protected]>
AuthorDate: Wed Oct 10 09:45:30 2018 -0700
Use modern onnx API to load model from file (#12777)
---
docs/tutorials/onnx/export_mxnet_to_onnx.md | 2 +-
python/mxnet/contrib/onnx/onnx2mx/import_model.py | 4 ++--
python/mxnet/contrib/onnx/onnx2mx/import_to_gluon.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/tutorials/onnx/export_mxnet_to_onnx.md
b/docs/tutorials/onnx/export_mxnet_to_onnx.md
index dc34bd5..b838bae 100644
--- a/docs/tutorials/onnx/export_mxnet_to_onnx.md
+++ b/docs/tutorials/onnx/export_mxnet_to_onnx.md
@@ -121,7 +121,7 @@ from onnx import checker
import onnx
# Load onnx model
-model_proto = onnx.load(converted_model_path)
+model_proto = onnx.load_model(converted_model_path)
# Check if converted ONNX protobuf is valid
checker.check_graph(model_proto.graph)
diff --git a/python/mxnet/contrib/onnx/onnx2mx/import_model.py
b/python/mxnet/contrib/onnx/onnx2mx/import_model.py
index b8d3bf2..bf3601a 100644
--- a/python/mxnet/contrib/onnx/onnx2mx/import_model.py
+++ b/python/mxnet/contrib/onnx/onnx2mx/import_model.py
@@ -50,7 +50,7 @@ def import_model(model_file):
raise ImportError("Onnx and protobuf need to be installed. "
+ "Instructions to install -
https://github.com/onnx/onnx")
# loads model file and returns ONNX protobuf object
- model_proto = onnx.load(model_file)
+ model_proto = onnx.load_model(model_file)
sym, arg_params, aux_params = graph.from_onnx(model_proto.graph)
return sym, arg_params, aux_params
@@ -81,6 +81,6 @@ def get_model_metadata(model_file):
except ImportError:
raise ImportError("Onnx and protobuf need to be installed. "
+ "Instructions to install -
https://github.com/onnx/onnx")
- model_proto = onnx.load(model_file)
+ model_proto = onnx.load_model(model_file)
metadata = graph.get_graph_metadata(model_proto.graph)
return metadata
diff --git a/python/mxnet/contrib/onnx/onnx2mx/import_to_gluon.py
b/python/mxnet/contrib/onnx/onnx2mx/import_to_gluon.py
index 5df41c3..8e1b354 100644
--- a/python/mxnet/contrib/onnx/onnx2mx/import_to_gluon.py
+++ b/python/mxnet/contrib/onnx/onnx2mx/import_to_gluon.py
@@ -43,6 +43,6 @@ def import_to_gluon(model_file, ctx):
except ImportError:
raise ImportError("Onnx and protobuf need to be installed.
Instructions to"
+ " install -
https://github.com/onnx/onnx#installation")
- model_proto = onnx.load(model_file)
+ model_proto = onnx.load_model(model_file)
net = graph.graph_to_gluon(model_proto.graph, ctx)
return net