nnvm.frontend

NNVM frontends.

nnvm.frontend.from_mxnet(symbol, arg_params=None, aux_params=None)

Convert from MXNet’s model into compatible NNVM format.

Parameters:
  • symbol (mxnet.Symbol or mxnet.gluon.HybridBlock) – MXNet symbol
  • arg_params (dict of str to mx.NDArray) – The argument parameters in mxnet
  • aux_params (dict of str to mx.NDArray) – The auxiliary parameters in mxnet
Returns:

  • sym (nnvm.Symbol) – Compatible nnvm symbol
  • params (dict of str to tvm.NDArray) – The parameter dict to be used by nnvm

nnvm.frontend.from_onnx(graph)

Load onnx graph which is a python protobuf object into nnvm graph. The companion parameters will be handled automatically. The inputs from onnx graph is vague, only providing “1”, “2”… For convenience, we rename the real input names to “input_0”, “input_1”… And renaming parameters to “param_0”, “param_1”…

Parameters:graph (protobuf object) – ONNX GraphProto, or ONNX ModelProto after ONNX v0.2
Returns:
  • sym (nnvm.Symbol) – Compatible nnvm symbol
  • params (dict of str to tvm.ndarray) – Dict of converted parameters stored in tvm.ndarray format
nnvm.frontend.from_coreml(model)

Convert from coreml model into NNVM format.

Parameters:model – coremltools.models.MLModel of a NeuralNetworkClassifier
Returns:
  • sym (nnvm.Symbol) – Compatible nnvm symbol
  • params (dict of str to tvm.NDArray) – The parameter dict to be used by nnvm
nnvm.frontend.from_keras(model)

Convert keras model to NNVM format.

Parameters:model (keras.engine.training.Model) – The keras model to be converted
Returns:
  • sym (nnvm.Symbol) – Compatible nnvm symbol
  • params (dict of str to tvm.NDArray) – The parameter dict to be used by nnvm