ó ùµÈ[c@s,dZddlmZd„Zd„ZdS(sFFunctions for importing ONNX models to MXNet and for checking metadatai(t GraphProtocCsttƒ}yddl}Wn!tk r<tddƒ‚nX|j|ƒ}|j|jƒ\}}}|||fS(s£Imports the ONNX model file, passed as a parameter, into MXNet symbol and parameters. Operator support and coverage - https://cwiki.apache.org/confluence/display/MXNET/MXNet-ONNX+Integration Parameters ---------- model_file : str ONNX model file name Returns ------- sym : :class:`~mxnet.symbol.Symbol` MXNet symbol object arg_params : dict of ``str`` to :class:`~mxnet.ndarray.NDArray` Dict of converted parameters stored in ``mxnet.ndarray.NDArray`` format aux_params : dict of ``str`` to :class:`~mxnet.ndarray.NDArray` Dict of converted parameters stored in ``mxnet.ndarray.NDArray`` format i˙˙˙˙Ns(Onnx and protobuf need to be installed. s6Instructions to install - https://github.com/onnx/onnx(Rtonnxt ImportErrort load_modelt from_onnxtgraph(t model_fileRRt model_prototsymt arg_paramst aux_params((sg/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/contrib/onnx/onnx2mx/import_model.pyt import_models  cCsbtƒ}yddl}Wn!tk r<tddƒ‚nX|j|ƒ}|j|jƒ}|S(sy 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. The dictionary will have the following template. { 'input_tensor_data' : , 'output_tensor_data' : } i˙˙˙˙Ns(Onnx and protobuf need to be installed. s6Instructions to install - https://github.com/onnx/onnx(RRRRtget_graph_metadataR(RRRRtmetadata((sg/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/contrib/onnx/onnx2mx/import_model.pytget_model_metadata9s  N(t__doc__t import_onnxRR R(((sg/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/contrib/onnx/onnx2mx/import_model.pyts !