pihnn.nn.PIHKANLayer#

class pihnn.nn.PIHKANLayer(stack_dim, input_dim, output_dim, degree, n_domains=None, has_bias=True)#

Bases: torch.nn.Module

Single layer for pihnn.nn.PIHKAN.

The following operation is performed (Calafà et al. [2026]):

\[\mathbf{Y}_{t,b,o} = \sum_{p=0}^{P-1}\sum_{i=1}^{I} \mathbf{w}_{t,o,i,p} \left(\mathbf{Z}_{t,b,i}\right)^p,\]

where \(i=1,\dots,I\) is the input dimension, \(o=1,\dots,O\) is the output dimension, \(b=1,\dots,B\) is the batch size, \(p=1,\dots,P\) is the KAN polynomial order, \(\mathbf{w} \in \mathbb{R}^{T,O,I,P}\) are the trainable weights.

Specifically, the weights are initialized as follows:

\[\mathbf{w}_{t,o,i,p} \sim \mathcal{N}\left(0,\frac{2}{(I+pO)(p!)P}\right).\]
Parameters:
  • stack_dim (int) – Number of complex potentials \(T\) (e.g., 1 for Laplace and 2 for linear elasticity).

  • input_dim (int) – Dimension of input \(I\).

  • output_dim (int) – Dimension of output \(O\).

  • degree (int) – KAN polynomial degree \(P\).

  • n_domains (int or None) – Number of domains in the domain-decomposition problem. If None, the layer is not a DD-PIHNN layer.

  • has_bias (bool) – Whether to include the bias vector.

forward(z)#

Perform the forward pass, see above.

Parameters:

z (torch.tensor) – Input of dimension \(T\times B \times I\), where \(B\) is the batch size.

Returns:

Y (torch.tensor) - Output of the network of size \(T\times B \times O\).