Skip to main content
nops logo

Neural Operators made simple.

PyPI version Python License: MIT Code Style: Black

graph LR
    subgraph nops_FNO [nops: FNO Architecture]
        direction LR
        Input["Input<br/>(Batch, C_in, X, Y...)"] --> Grid{Append<br/>Grid?}
        Grid -- Yes --> InputGrid[Input + Grid]
        Grid -- No --> InputGrid
        
        InputGrid --> Lifting["Lifting Layer<br/>(Projection P)"]
        
        subgraph FourierLayers [Fourier Layers x N]
            direction TB
            FFT[FFT] --> SpecConv["Spectral Conv<br/>(R * Weights)"]
            SpecConv --> iFFT["Inverse FFT"]
            iFFT --> Skip{"Skip<br/>Connection"}
            
            Skip --> Attention{"Attention<br/>Gating?"}
            Attention -- Yes --> AttnBlock["Attention Weights"]
            Attention -- No --> SumBlock["Sum"]
            
            AttnBlock --> OutputLayer
            SumBlock --> OutputLayer
        end
        
        Lifting --> FourierLayers
        FourierLayers --> Projection["Projection Layer<br/>(Q)"]
        Projection --> Output["Output<br/>(Batch, C_out, X, Y...)"]
    end

A human-centric interface for operating with Neural Operators (FNO, GNO, DeepONet, etc.).


nops is designed to be an elegant, high-level layer over complex neural operator architectures. Whether you are a researcher prototyping a new PDE solver or an engineer deploying a model to production, nops abstracts the complexity while retaining the flexibility you need.

✨ Features

  • Human-Friendly API: Intuitive classes and methods that make sense.
  • Multi-Dimensional: Seamless support for 1D, 2D, and 3D FNO models.
  • Production Ready: Built with modularity, type hinting, and efficiency in mind.
  • Batteries Included:
  • Attention Gating: Advanced mechanisms to weight parallel Fourier branches.
  • Flexible Gridding: Automatic handling of grid coordinates.
  • Padding Management: Easy handling of boundary conditions.

📦 Installation

Install nops easily via pip:

pip install nops

Note: Requires Python 3.12+

🚀 Quick Start

Solving a PDE with a Fourier Neural Operator (FNO) has never been this simple.

import torch
import torch.nn as nn
from nops.fno.models.original import FNO

# 1. Define your configuration
model = FNO(
    modes=[16, 16],               # 16 Fourier modes for height and width
    num_fourier_layers=4,         # Depth of the network
    in_channels=3,                # (e.g., u, v, p)
    out_channels=1,               # (e.g., pressure field)
    lifting_channels=64,
    projection_channels=64,
    mid_channels=64,
    activation=nn.GELU(),
    add_grid=True,                # Auto-append x,y coordinates
    attn_gating=True              # Enable attention mechanism
)

# 2. Forward pass
# Batch size: 8, Channels: 3, Resolution: 128x128
input_data = torch.randn(8, 3, 128, 128)
output = model(input_data)

print(f"Output Field Shape: {output.shape}")
# > Output Field Shape: torch.Size([8, 1, 128, 128])

🗺️ Roadmap

  • FNO (Fourier Neural Operator): Original implementation with attention extensions.
  • DeepONet: Implementation of Deep Operator Networks.
  • GNO (Graph Neural Operator): Support for irregular meshes.
  • Physics-Informed Losses: Built-in loss functions for PDE constraints.
  • Data Loaders: Standard datasets (Burgers, Navier-Stokes, Darcy Flow).

🤝 Contributing

We welcome contributions! nops is a community-driven project to make neural operators accessible to everyone.

  1. Fork the repository.
  2. Create a Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

Please ensure your code follows the existing style and includes tests.

📄 License

Distributed under the MIT License. See LICENSE for more information.


Built with ❤️ by the nops community.

Metadata

Release files for nops 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nops 0.3.0
File Size Uploaded
nops-0.3.0.tar.gz 505.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nops 0.3.0
File Interpreter ABI Platform
nops-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 602.4 kB

Release files / nops-0.3.0.tar.gz

Download URL nops-0.3.0.tar.gz
Size 505.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1cf6858fe205758fec7306ca1e346ad4633fc3d5fc11a02c895aac461534f6e9
BLAKE2b-256 checksum
How to use checksums
ce887b6751970cd3e4a19f01a1e5b07782fbdcce8b84949654156648702cf376
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

Release files / nops-0.3.0-py3-none-any.whl

Download URL nops-0.3.0-py3-none-any.whl
Size 96.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eacf85b7de13177900734c982fbb3b2fde744a1fac42772d79fe95d27b151ce9
BLAKE2b-256 checksum
How to use checksums
32f194a8a1a688cc8dbee99986b25c1b2b735c3a15824bb9e6ffcc058c121833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page