You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/10/10 16:45:33 UTC

[GitHub] sandeep-krishnamurthy closed pull request #12777: Use modern onnx API to load model from file

sandeep-krishnamurthy closed pull request #12777: Use modern onnx API to load model from file
URL: https://github.com/apache/incubator-mxnet/pull/12777
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/tutorials/onnx/export_mxnet_to_onnx.md b/docs/tutorials/onnx/export_mxnet_to_onnx.md
index dc34bd520b4..b838bae9431 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 b8d3bf28ee2..bf3601a6953 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 5df41c3f327..8e1b35441f0 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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services