Roshrini commented on a change in pull request #10605: [MXNET-310] [ONNX-MXNet] API to import ONNX models into Gluon. URL: https://github.com/apache/incubator-mxnet/pull/10605#discussion_r191898713
########## File path: python/mxnet/contrib/onnx/_import/import_model.py ########## @@ -53,6 +53,31 @@ def import_model(model_file): sym, arg_params, aux_params = graph.from_onnx(model_proto.graph) return sym, arg_params, aux_params +def get_model_metadata(model_file): + """ + Returns the name and shape information of input and output tensors of the given ONNX model file. + + Parameters + ---------- + model_file : str + ONNX model file name + + Returns + ------- + model_metadata : dict + A dictionary object mapping various metadata to its corresponding value. + """ + graph = GraphProto() + try: + import onnx + 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) + + metadata = graph.get_graph_metadata(model_proto.graph) + return metadata + def get_model_metadata(model_file): Review comment: this method is repeated? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services