From onnx to pytorch

Is it possible to import a onnx model to pytorch as pytorch module?
I want to convert pretrained models for video recognition from mxnet to pytorch… So…

No, PyTorch only support exporting to ONNX. For your scenario, you will need to dump the mxnet model weights to a file, create a similar architecture in PyTorch and replace the model parameters with the mxnet one.

There’s a new library onnx2pytorch that helps you transform onnx models to PyTorch.

2 Likes