Search code examples
neural-networkpre-trained-model

loading and using a pre-trained neural network from any platform


I am building a code and trying to keep things as generic as possible. I have seen a number of tutorials and post but they are all platform specific (tensorflow\pytorch).

Is there a good way to load and use a previously trained neural network model in a manner that the code will be able to cope with both torch and tensorflow? Does it matter in which version of tensorflow\torch the network was built in? I want the code to be as generic as possible.

Also, do I need to know the structure of the original network or can I load it and use it without the notion of the structure?


Solution

  • I don't think it is possible to write a program that can load pre-trained models from both Torch and Tensorflow as they save in different formats.

    You might want to look into the Open Neural Network Exchange Format (https://onnx.ai/) if you are creating the models yourself, this is an initiative backed by Amazon, Facebook, Microsoft, and others to create a portable file format for deep learning models.