I have trained a neural network and would like to save it to disk. I am using Wolfram version on Windows (64-bit). I have entered the following commands:

Export["file1.json", trainedNet, "MXNet"]

Two files are created: file1.json and file1.params

When I try to import the file,

net = Import["file1.json", "MXNet"]

I get the following error message: Layer named "1.1$0" couldn't be created, layer type cast is not supported.

When I use the command,

Export["file1.onnx", trainedNet]

I get the error message: cannot infer the form of the file file1.onnx

I appreciate any help in resolving the above issues. Thanks and best regards


  • 1
    $\begingroup$ Do you only want to export/import from Mathematica or use the net externally? If the former, perhaps see if Export["test.wlnet", trainedNet, "WLNet"] works for you? Although Export["test.onnx", trainedNet, "ONNX"] works for me in 12.2.0 for Linux too.. $\endgroup$ – George Varnavides Dec 23 '20 at 17:53
  • $\begingroup$ The WLNet option works for me, but the ONNX option still does not work. For now, I plan to use it within Mathematica, but eventually I would like to use the net externally. Thank you for your help. - Chris $\endgroup$ – Chris Dec 24 '20 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.