Commit 8987a3c
[FEATURE] Integrate gating & blending activations into WaveNet (#193)
* Replaced manual gating/blending with Gating/BlendingActivation classes.
* Deleted debugging stuff and replaced throw with assert.
* Remove backward compatibility constructors from _Layer, LayerArrayParams, and _LayerArray
- Removed boolean gated parameter constructors from _Layer class
- Removed boolean gated parameter constructors from LayerArrayParams struct
- Removed boolean gated parameter constructors from _LayerArray class
- Updated all test files to use GatingMode enum instead of bool gated
- Backward compatibility logic retained in Factory function for JSON parsing
- All tests pass after updating to use GatingMode enum
* Formatting
* Enhance _Layer constructor to validate gating and blending activations
- Added validation checks in the _Layer constructor to ensure that gating and blending activations are not provided when the gating mode is set to NONE.
- Updated the constructor signature to remove default values for gating and blending activations, requiring explicit values during instantiation.
- Adjusted related test cases to reflect the new constructor requirements, ensuring comprehensive coverage of the updated functionality.
- Improved error handling by throwing std::invalid_argument exceptions for invalid activation configurations.
* Refactor _Layer constructor to use secondary_activation parameter
- Updated the _Layer constructor to replace gating and blending activation parameters with a single secondary_activation parameter.
- Added validation to ensure secondary_activation is provided for GATED and BLENDED modes.
- Adjusted related test cases to reflect the new constructor signature and ensure proper functionality.
- Removed default values for gating and blending activations, enforcing explicit activation configuration during instantiation.
* Note on gating/blending activations
---------
Co-authored-by: João Felipe Santos <santosjf@pm.me>1 parent 57dfd6b commit 8987a3c
File tree
11 files changed
+520
-127
lines changed- NAM
- tools
- test
- test_wavenet
11 files changed
+520
-127
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| |||
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | | - | |
| 56 | + | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
| |||
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| |||
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| 100 | + | |
90 | 101 | | |
91 | 102 | | |
92 | 103 | | |
| |||
103 | 114 | | |
104 | 115 | | |
105 | 116 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 117 | + | |
| 118 | + | |
110 | 119 | | |
111 | 120 | | |
112 | 121 | | |
| |||
119 | 128 | | |
120 | 129 | | |
121 | 130 | | |
122 | | - | |
| 131 | + | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
66 | | - | |
| 71 | + | |
67 | 72 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
82 | 91 | | |
83 | | - | |
| 92 | + | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
| |||
89 | 98 | | |
90 | 99 | | |
91 | 100 | | |
92 | | - | |
| 101 | + | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
| |||
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
108 | | - | |
109 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
115 | | - | |
116 | | - | |
| 125 | + | |
| 126 | + | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
| |||
263 | 273 | | |
264 | 274 | | |
265 | 275 | | |
266 | | - | |
| 276 | + | |
267 | 277 | | |
268 | | - | |
| 278 | + | |
269 | 279 | | |
270 | 280 | | |
271 | 281 | | |
| |||
468 | 478 | | |
469 | 479 | | |
470 | 480 | | |
471 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
472 | 525 | | |
473 | 526 | | |
474 | 527 | | |
| |||
477 | 530 | | |
478 | 531 | | |
479 | 532 | | |
480 | | - | |
481 | | - | |
482 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
483 | 536 | | |
484 | 537 | | |
485 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
17 | 33 | | |
18 | 34 | | |
19 | 35 | | |
| |||
32 | 48 | | |
33 | 49 | | |
34 | 50 | | |
| 51 | + | |
35 | 52 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
40 | 57 | | |
41 | 58 | | |
42 | | - | |
| 59 | + | |
43 | 60 | | |
44 | 61 | | |
45 | 62 | | |
46 | 63 | | |
47 | 64 | | |
48 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
49 | 87 | | |
50 | 88 | | |
51 | 89 | | |
| |||
97 | 135 | | |
98 | 136 | | |
99 | 137 | | |
100 | | - | |
| 138 | + | |
101 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
102 | 144 | | |
103 | 145 | | |
104 | 146 | | |
105 | 147 | | |
106 | 148 | | |
107 | 149 | | |
108 | 150 | | |
109 | | - | |
110 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
111 | 154 | | |
112 | 155 | | |
113 | 156 | | |
| |||
116 | 159 | | |
117 | 160 | | |
118 | 161 | | |
119 | | - | |
| 162 | + | |
120 | 163 | | |
121 | 164 | | |
122 | 165 | | |
123 | 166 | | |
| 167 | + | |
124 | 168 | | |
125 | 169 | | |
126 | 170 | | |
| |||
132 | 176 | | |
133 | 177 | | |
134 | 178 | | |
135 | | - | |
| 179 | + | |
136 | 180 | | |
137 | 181 | | |
138 | 182 | | |
139 | 183 | | |
| 184 | + | |
140 | 185 | | |
141 | 186 | | |
142 | 187 | | |
143 | 188 | | |
144 | 189 | | |
145 | 190 | | |
| 191 | + | |
146 | 192 | | |
147 | 193 | | |
148 | | - | |
149 | | - | |
| 194 | + | |
| 195 | + | |
150 | 196 | | |
151 | 197 | | |
152 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
| |||
0 commit comments