How to convert python deep learning code into c++ dll library


My friend develop a GUI program in C++, and he wants to embed the python deep learning code into the program (a CNN model), so that we can train and test the model by pressing the button of the GUI C++ program. However, the python code with CNN model needs import packages like torch, numpy, scipy (with pytorch), if written using the tensorflow model, it needs import packages like keras. Is it possible to convert the python source code, including the deep learning packages into dll files so that we can call the model training and testing with the C++ GUI program? If it is possible, I need someone offer me some guidance on how to do that.


Generally you could script your model and export it via torch.jit.scirpt and, respectively, which would allow you to load it in a pure C++ application using libtorch.
However, if that’s not an option you could also check the beta torch::deploy/MultiPy library which allows you to run eager mode PyTorch models in a C++ application.