Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Use modern onnx API to load model from file #12777

Merged
merged 1 commit into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/tutorials/onnx/export_mxnet_to_onnx.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions python/mxnet/contrib/onnx/onnx2mx/import_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion python/mxnet/contrib/onnx/onnx2mx/import_to_gluon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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