Skip to main content
Kent Academic Repository

FTorch: a library for coupling PyTorch models to Fortran

Atkinson, Jack, Elafrou, Athena, Kasoar, Elliott, Wallwork, Joseph, Meltzer, Thomas, Clifford, Simon, Orchard, Dominic A., Edsall, Chris (2025) FTorch: a library for coupling PyTorch models to Fortran. The Journal of Open Source Software, 10 (107). Article Number 7602. ISSN 2475-9066. (doi:10.21105/joss.07602) (KAR id:113872)

Abstract

In the last decade, machine learning (ML) and deep learning (DL) techniques have revolutionised many fields within science, industry, and beyond. Researchers across domains are increasingly seeking to combine ML with numerical modelling to advance research. This typically brings about the challenge of programming language interoperation. PyTorch (Paszke et al., 2019) is a popular framework for designing and training ML/DL models whilst Fortran remains a language of choice for many high-performance computing (HPC) scientific models. The FTorch library provides an easy-to-use, performant, cross-platform method for coupling the two, allowing users to call PyTorch models from Fortran. FTorch is open-source, open-development, and well-documented with minimal dependencies. A central tenet of its design, in contrast to other approaches, is that FTorch removes dependence on the Python runtime (and virtual environments). By building on the LibTorch backend (written in C++ and accessible via an API), it allows users to run ML models on both CPU and GPU architectures without needing to port code to device-specific languages.

Item Type: Article
DOI/Identification number: 10.21105/joss.07602
Subjects: Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming,
Institutional Unit: Schools > School of Computing
Former Institutional Unit:
There are no former institutional units.
Funders: University of Kent (https://ror.org/00xkeyj56)
Depositing User: Dominic Orchard
Date Deposited: 14 Apr 2026 16:30 UTC
Last Modified: 15 Apr 2026 14:52 UTC
Resource URI: https://kar.kent.ac.uk/id/eprint/113872 (The current URI for this page, for reference purposes)

University of Kent Author Information

  • Depositors only (login required):

Total unique views of this page since July 2020. For more details click on the image.