fnn

Toolbox to use NNs in fortran

https://github.com/cerea-daml/fnn

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Toolbox to use NNs in fortran

Basic Info
Statistics
  • Stars: 12
  • Watchers: 0
  • Forks: 4
  • Open Issues: 0
  • Releases: 1
Created over 3 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog License Citation

README.md

The Fortran Neural Network (FNN) library

DOI

The goal of the FNN library is to provide the fnn module, which can be used in Fortran code to implement simple, sequential neural networks. Once a network is constructed, the forward operator is available with apply_forward and can be applied both in training and inference mode. The tangent linear and adjoint operators are also available. In addition, it is possible to access (both read and write) the networks parameters as a real vector.

This module has been largely inspired by the FKB. It has been designed to provide the technical possibility to use neural networks within variational data assimilation using the Object-Oriented Prediction System (OOPS) developed at the European Centre for Medium-range Weather Forecast (ECMWF).

This repository is organised as follows. - The source code is located in the src/ folder. The .f90 files together implement the fnn module. The python script is used to create text files (see Section Creating a network). - The test suite is located in the test/ folder. - The module documentation can be found here.

The code is archived on zenodo. TODO: mention the JAMES paper once it is out.

Floating-point precision

The precision for both real and integer numbers is defined in fnn_common.f90. For compatibility with OOPS, these are hard-coded to real64 and int32. Nevertheless, there is no obstacle to use this library with other kind of real and integer numbers.

Creating a network

The easiest way to create a network with the fnn module is to use the snn_fromfile function which can read well-formatted text files. The keras_to_fnn.py script can be used to transform a sequential neural network implemented in Keras into a well-formatted text file.

Test suite

The test suite consists of a set of python scripts testing various functionalities of the module. The tests must be compiled (for example using scons) before they can be executed.

Examples

In the test suite, several examples can be found. Let us take the example of test 3. The workflow of this test is handled by the python script test_3.py. 1. A sequential neural network is created using Keras. 2. The network is converted to a text file using the keras_to_fnn.py script. 3. The fortran program test_3.x is executed. Note that this program has to be compiled from test_3.f90 beforehand, for example using scons. - The text file is read to construct the network. - An ensemble of 100 random input vectors is drawn. - The forward operator is applied to each of the 100 random inputs. - The fortran input and outputs are written to a binary file. 4. Back to the python script, the binary file is read, and the fortran output are compared to their expected value.

Owner

  • Name: CEREA DA-ML team
  • Login: cerea-daml
  • Kind: organization
  • Location: Paris, France

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Farchi"
  given-names: "Alban"
  orcid: "https://orcid.org/0000-0002-4162-8289"
- family-names: "Chrust"
  given-names: "Marcin"
- family-names: "Bocquet"
  given-names: "Marc"
- family-names: "Laloyaux"
  given-names: "Patrick"
- family-names: "Bonavita"
  given-names: "Massimo"
title: "The Fortran Neural Network (FNN) library"
version: 1.0.0
doi: 10.5281/zenodo.7245291
date-released: 2022-10-24
url: "https://github.com/cerea-daml/fnn"

GitHub Events

Total
  • Push event: 6
  • Fork event: 1
Last Year
  • Push event: 6
  • Fork event: 1

Dependencies

.github/workflows/doxygen-gh-pages.yml actions
  • actions/checkout v3 composite
  • mattnotmitt/doxygen-action v1.1.0 composite
  • peaceiris/actions-gh-pages v3 composite