pyerualjetwork 4.3.2.2b0__tar.gz → 4.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/PKG-INFO +28 -13
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/README.md +27 -12
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/__init__.py +1 -1
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/activation_functions.py +9 -10
- pyerualjetwork-4.3.4/pyerualjetwork/activation_functions_cuda.py +340 -0
- pyerualjetwork-4.3.4/pyerualjetwork/model_operations.py +408 -0
- pyerualjetwork-4.3.4/pyerualjetwork/model_operations_cuda.py +421 -0
- pyerualjetwork-4.3.4/pyerualjetwork/plan.py +627 -0
- pyerualjetwork-4.3.4/pyerualjetwork/plan_cuda.py +648 -0
- pyerualjetwork-4.3.4/pyerualjetwork/planeat.py +825 -0
- pyerualjetwork-4.3.4/pyerualjetwork/planeat_cuda.py +834 -0
- pyerualjetwork-4.3.4/pyerualjetwork/visualizations.py +823 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork.egg-info/PKG-INFO +28 -13
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork.egg-info/SOURCES.txt +21 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork.egg-info/top_level.txt +1 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/__init__.py +11 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/activation_functions.py +290 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/activation_functions_cuda.py +5 -6
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/data_operations.py +406 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/data_operations_cuda.py +461 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/help.py +17 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/loss_functions.py +21 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/loss_functions_cuda.py +21 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/memory_operations.py +298 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/metrics.py +190 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/metrics_cuda.py +163 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/plan_cuda.py +7 -6
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/planeat_cuda.py +2 -3
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/ui.py +22 -0
- pyerualjetwork-4.3.4/pyerualjetwork_afterburner/visualizations_cuda.py +825 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/setup.py +1 -1
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/data_operations.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/data_operations_cuda.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/help.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/loss_functions.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/loss_functions_cuda.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/memory_operations.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/metrics.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/metrics_cuda.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/ui.py +0 -0
- {pyerualjetwork-4.3.2.2b0/pyerualjetwork_afterburner → pyerualjetwork-4.3.4/pyerualjetwork}/visualizations_cuda.py +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork.egg-info/dependency_links.txt +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/model_operations.py +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/model_operations_cuda.py +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/plan.py +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/planeat.py +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/pyerualjetwork_afterburner/visualizations.py +0 -0
- {pyerualjetwork-4.3.2.2b0 → pyerualjetwork-4.3.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyerualjetwork
|
3
|
-
Version: 4.3.
|
3
|
+
Version: 4.3.4
|
4
4
|
Summary: PyerualJetwork is a machine learning library supported with GPU(CUDA) acceleration written in Python for professionals and researchers including with PLAN algorithm, PLANEAT algorithm (genetic optimization). Also includes data pre-process and memory manegament
|
5
5
|
Author: Hasan Can Beydili
|
6
6
|
Author-email: tchasancan@gmail.com
|
@@ -23,18 +23,33 @@ PyPi Page: https://pypi.org/project/pyerualjetwork/
|
|
23
23
|
GitHub Page: https://github.com/HCB06/PyerualJetwork
|
24
24
|
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
26
|
+
pip install pyerualjetwork
|
27
|
+
|
28
|
+
'use this if your data small or memory management is a problem :'
|
29
|
+
|
30
|
+
from pyerualjetwork import plan
|
31
|
+
from pyerualjetwork import planeat
|
32
|
+
from pyerualjetwork import data_operations
|
33
|
+
from pyerualjetwork import model_operations
|
34
|
+
|
35
|
+
from pyerualjetwork import plan_cuda
|
36
|
+
from pyerualjetwork import planeat_cuda
|
37
|
+
from pyerualjetwork import data_operations_cuda
|
38
|
+
from pyerualjetwork import model_operations_cuda
|
39
|
+
|
40
|
+
'use this if your data large or memory management is not a problem : _afterburner package (afterburner package comes with powerful paralellism,
|
41
|
+
afterburner with cuda modules offers super-fast training but some memory managemant features and visualization features discarded.
|
42
|
+
Specially designed for LLM training and other massive model training)'
|
43
|
+
|
44
|
+
from pyerualjetwork_afterburner import plan
|
45
|
+
from pyerualjetwork_afterburner import planeat
|
46
|
+
from pyerualjetwork_afterburner import data_operations
|
47
|
+
from pyerualjetwork_afterburner import model_operations
|
48
|
+
|
49
|
+
from pyerualjetwork_afterburner import plan_cuda
|
50
|
+
from pyerualjetwork_afterburner import planeat_cuda
|
51
|
+
from pyerualjetwork_afterburner import data_operations_cuda
|
52
|
+
from pyerualjetwork_afterburner import model_operations_cuda
|
38
53
|
|
39
54
|
Optimized for Visual Studio Code
|
40
55
|
|
@@ -14,18 +14,33 @@ PyPi Page: https://pypi.org/project/pyerualjetwork/
|
|
14
14
|
GitHub Page: https://github.com/HCB06/PyerualJetwork
|
15
15
|
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
pip install pyerualjetwork
|
18
|
+
|
19
|
+
'use this if your data small or memory management is a problem :'
|
20
|
+
|
21
|
+
from pyerualjetwork import plan
|
22
|
+
from pyerualjetwork import planeat
|
23
|
+
from pyerualjetwork import data_operations
|
24
|
+
from pyerualjetwork import model_operations
|
25
|
+
|
26
|
+
from pyerualjetwork import plan_cuda
|
27
|
+
from pyerualjetwork import planeat_cuda
|
28
|
+
from pyerualjetwork import data_operations_cuda
|
29
|
+
from pyerualjetwork import model_operations_cuda
|
30
|
+
|
31
|
+
'use this if your data large or memory management is not a problem : _afterburner package (afterburner package comes with powerful paralellism,
|
32
|
+
afterburner with cuda modules offers super-fast training but some memory managemant features and visualization features discarded.
|
33
|
+
Specially designed for LLM training and other massive model training)'
|
34
|
+
|
35
|
+
from pyerualjetwork_afterburner import plan
|
36
|
+
from pyerualjetwork_afterburner import planeat
|
37
|
+
from pyerualjetwork_afterburner import data_operations
|
38
|
+
from pyerualjetwork_afterburner import model_operations
|
39
|
+
|
40
|
+
from pyerualjetwork_afterburner import plan_cuda
|
41
|
+
from pyerualjetwork_afterburner import planeat_cuda
|
42
|
+
from pyerualjetwork_afterburner import data_operations_cuda
|
43
|
+
from pyerualjetwork_afterburner import model_operations_cuda
|
29
44
|
|
30
45
|
Optimized for Visual Studio Code
|
31
46
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.3.
|
1
|
+
__version__ = "4.3.4"
|
2
2
|
__update__ = "* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES\n* PyerualJetwork Homepage: https://github.com/HCB06/PyerualJetwork/tree/main\n* PyerualJetwork document: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf\n* YouTube tutorials: https://www.youtube.com/@HasanCanBeydili"
|
3
3
|
|
4
4
|
def print_version(__version__):
|
@@ -217,8 +217,8 @@ def scaled_cubic(x, alpha=1.0):
|
|
217
217
|
|
218
218
|
def sine_offset(x, beta=0.0):
|
219
219
|
return np.sin(x + beta)
|
220
|
-
|
221
|
-
|
220
|
+
|
221
|
+
|
222
222
|
def apply_activation(Input, activation_list):
|
223
223
|
"""
|
224
224
|
Applies activation functions for inputs
|
@@ -277,15 +277,14 @@ def apply_activation(Input, activation_list):
|
|
277
277
|
}
|
278
278
|
|
279
279
|
try:
|
280
|
-
valid_activations = [act for act in activation_list if act in activation_functions]
|
281
|
-
|
282
|
-
activation_outputs = np.stack([activation_functions[act](origin_input)
|
283
|
-
for act in valid_activations])
|
284
280
|
|
285
|
-
|
286
|
-
|
287
|
-
|
281
|
+
valid_mask = np.array([act in activation_functions for act in activation_list])
|
282
|
+
valid_activations = np.array(activation_list)[valid_mask]
|
283
|
+
|
284
|
+
activation_outputs = np.array([activation_functions[act](origin_input) for act in valid_activations])
|
285
|
+
|
286
|
+
return Input + np.sum(activation_outputs, axis=0)
|
288
287
|
|
289
288
|
except Exception as e:
|
290
289
|
warnings.warn(f"Error in activation processing: {str(e)}", RuntimeWarning)
|
291
|
-
return Input
|
290
|
+
return Input
|
@@ -0,0 +1,340 @@
|
|
1
|
+
import cupy as cp
|
2
|
+
from scipy.special import expit, softmax
|
3
|
+
import warnings
|
4
|
+
|
5
|
+
# ACTIVATION FUNCTIONS ----
|
6
|
+
|
7
|
+
def all_activations():
|
8
|
+
|
9
|
+
activations_list = ['linear', 'sigmoid', 'relu', 'tanh', 'circular', 'spiral', 'swish', 'sin_plus', 'mod_circular', 'tanh_circular', 'leaky_relu', 'softplus', 'elu', 'gelu', 'selu', 'sinakt', 'p_squared', 'sglu', 'dlrelu', 'exsig', 'acos', 'gla', 'srelu', 'qelu', 'isra', 'waveakt', 'arctan', 'bent_identity', 'sech', 'softsign', 'pwl', 'cubic', 'gaussian', 'sine', 'tanh_square', 'mod_sigmoid', 'quartic', 'square_quartic', 'cubic_quadratic', 'exp_cubic', 'sine_square', 'logarithmic', 'scaled_cubic', 'sine_offset']
|
10
|
+
|
11
|
+
return activations_list
|
12
|
+
|
13
|
+
def spiral_activation(x):
|
14
|
+
|
15
|
+
r = cp.sqrt(cp.sum(x**2))
|
16
|
+
|
17
|
+
theta = cp.arctan2(x[1:], x[:-1])
|
18
|
+
|
19
|
+
spiral_x = r * cp.cos(theta + r)
|
20
|
+
spiral_y = r * cp.sin(theta + r)
|
21
|
+
|
22
|
+
|
23
|
+
spiral_output = cp.concatenate([cp.array([spiral_x[0]]), spiral_y])
|
24
|
+
|
25
|
+
return spiral_output
|
26
|
+
|
27
|
+
|
28
|
+
def Softmax(
|
29
|
+
x # num: Input data to be transformed using softmax function.
|
30
|
+
):
|
31
|
+
"""
|
32
|
+
Applies the softmax function to the input data.
|
33
|
+
|
34
|
+
Args:
|
35
|
+
(num): Input data to be transformed using softmax function.
|
36
|
+
|
37
|
+
Returns:
|
38
|
+
(num): Transformed data after applying softmax function.
|
39
|
+
"""
|
40
|
+
|
41
|
+
return cp.array(softmax(x.get()))
|
42
|
+
|
43
|
+
|
44
|
+
def Sigmoid(
|
45
|
+
x # num: Input data to be transformed using sigmoid function.
|
46
|
+
):
|
47
|
+
"""
|
48
|
+
Applies the sigmoid function to the input data.
|
49
|
+
|
50
|
+
Args:
|
51
|
+
(num): Input data to be transformed using sigmoid function.
|
52
|
+
|
53
|
+
Returns:
|
54
|
+
(num): Transformed data after applying sigmoid function.
|
55
|
+
"""
|
56
|
+
return expit(x)
|
57
|
+
|
58
|
+
|
59
|
+
def Relu(
|
60
|
+
x # num: Input data to be transformed using ReLU function.
|
61
|
+
):
|
62
|
+
"""
|
63
|
+
Applies the Rectified Linear Unit (ReLU) function to the input data.
|
64
|
+
|
65
|
+
Args:
|
66
|
+
(num): Input data to be transformed using ReLU function.
|
67
|
+
|
68
|
+
Returns:
|
69
|
+
(num): Transformed data after applying ReLU function.
|
70
|
+
"""
|
71
|
+
|
72
|
+
return cp.maximum(0, x)
|
73
|
+
|
74
|
+
|
75
|
+
def tanh(x):
|
76
|
+
return cp.tanh(x)
|
77
|
+
|
78
|
+
def swish(x):
|
79
|
+
return x * (1 / (1 + cp.exp(-x)))
|
80
|
+
|
81
|
+
def sin_plus(x):
|
82
|
+
return (cp.sin(x) + 1) / 2
|
83
|
+
|
84
|
+
def modular_circular_activation(x, period=2*cp.pi):
|
85
|
+
return cp.mod(x, period) / period
|
86
|
+
|
87
|
+
def tanh_circular_activation(x):
|
88
|
+
return (cp.tanh(x) + 1) / 2
|
89
|
+
|
90
|
+
def leaky_relu(x, alpha=0.01):
|
91
|
+
return cp.where(x > 0, x, alpha * x)
|
92
|
+
|
93
|
+
def softplus(x):
|
94
|
+
return cp.log(1 + cp.exp(x))
|
95
|
+
|
96
|
+
def elu(x, alpha=1.0):
|
97
|
+
return cp.where(x > 0, x, alpha * (cp.exp(x) - 1))
|
98
|
+
|
99
|
+
def gelu(x):
|
100
|
+
return 0.5 * x * (1 + cp.tanh(cp.sqrt(2 / cp.pi) * (x + 0.044715 * cp.power(x, 3))))
|
101
|
+
|
102
|
+
def selu(x, lambda_=1.0507, alpha=1.6733):
|
103
|
+
return lambda_ * cp.where(x > 0, x, alpha * (cp.exp(x) - 1))
|
104
|
+
|
105
|
+
def sinakt(x):
|
106
|
+
return cp.sin(x) + cp.cos(x)
|
107
|
+
|
108
|
+
def p_squared(x, alpha=1.0, beta=0.0):
|
109
|
+
return alpha * x**2 + beta * x
|
110
|
+
|
111
|
+
def sglu(x, alpha=1.0):
|
112
|
+
return cp.array(softmax(alpha * x.get())) * x
|
113
|
+
|
114
|
+
# 4. Double Leaky ReLU (DLReLU)
|
115
|
+
def dlrelu(x):
|
116
|
+
return cp.maximum(0.01 * x, x) + cp.minimum(0.01 * x, 0.1 * x)
|
117
|
+
|
118
|
+
# 5. Exponential Sigmoid (ExSig)
|
119
|
+
def exsig(x):
|
120
|
+
return 1 / (1 + cp.exp(-x**2))
|
121
|
+
|
122
|
+
# 6. Adaptive Cosine Activation (ACos)
|
123
|
+
def acos(x, alpha=1.0, beta=0.0):
|
124
|
+
return cp.cos(alpha * x + beta)
|
125
|
+
|
126
|
+
# 7. Gaussian-like Activation (GLA)
|
127
|
+
def gla(x, alpha=1.0, mu=0.0):
|
128
|
+
return cp.exp(-alpha * (x - mu)**2)
|
129
|
+
|
130
|
+
# 8. Swish ReLU (SReLU)
|
131
|
+
def srelu(x):
|
132
|
+
return x * (1 / (1 + cp.exp(-x))) + cp.maximum(0, x)
|
133
|
+
|
134
|
+
# 9. Quadratic Exponential Linear Unit (QELU)
|
135
|
+
def qelu(x):
|
136
|
+
return x**2 * cp.exp(x) - 1
|
137
|
+
|
138
|
+
# 10. Inverse Square Root Activation (ISRA)
|
139
|
+
def isra(x):
|
140
|
+
return x / cp.sqrt(cp.abs(x) + 1)
|
141
|
+
|
142
|
+
def waveakt(x, alpha=1.0, beta=2.0, gamma=3.0):
|
143
|
+
return cp.sin(alpha * x) * cp.cos(beta * x) * cp.sin(gamma * x)
|
144
|
+
|
145
|
+
def arctan(x):
|
146
|
+
return cp.arctan(x)
|
147
|
+
|
148
|
+
def bent_identity(x):
|
149
|
+
return (cp.sqrt(x**2 + 1) - 1) / 2 + x
|
150
|
+
|
151
|
+
def circular_activation(x, scale=2.0, frequency=1.0, shift=0.0):
|
152
|
+
|
153
|
+
n_features = x.shape[0]
|
154
|
+
|
155
|
+
circular_output = cp.zeros_like(x)
|
156
|
+
|
157
|
+
for i in range(n_features):
|
158
|
+
|
159
|
+
r = cp.sqrt(cp.sum(x**2))
|
160
|
+
theta = 2 * cp.pi * (i / n_features) + shift
|
161
|
+
|
162
|
+
circular_x = r * cp.cos(theta + frequency * r) * scale
|
163
|
+
circular_y = r * cp.sin(theta + frequency * r) * scale
|
164
|
+
|
165
|
+
if i % 2 == 0:
|
166
|
+
circular_output[i] = circular_x
|
167
|
+
else:
|
168
|
+
circular_output[i] = circular_y
|
169
|
+
|
170
|
+
return circular_output
|
171
|
+
|
172
|
+
def sech(x):
|
173
|
+
return 2 / (cp.exp(x) + cp.exp(-x))
|
174
|
+
|
175
|
+
def softsign(x):
|
176
|
+
return x / (1 + cp.abs(x))
|
177
|
+
|
178
|
+
def pwl(x, alpha=0.5, beta=1.5):
|
179
|
+
return cp.where(x <= 0, alpha * x, beta * x)
|
180
|
+
|
181
|
+
def cubic(x):
|
182
|
+
return x**3
|
183
|
+
|
184
|
+
def gaussian(x, alpha=1.0, mu=0.0):
|
185
|
+
return cp.exp(-alpha * (x - mu)**2)
|
186
|
+
|
187
|
+
def sine(x, alpha=1.0):
|
188
|
+
return cp.sin(alpha * x)
|
189
|
+
|
190
|
+
def tanh_square(x):
|
191
|
+
return cp.tanh(x)**2
|
192
|
+
|
193
|
+
def mod_sigmoid(x, alpha=1.0, beta=0.0):
|
194
|
+
return 1 / (1 + cp.exp(-alpha * x + beta))
|
195
|
+
|
196
|
+
def quartic(x):
|
197
|
+
return x**4
|
198
|
+
|
199
|
+
def square_quartic(x):
|
200
|
+
return (x**2)**2
|
201
|
+
|
202
|
+
def cubic_quadratic(x):
|
203
|
+
return x**3 * (x**2)
|
204
|
+
|
205
|
+
def exp_cubic(x):
|
206
|
+
return cp.exp(x**3)
|
207
|
+
|
208
|
+
def sine_square(x):
|
209
|
+
return cp.sin(x)**2
|
210
|
+
|
211
|
+
def logarithmic(x):
|
212
|
+
return cp.log(x**2 + 1)
|
213
|
+
|
214
|
+
def scaled_cubic(x, alpha=1.0):
|
215
|
+
return alpha * x**3
|
216
|
+
|
217
|
+
def sine_offset(x, beta=0.0):
|
218
|
+
return cp.sin(x + beta)
|
219
|
+
|
220
|
+
|
221
|
+
def safe_add(current_sum, new_value):
|
222
|
+
try:
|
223
|
+
return current_sum + new_value
|
224
|
+
except OverflowError:
|
225
|
+
return cp.array(current_sum) + cp.array(new_value)
|
226
|
+
|
227
|
+
def apply_activation(Input, activation_list):
|
228
|
+
"""
|
229
|
+
Applies a sequence of activation functions to the input.
|
230
|
+
|
231
|
+
Args:
|
232
|
+
Input (cupy.ndarray): The input to apply activations to.
|
233
|
+
activation_list (list): A list of activation function names to apply.
|
234
|
+
|
235
|
+
Returns:
|
236
|
+
cupy.ndarray: The input after all activations have been applied.
|
237
|
+
"""
|
238
|
+
|
239
|
+
origin_input = cp.copy(Input)
|
240
|
+
|
241
|
+
for i in range(len(activation_list)):
|
242
|
+
try:
|
243
|
+
if activation_list[i] == 'sigmoid':
|
244
|
+
Input = safe_add(Input, Sigmoid(origin_input))
|
245
|
+
elif activation_list[i] == 'swish':
|
246
|
+
Input = safe_add(Input, swish(origin_input))
|
247
|
+
elif activation_list[i] == 'mod_circular':
|
248
|
+
Input = safe_add(Input, modular_circular_activation(origin_input))
|
249
|
+
elif activation_list[i] == 'tanh_circular':
|
250
|
+
Input = safe_add(Input, tanh_circular_activation(origin_input))
|
251
|
+
elif activation_list[i] == 'leaky_relu':
|
252
|
+
Input = safe_add(Input, leaky_relu(origin_input))
|
253
|
+
elif activation_list[i] == 'relu':
|
254
|
+
Input = safe_add(Input, Relu(origin_input))
|
255
|
+
elif activation_list[i] == 'softplus':
|
256
|
+
Input = safe_add(Input, softplus(origin_input))
|
257
|
+
elif activation_list[i] == 'elu':
|
258
|
+
Input = safe_add(Input, elu(origin_input))
|
259
|
+
elif activation_list[i] == 'gelu':
|
260
|
+
Input = safe_add(Input, gelu(origin_input))
|
261
|
+
elif activation_list[i] == 'selu':
|
262
|
+
Input = safe_add(Input, selu(origin_input))
|
263
|
+
elif activation_list[i] == 'tanh':
|
264
|
+
Input = safe_add(Input, tanh(origin_input))
|
265
|
+
elif activation_list[i] == 'sinakt':
|
266
|
+
Input = safe_add(Input, sinakt(origin_input))
|
267
|
+
elif activation_list[i] == 'p_squared':
|
268
|
+
Input = safe_add(Input, p_squared(origin_input))
|
269
|
+
elif activation_list[i] == 'sglu':
|
270
|
+
Input = safe_add(Input, sglu(origin_input, alpha=1.0))
|
271
|
+
elif activation_list[i] == 'dlrelu':
|
272
|
+
Input = safe_add(Input, dlrelu(origin_input))
|
273
|
+
elif activation_list[i] == 'exsig':
|
274
|
+
Input = safe_add(Input, exsig(origin_input))
|
275
|
+
elif activation_list[i] == 'sin_plus':
|
276
|
+
Input = safe_add(Input, sin_plus(origin_input))
|
277
|
+
elif activation_list[i] == 'acos':
|
278
|
+
Input = safe_add(Input, acos(origin_input, alpha=1.0, beta=0.0))
|
279
|
+
elif activation_list[i] == 'gla':
|
280
|
+
Input = safe_add(Input, gla(origin_input, alpha=1.0, mu=0.0))
|
281
|
+
elif activation_list[i] == 'srelu':
|
282
|
+
Input = safe_add(Input, srelu(origin_input))
|
283
|
+
elif activation_list[i] == 'qelu':
|
284
|
+
Input = safe_add(Input, qelu(origin_input))
|
285
|
+
elif activation_list[i] == 'isra':
|
286
|
+
Input = safe_add(Input, isra(origin_input))
|
287
|
+
elif activation_list[i] == 'waveakt':
|
288
|
+
Input = safe_add(Input, waveakt(origin_input))
|
289
|
+
elif activation_list[i] == 'arctan':
|
290
|
+
Input = safe_add(Input, arctan(origin_input))
|
291
|
+
elif activation_list[i] == 'bent_identity':
|
292
|
+
Input = safe_add(Input, bent_identity(origin_input))
|
293
|
+
elif activation_list[i] == 'sech':
|
294
|
+
Input = safe_add(Input, sech(origin_input))
|
295
|
+
elif activation_list[i] == 'softsign':
|
296
|
+
Input = safe_add(Input, softsign(origin_input))
|
297
|
+
elif activation_list[i] == 'pwl':
|
298
|
+
Input = safe_add(Input, pwl(origin_input))
|
299
|
+
elif activation_list[i] == 'cubic':
|
300
|
+
Input = safe_add(Input, cubic(origin_input))
|
301
|
+
elif activation_list[i] == 'gaussian':
|
302
|
+
Input = safe_add(Input, gaussian(origin_input))
|
303
|
+
elif activation_list[i] == 'sine':
|
304
|
+
Input = safe_add(Input, sine(origin_input))
|
305
|
+
elif activation_list[i] == 'tanh_square':
|
306
|
+
Input = safe_add(Input, tanh_square(origin_input))
|
307
|
+
elif activation_list[i] == 'mod_sigmoid':
|
308
|
+
Input = safe_add(Input, mod_sigmoid(origin_input))
|
309
|
+
elif activation_list[i] == 'linear':
|
310
|
+
Input = safe_add(Input, origin_input)
|
311
|
+
elif activation_list[i] == 'quartic':
|
312
|
+
Input = safe_add(Input, quartic(origin_input))
|
313
|
+
elif activation_list[i] == 'square_quartic':
|
314
|
+
Input = safe_add(Input, square_quartic(origin_input))
|
315
|
+
elif activation_list[i] == 'cubic_quadratic':
|
316
|
+
Input = safe_add(Input, cubic_quadratic(origin_input))
|
317
|
+
elif activation_list[i] == 'exp_cubic':
|
318
|
+
Input = safe_add(Input, exp_cubic(origin_input))
|
319
|
+
elif activation_list[i] == 'sine_square':
|
320
|
+
Input = safe_add(Input, sine_square(origin_input))
|
321
|
+
elif activation_list[i] == 'logarithmic':
|
322
|
+
Input = safe_add(Input, logarithmic(origin_input))
|
323
|
+
elif activation_list[i] == 'scaled_cubic':
|
324
|
+
Input = safe_add(Input, scaled_cubic(origin_input, 1.0))
|
325
|
+
elif activation_list[i] == 'sine_offset':
|
326
|
+
Input = safe_add(Input, sine_offset(origin_input, 1.0))
|
327
|
+
elif activation_list[i] == 'spiral':
|
328
|
+
Input = safe_add(Input, spiral_activation(origin_input))
|
329
|
+
elif activation_list[i] == 'circular':
|
330
|
+
Input = safe_add(Input, circular_activation(origin_input))
|
331
|
+
|
332
|
+
except Exception as e:
|
333
|
+
warnings.warn(f"Error in activation {activation_list[i]}: {str(e)}", RuntimeWarning)
|
334
|
+
if not isinstance(Input, cp.ndarray):
|
335
|
+
Input = cp.array(Input)
|
336
|
+
if not isinstance(origin_input, cp.ndarray):
|
337
|
+
origin_input = cp.array(origin_input)
|
338
|
+
continue
|
339
|
+
|
340
|
+
return Input
|