DeepOperatorNetwork<T>

Models & Types · AiDotNet.PhysicsInformed.NeuralOperators

Implements Deep Operator Network (DeepONet) for learning operators.

Inheritance: NeuralNetworkBase<T> → DeepOperatorNetwork<T>

How It Works

For Beginners: DeepONet is another approach to learning operators (like FNO), but with a different architecture.

Universal Approximation Theorem for Operators: Just as neural networks can approximate any function, DeepONet can approximate any operator! This is based on a theorem by Chen and Chen (1995).

The Key Idea - Decomposition: DeepONet represents an operator G as: G(u)(y) = Σᵢ bᵢ(u) * tᵢ(y) + b₀

Where:

  • u is the input function
  • y is the query location
  • bᵢ(u) are “basis functions” of the input (learned by Branch Net)
  • tᵢ(y) are “basis functions” of the location (learned by Trunk Net)

Architecture: DeepONet has TWO networks:

  1. Branch Network:
  • Input: The entire input function u(x) (sampled at sensors)
  • Output: Coefficients b₁, b₂, …, bₚ
  • Role: Encodes information about the input function
  1. Trunk Network:
  • Input: Query location y (where we want to evaluate output)
  • Output: Basis functions t₁(y), t₂(y), …, tₚ(y)
  • Role: Encodes spatial/temporal patterns
  1. Combination:
  • Output: G(u)(y) = b · t + b₀ = Σᵢ bᵢ * tᵢ(y) + b₀
  • b₀ is a learned scalar bias (Lu et al. 2021, Eq. 2), which the paper reports lowers

both training and test error

  • Simple dot product of the two network outputs

Analogy: Think of it like a bilinear form or low-rank factorization:

  • Branch net learns “what” information matters in the input
  • Trunk net learns “where” patterns occur spatially
  • Their interaction gives the output

Example - Heat Equation: Problem: Given initial temperature u(x,0), find temperature u(x,t)

Branch Net:

  • Input: u(x,0) sampled at many points → [u(x₁,0), u(x₂,0), …, u(xₙ,0)]
  • Learns: “This initial condition is smooth/peaked/oscillatory”
  • Output: Coefficients [b₁, b₂, …, bₚ]

Trunk Net:

  • Input: (x, t) where we want to know the temperature
  • Learns: Spatial-temporal basis functions
  • Output: Basis values [t₁(x,t), t₂(x,t), …, tₚ(x,t)]

Result: u(x,t) = Σᵢ bᵢ * tᵢ(x,t)

Key Advantages:

  1. Sensor flexibility: Can use different sensor locations at test time
  2. Query flexibility: Can evaluate at any location y
  3. Theoretical foundation: Universal approximation theorem
  4. Efficient: Once trained, very fast evaluation
  5. Interpretable: Decomposition into branch/trunk has clear meaning

Comparison with FNO: DeepONet:

  • Works on unstructured data (any sensor locations)
  • More flexible for irregular domains
  • Requires specifying sensor locations
  • Good for problems with sparse/irregular data

FNO:

  • Works on structured grids
  • Uses FFT (very efficient)
  • Resolution-invariant
  • Good for periodic/regular problems

Both are powerful, choice depends on your problem!

Applications:

  • Same as FNO: PDEs, climate, fluids, etc.
  • Particularly good for:
  • Inverse problems (finding unknown parameters)
  • Problems with sparse measurements
  • Irregular geometries
  • Multi-scale phenomena

Historical Note: DeepONet was introduced by Lu et al. (2021) and has been highly successful in learning solution operators for PDEs with theoretical guarantees.

Example

var arch = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.Regression,
    inputSize: 100, outputSize: 1);
var branchArch = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.Regression,
    inputSize: 100, outputSize: 128);
var trunkArch = new NeuralNetworkArchitecture<float>(
    inputType: InputType.OneDimensional,
    taskType: NeuralNetworkTaskType.Regression,
    inputSize: 2, outputSize: 128);
var deepONet = new DeepOperatorNetwork<float>(arch, branchArch, trunkArch);

Constructors

Constructor Summary
DeepOperatorNetwork(NeuralNetworkArchitecture<T> architecture, NeuralNetworkArchitecture<T> branchArchitecture, NeuralNetworkArchitecture<T> trunkArchitecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, DeepOperatorNetworkOptions options) Initializes a new instance of DeepONet.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata() Gets metadata about the DeepONet model.
T Evaluate(Vector<T> inputFunction, Vector<T> queryLocation) Evaluates the operator: G(u)(y) = branch(u) · trunk(y) + b0.
Tensor<T> ForwardForTraining(Tensor<T> input)
TrainingHistory<T> Train(Tensor<T> inputFunctions, Tensor<T> queryLocations, Tensor<T> targetValues, int epochs, double learningRate, bool verbose) Trains DeepONet on input-output function pairs.
Vector<T> EvaluateMultiple(Vector<T> inputFunction, Tensor<T> queryLocations) Evaluates the operator at multiple query locations efficiently.
Vector<T> GetGradients()