Python is popular and optimal for neural network development and training. However, many scientific codes are written in the Fortran language. How I can call a trained network in my Fortran program?
Python is popular and optimal for neural network development and training. However, many scientific codes are written in the Fortran language. How I can call a trained network in my Fortran program?
It would not make sense. You are not training the network in Fortran, you are just trying to run the C++ or Python code from Fortran.
You should abstract the training/inference from your Fortran code. You could do the orchestration in Fortran.
By doing that, you could expose anything you want to your Fortran app.
I was able to call a Torchscript from Fortran through C++ (using g++). See how I did this here: Libtorch works with g++, but fails with Intel compiler However, this does not work for Intel Compiler.