PirateNet Block#
- class PirateNetBlock(inner_size, activation)[source]#
Bases:
Module
The inner block of Physics-Informed residual adaptive network (PirateNet).
The block consists of three dense layers with dual gating operations and an adaptive residual connection. The trainable
alpha
parameter controls the contribution of the residual connection.See also
Original reference: Wang, S., Sankaran, S., Stinis., P., Perdikaris, P. (2025). Simulating Three-dimensional Turbulence with Physics-informed Neural Networks. DOI: arXiv preprint arXiv:2507.08972.
Initialization of the
PirateNetBlock
class.- Parameters:
inner_size (int) – The number of hidden units in the dense layers.
activation (torch.nn.Module) – The activation function.
- forward(x, U, V)[source]#
Forward pass of the PirateNet block. It computes the output of the block by applying the dense layers with scaling, and combines the results with the input using the adaptive residual connection.
- Parameters:
x (torch.Tensor | LabelTensor) – The input tensor.
U (torch.Tensor) – The first shared gating tensor. It must have the same shape as
x
.V (torch.Tensor) – The second shared gating tensor. It must have the same shape as
x
.
- Returns:
The output tensor of the block.
- Return type:
- property alpha#
Return the alpha parameter.
- Returns:
The alpha parameter controlling the residual connection.
- Return type:
torch.nn.Parameter