contrib.onnx¶
Module for ONNX model format support for Apache MXNet.
Functions
|
Exports the MXNet model file, passed as a parameter, into ONNX model. |
|
Returns the name and shape information of input and output tensors of the given ONNX model file. |
|
Imports the ONNX model file, passed as a parameter, into MXNet symbol and parameters. |
|
Imports the ONNX model files, passed as a parameter, into Gluon SymbolBlock object. |
-
mxnet.contrib.onnx.
export_model
(sym, params, input_shape, input_type=<class 'numpy.float32'>, onnx_file_path='model.onnx', verbose=False)[source]¶ Exports the MXNet model file, passed as a parameter, into ONNX model. Accepts both symbol,parameter objects as well as json and params filepaths as input. Operator support and coverage - https://cwiki.apache.org/confluence/display/MXNET/ONNX+Operator+Coverage
- Parameters
sym (str or symbol object) – Path to the json file or Symbol object
params (str or symbol object) – Path to the params file or params dictionary. (Including both arg_params and aux_params)
input_shape (List of tuple) – Input shape of the model e.g [(1,3,224,224)]
input_type (data type) – Input data type e.g. np.float32
onnx_file_path (str) – Path where to save the generated onnx file
verbose (Boolean) – If true will print logs of the model conversion
- Returns
onnx_file_path – Onnx file path
- Return type
str
Notes
This method is available when you
import mxnet.contrib.onnx
-
mxnet.contrib.onnx.
get_model_metadata
(model_file)[source]¶ Returns the name and shape information of input and output tensors of the given ONNX model file.
Notes
This method is available when you
import mxnet.contrib.onnx
- Parameters
model_file (str) – ONNX model file name
- Returns
model_metadata – A dictionary object mapping various metadata to its corresponding value. The dictionary will have the following template:
'input_tensor_data' : list of tuples representing the shape of the input paramters 'output_tensor_data' : list of tuples representing the shape of the output of the model
- Return type
dict
-
mxnet.contrib.onnx.
import_model
(model_file)[source]¶ 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/ONNX+Operator+Coverage
- Parameters
model_file (str) – ONNX model file name
- Returns
Notes
This method is available when you
import mxnet.contrib.onnx
-
mxnet.contrib.onnx.
import_to_gluon
(model_file, ctx)[source]¶ Imports the ONNX model files, passed as a parameter, into Gluon SymbolBlock object.
- Parameters
model_file (str) – ONNX model file name
ctx (Context or list of Context) – Loads the model into one or many context(s).
- Returns
sym_block – A SymbolBlock object representing the given model file.
- Return type
Notes
This method is available when you
import mxnet.contrib.onnx