Neural Operators in PyTorch


neuraloperator is a comprehensive library for learning neural operators in PyTorch. It is the official implementation for Fourier Neural Operators and Tensorized Neural Operators.

Unlike regular neural networks, neural operators enable learning mapping between function spaces, and this library provides all of the tools to do so on your own data.

NeuralOperators are also resolution invariant, so your trained operator can be applied on data of any resolution.


This guide will walk you through the standard ML workflow of loading data, creating a neural operator, training it on your data and saving the trained model for later use.

First install the library pip install neuraloperator (see Installing NeuralOperator for more options).

To create a Fourier Neural Operator model:

To save the weights of the trained model:

And to load the weights later:

neuraloperator comes prepackaged with an example dataset of flows governed by the Darcy flow equation.

To import the data:


Similar to the API provided by torchvision, this dataset includes training and test data for use in standard PyTorch training loops, as well as a preprocessor object that automates the transforms to convert the data into the form best understood by the model.

We provide a Trainer object that automates the logic of a basic neural operator training loop to speed up experimentation (see :doc: auto_examples for more information).

Tensorization is also provided out of the box: you can improve the previous models by simply using a Tucker Tensorized FNO with just a few parameters:

from neuralop.models import TFNO

operator = TFNO(n_modes=(16, 16), hidden_channels=64,

This will use a Tucker factorization of the weights. The forward pass will be efficient by contracting directly the inputs with the factors of the decomposition. The Fourier layers will have 5% of the parameters of an equivalent, dense Fourier Neural Operator!

If you use NeuralOperator, please cite the following papers:

Li, Z., Kovachki, N., Azizzadenesheli, K., Liu, B., Bhattacharya, K., Stuart, A., and Anandkumar A. , “Fourier Neural Operator for Parametric Partial Differential Equations”, ICLR, 2021.

Kovachki, N., Li, Z., Liu, B., Azizzadenesheli, K., Bhattacharya, K., Stuart, A., and Anandkumar A. , “Neural Operator: Learning Maps Between Function Spaces”, , JMLR, 2021.