KernelNeuralOperator#
- class KernelNeuralOperator(lifting_operator, integral_kernels, projection_operator)[source]#
Bases:
Module
Base class for composing Neural Operators with integral kernels.
This is a base class for composing neural operators with multiple integral kernels. All neural operator models defined in PINA inherit from this class. The structure is inspired by the work of Kovachki, N. et al. see Figure 2 of the reference for extra details. The Neural Operators inheriting from this class can be written as:
\[G_\theta := P \circ K_m \circ \cdot \circ K_1 \circ L\]where:
\(G_\theta: \mathcal{A}\subset \mathbb{R}^{\rm{in}} \rightarrow \mathcal{D}\subset \mathbb{R}^{\rm{out}}\) is the neural operator approximation of the unknown real operator \(G\), that is \(G \approx G_\theta\)
\(L: \mathcal{A}\subset \mathbb{R}^{\rm{in}} \rightarrow \mathbb{R}^{\rm{emb}}\) is a lifting operator mapping the input from its domain \(\mathcal{A}\subset \mathbb{R}^{\rm{in}}\) to its embedding dimension \(\mathbb{R}^{\rm{emb}}\)
\(\{K_i : \mathbb{R}^{\rm{emb}} \rightarrow \mathbb{R}^{\rm{emb}} \}_{i=1}^m\) are \(m\) integral kernels mapping each hidden representation to the next one.
\(P : \mathbb{R}^{\rm{emb}} \rightarrow \mathcal{D}\subset \mathbb{R}^{\rm{out}}\) is a projection operator mapping the hidden representation to the output function.
See also
Original reference: Kovachki, N., Li, Z., Liu, B., Azizzadenesheli, K., Bhattacharya, K., Stuart, A., & Anandkumar, A. (2023). Neural operator: Learning maps between function spaces with applications to PDEs. Journal of Machine Learning Research, 24(89), 1-97.
- Parameters:
lifting_operator (torch.nn.Module) – The lifting operator mapping the input to its hidden dimension.
integral_kernels (torch.nn.Module) – List of integral kernels mapping each hidden representation to the next one.
projection_operator (torch.nn.Module) – The projection operator mapping the hidden representation to the output function.
- property lifting_operator#
The lifting operator property.
- property projection_operator#
The projection operator property.
- property integral_kernels#
The integral kernels operator property.
- forward(x)[source]#
Forward computation for Base Neural Operator. It performs a lifting of the input by the
lifting_operator
. Then different layers integral kernels are applied usingintegral_kernels
. Finally the output is projected to the final dimensionality by theprojection_operator
.- Parameters:
x (torch.Tensor) – The input tensor for performing the computation. It expects a tensor \(B \times N \times D\), where \(B\) is the batch_size, \(N\) the number of points in the mesh, \(D\) the dimension of the problem. In particular \(D\) is the number of spatial/paramtric/temporal variables plus the field variables. For example for 2D problems with 2 outputvariables \(D=4\).
- Returns:
The output tensor obtained from the NO.
- Return type: