mindspore.convert_model

View Source On Gitee
mindspore.convert_model(mindir_file, convert_file, file_format)[source]

Convert mindir model to other format model. Current version only support convert to “ONNX” format.

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • mindir_file (str) – MindIR file name.

  • convert_file (str) – Convert model file name.

  • file_format (str) – Convert model’s format, current version only supports “ONNX”.

Raises
  • TypeError – If the parameter mindir_file is not str.

  • TypeError – If the parameter convert_file is not str.

  • ValueError – If the parameter file_format is not “ONNX”.

Examples

>>> import mindspore as ms
>>> ms.convert_model("lenet.mindir", "lenet.onnx", "ONNX")