Skip to content

Commit 0e35757

Browse files
committed
Add docstring
1 parent 70a19bd commit 0e35757

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

deepxde/utils/pytorch.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@
44

55

66
class LLAAF(torch.nn.Module):
7+
"""Pytorch implementation of layer-wise locally adaptive
8+
activation functions (L-LAAF).
9+
10+
Examples:
11+
12+
To define a L-LAAF ReLU with the scaling factor ``n = 10``:
13+
14+
.. code-block:: python
15+
16+
n = 10
17+
llaaf = LLAAF(torch.relu, n)
18+
19+
References:
20+
`A. D. Jagtap, K. Kawaguchi, & G. E. Karniadakis. Locally adaptive activation
21+
functions with slope recovery for deep and physics-informed neural networks.
22+
Proceedings of the Royal Society A, 476(2239), 20200334, 2020
23+
<https://doi.org/10.1098/rspa.2020.0334>`_.
24+
"""
25+
726
def __init__(self, activation, n):
27+
"""
28+
Initialize the L-LAAF module.
29+
30+
Args:
31+
activation: The activation function to use.
32+
n: The scaling factor.
33+
"""
834
super().__init__()
935
self.activation = activation
1036
self.n = n

0 commit comments

Comments
 (0)