Skip to content

Commit

Permalink
Backend pytorch: FNN supports regularization (#1833)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwoolfo1 authored Sep 7, 2024
1 parent d5a903d commit f7aa563
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion deepxde/nn/pytorch/fnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
class FNN(NN):
"""Fully-connected neural network."""

def __init__(self, layer_sizes, activation, kernel_initializer):
def __init__(
self, layer_sizes, activation, kernel_initializer, regularization=None
):
super().__init__()
if isinstance(activation, list):
if not (len(layer_sizes) - 1) == len(activation):
Expand All @@ -21,6 +23,7 @@ def __init__(self, layer_sizes, activation, kernel_initializer):
self.activation = activations.get(activation)
initializer = initializers.get(kernel_initializer)
initializer_zero = initializers.get("zeros")
self.regularizer = regularization

self.linears = torch.nn.ModuleList()
for i in range(1, len(layer_sizes)):
Expand Down

0 comments on commit f7aa563

Please sign in to comment.