How to use a neural network (Pytorch- or Tensorflow-based) in Fortran?

Viewed 993

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?

2 Answers

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.

  1. Create your model in Python
  2. Expose your model thru an API that you can access from Fortran via an httpRequest.

By doing that, you could expose anything you want to your Fortran app.

Related