Skip to content

Commit 3acc3da

Browse files
add tests
1 parent b0c7096 commit 3acc3da

27 files changed

Lines changed: 1148 additions & 185 deletions

pina/_src/adaptive_function/adaptive_celu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5353
5454
:param alpha: The output scaling parameter of the adaptive function.
5555
If ``None``, it is initialized to ``1``. Default is ``None``.
56-
:type alpha: int | float | complex
56+
:type alpha: int | float
5757
:param beta: The input scaling parameter of the adaptive function.
5858
If ``None``, it is initialized to ``1``. Default is ``None``.
59-
:type beta: int | float | complex
59+
:type beta: int | float
6060
:param gamma: The input shifting parameter of the adaptive function.
6161
If ``None``, it is initialized to ``0``. Default is ``None``.
62-
:type gamma: int | float | complex
62+
:type gamma: int | float
6363
:param fixed: The names of parameters to keep fixed during training.
6464
These parameters will not be optimized and will have
6565
``requires_grad=False``. Available options are ``"alpha"``,
@@ -74,4 +74,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7474
:raises ValueError: If fixed contains invalid parameter names.
7575
"""
7676
super().__init__(alpha, beta, gamma, fixed)
77-
self.func = torch.nn.CELU()
77+
self._func = torch.nn.CELU()

pina/_src/adaptive_function/adaptive_elu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5656
5757
:param alpha: The output scaling parameter of the adaptive function.
5858
If ``None``, it is initialized to ``1``. Default is ``None``.
59-
:type alpha: int | float | complex
59+
:type alpha: int | float
6060
:param beta: The input scaling parameter of the adaptive function.
6161
If ``None``, it is initialized to ``1``. Default is ``None``.
62-
:type beta: int | float | complex
62+
:type beta: int | float
6363
:param gamma: The input shifting parameter of the adaptive function.
6464
If ``None``, it is initialized to ``0``. Default is ``None``.
65-
:type gamma: int | float | complex
65+
:type gamma: int | float
6666
:param fixed: The names of parameters to keep fixed during training.
6767
These parameters will not be optimized and will have
6868
``requires_grad=False``. Available options are ``"alpha"``,
@@ -77,4 +77,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7777
:raises ValueError: If fixed contains invalid parameter names.
7878
"""
7979
super().__init__(alpha, beta, gamma, fixed)
80-
self.func = torch.nn.ELU()
80+
self._func = torch.nn.ELU()

pina/_src/adaptive_function/adaptive_exp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
4949
5050
:param alpha: The output scaling parameter of the adaptive function.
5151
If ``None``, it is initialized to ``1``. Default is ``None``.
52-
:type alpha: int | float | complex
52+
:type alpha: int | float
5353
:param beta: The input scaling parameter of the adaptive function.
5454
If ``None``, it is initialized to ``1``. Default is ``None``.
55-
:type beta: int | float | complex
55+
:type beta: int | float
5656
:param gamma: The input shifting parameter of the adaptive function.
5757
If ``None``, it is initialized to ``0``. Default is ``None``.
58-
:type gamma: int | float | complex
58+
:type gamma: int | float
5959
:param fixed: The names of parameters to keep fixed during training.
6060
These parameters will not be optimized and will have
6161
``requires_grad=False``. Available options are ``"alpha"``,
@@ -70,4 +70,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7070
:raises ValueError: If fixed contains invalid parameter names.
7171
"""
7272
super().__init__(alpha, beta, gamma, fixed)
73-
self.func = torch.exp
73+
self._func = torch.exp

pina/_src/adaptive_function/adaptive_function_interface.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,3 @@ def gamma(self):
4848
:return: The gamma parameter.
4949
:rtype: torch.nn.Parameter | torch.Tensor
5050
"""
51-
52-
@property
53-
@abstractmethod
54-
def func(self):
55-
"""
56-
The adaptive function.
57-
58-
:return: The adaptive function.
59-
:rtype: callable
60-
"""
61-
62-
@func.setter
63-
@abstractmethod
64-
def func(self, value):
65-
"""
66-
Set the adaptive function.
67-
68-
:param value: The adaptive function.
69-
:type value: callable
70-
"""

pina/_src/adaptive_function/adaptive_gelu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5454
5555
:param alpha: The output scaling parameter of the adaptive function.
5656
If ``None``, it is initialized to ``1``. Default is ``None``.
57-
:type alpha: int | float | complex
57+
:type alpha: int | float
5858
:param beta: The input scaling parameter of the adaptive function.
5959
If ``None``, it is initialized to ``1``. Default is ``None``.
60-
:type beta: int | float | complex
60+
:type beta: int | float
6161
:param gamma: The input shifting parameter of the adaptive function.
6262
If ``None``, it is initialized to ``0``. Default is ``None``.
63-
:type gamma: int | float | complex
63+
:type gamma: int | float
6464
:param fixed: The names of parameters to keep fixed during training.
6565
These parameters will not be optimized and will have
6666
``requires_grad=False``. Available options are ``"alpha"``,
@@ -75,4 +75,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7575
:raises ValueError: If fixed contains invalid parameter names.
7676
"""
7777
super().__init__(alpha, beta, gamma, fixed)
78-
self.func = torch.nn.GELU()
78+
self._func = torch.nn.GELU()

pina/_src/adaptive_function/adaptive_mish.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5353
5454
:param alpha: The output scaling parameter of the adaptive function.
5555
If ``None``, it is initialized to ``1``. Default is ``None``.
56-
:type alpha: int | float | complex
56+
:type alpha: int | float
5757
:param beta: The input scaling parameter of the adaptive function.
5858
If ``None``, it is initialized to ``1``. Default is ``None``.
59-
:type beta: int | float | complex
59+
:type beta: int | float
6060
:param gamma: The input shifting parameter of the adaptive function.
6161
If ``None``, it is initialized to ``0``. Default is ``None``.
62-
:type gamma: int | float | complex
62+
:type gamma: int | float
6363
:param fixed: The names of parameters to keep fixed during training.
6464
These parameters will not be optimized and will have
6565
``requires_grad=False``. Available options are ``"alpha"``,
@@ -74,4 +74,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7474
:raises ValueError: If fixed contains invalid parameter names.
7575
"""
7676
super().__init__(alpha, beta, gamma, fixed)
77-
self.func = torch.nn.Mish()
77+
self._func = torch.nn.Mish()

pina/_src/adaptive_function/adaptive_relu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5454
5555
:param alpha: The output scaling parameter of the adaptive function.
5656
If ``None``, it is initialized to ``1``. Default is ``None``.
57-
:type alpha: int | float | complex
57+
:type alpha: int | float
5858
:param beta: The input scaling parameter of the adaptive function.
5959
If ``None``, it is initialized to ``1``. Default is ``None``.
60-
:type beta: int | float | complex
60+
:type beta: int | float
6161
:param gamma: The input shifting parameter of the adaptive function.
6262
If ``None``, it is initialized to ``0``. Default is ``None``.
63-
:type gamma: int | float | complex
63+
:type gamma: int | float
6464
:param fixed: The names of parameters to keep fixed during training.
6565
These parameters will not be optimized and will have
6666
``requires_grad=False``. Available options are ``"alpha"``,
@@ -75,4 +75,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7575
:raises ValueError: If fixed contains invalid parameter names.
7676
"""
7777
super().__init__(alpha, beta, gamma, fixed)
78-
self.func = torch.nn.ReLU()
78+
self._func = torch.nn.ReLU()

pina/_src/adaptive_function/adaptive_sigmoid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5555
5656
:param alpha: The output scaling parameter of the adaptive function.
5757
If ``None``, it is initialized to ``1``. Default is ``None``.
58-
:type alpha: int | float | complex
58+
:type alpha: int | float
5959
:param beta: The input scaling parameter of the adaptive function.
6060
If ``None``, it is initialized to ``1``. Default is ``None``.
61-
:type beta: int | float | complex
61+
:type beta: int | float
6262
:param gamma: The input shifting parameter of the adaptive function.
6363
If ``None``, it is initialized to ``0``. Default is ``None``.
64-
:type gamma: int | float | complex
64+
:type gamma: int | float
6565
:param fixed: The names of parameters to keep fixed during training.
6666
These parameters will not be optimized and will have
6767
``requires_grad=False``. Available options are ``"alpha"``,
@@ -76,4 +76,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7676
:raises ValueError: If fixed contains invalid parameter names.
7777
"""
7878
super().__init__(alpha, beta, gamma, fixed)
79-
self.func = torch.nn.Sigmoid()
79+
self._func = torch.nn.Sigmoid()

pina/_src/adaptive_function/adaptive_silu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
5555
5656
:param alpha: The output scaling parameter of the adaptive function.
5757
If ``None``, it is initialized to ``1``. Default is ``None``.
58-
:type alpha: int | float | complex
58+
:type alpha: int | float
5959
:param beta: The input scaling parameter of the adaptive function.
6060
If ``None``, it is initialized to ``1``. Default is ``None``.
61-
:type beta: int | float | complex
61+
:type beta: int | float
6262
:param gamma: The input shifting parameter of the adaptive function.
6363
If ``None``, it is initialized to ``0``. Default is ``None``.
64-
:type gamma: int | float | complex
64+
:type gamma: int | float
6565
:param fixed: The names of parameters to keep fixed during training.
6666
These parameters will not be optimized and will have
6767
``requires_grad=False``. Available options are ``"alpha"``,
@@ -76,4 +76,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
7676
:raises ValueError: If fixed contains invalid parameter names.
7777
"""
7878
super().__init__(alpha, beta, gamma, fixed)
79-
self.func = torch.nn.SiLU()
79+
self._func = torch.nn.SiLU()

pina/_src/adaptive_function/adaptive_siren.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
4848
4949
:param alpha: The output scaling parameter of the adaptive function.
5050
If ``None``, it is initialized to ``1``. Default is ``None``.
51-
:type alpha: int | float | complex
51+
:type alpha: int | float
5252
:param beta: The input scaling parameter of the adaptive function.
5353
If ``None``, it is initialized to ``1``. Default is ``None``.
54-
:type beta: int | float | complex
54+
:type beta: int | float
5555
:param gamma: The input shifting parameter of the adaptive function.
5656
If ``None``, it is initialized to ``0``. Default is ``None``.
57-
:type gamma: int | float | complex
57+
:type gamma: int | float
5858
:param fixed: The names of parameters to keep fixed during training.
5959
These parameters will not be optimized and will have
6060
``requires_grad=False``. Available options are ``"alpha"``,
@@ -69,4 +69,4 @@ def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
6969
:raises ValueError: If fixed contains invalid parameter names.
7070
"""
7171
super().__init__(alpha, beta, gamma, fixed)
72-
self.func = torch.sin
72+
self._func = torch.sin

0 commit comments

Comments
 (0)