@reicek/neataptic-ts 0.1.25 → 0.1.26

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.
Files changed (210) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
  3. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  4. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  5. package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
  6. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  7. package/package.json +19 -13
  8. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  9. package/plans/README.md +24 -0
  10. package/plans/Roadmap.md +62 -40
  11. package/plans/analyze-trace-solid-split.plans.md +66 -0
  12. package/plans/architecture-solid-split.plans.md +9 -15
  13. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  14. package/plans/generate-docs-solid-split.plans.md +87 -0
  15. package/plans/methods-docs.plans.md +25 -1
  16. package/plans/methods-solid-split.plans.md +14 -14
  17. package/plans/neat-docs.plans.md +9 -1
  18. package/plans/neat-test-surface-repair.plans.md +1 -1
  19. package/plans/render-docs-html-solid-split.plans.md +68 -0
  20. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  21. package/plans/utils-docs.plans.md +6 -1
  22. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  23. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  24. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  25. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  26. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  27. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  28. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  29. package/scripts/assets/theme.css +80 -23
  30. package/scripts/copy-examples.ts +239 -0
  31. package/scripts/export-onnx.ts +223 -0
  32. package/scripts/generate-bench-tables.ts +378 -37
  33. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  34. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  35. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  36. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  37. package/scripts/generate-docs/generate-docs.ts +63 -0
  38. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  39. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  40. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  41. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  42. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  43. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  44. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  45. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  46. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  47. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  48. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  50. package/scripts/mermaid-cli.mjs +102 -22
  51. package/scripts/mermaid-cli.ts +736 -0
  52. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  53. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  54. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  55. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  56. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  57. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  58. package/scripts/render-docs-html.ts +23 -587
  59. package/scripts/run-docs.ts +238 -0
  60. package/scripts/write-dist-docs-pkg.ts +40 -0
  61. package/src/README.md +75 -75
  62. package/src/architecture/connection/README.md +5 -5
  63. package/src/architecture/layer/README.md +508 -508
  64. package/src/architecture/network/README.md +1458 -1458
  65. package/src/architecture/network/activate/README.md +694 -694
  66. package/src/architecture/network/bootstrap/README.md +77 -77
  67. package/src/architecture/network/connect/README.md +74 -74
  68. package/src/architecture/network/deterministic/README.md +135 -135
  69. package/src/architecture/network/evolve/README.md +364 -364
  70. package/src/architecture/network/gating/README.md +130 -130
  71. package/src/architecture/network/genetic/README.md +399 -399
  72. package/src/architecture/network/mutate/README.md +897 -897
  73. package/src/architecture/network/onnx/README.md +720 -720
  74. package/src/architecture/network/onnx/export/README.md +728 -728
  75. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  76. package/src/architecture/network/onnx/import/README.md +618 -618
  77. package/src/architecture/network/onnx/schema/README.md +32 -32
  78. package/src/architecture/network/prune/README.md +245 -245
  79. package/src/architecture/network/remove/README.md +135 -135
  80. package/src/architecture/network/runtime/README.md +106 -106
  81. package/src/architecture/network/serialize/README.md +542 -542
  82. package/src/architecture/network/slab/README.md +608 -608
  83. package/src/architecture/network/standalone/README.md +212 -212
  84. package/src/architecture/network/stats/README.md +84 -84
  85. package/src/architecture/network/topology/README.md +465 -465
  86. package/src/architecture/network/training/README.md +200 -200
  87. package/src/architecture/node/README.md +5 -5
  88. package/src/architecture/nodePool/README.md +14 -14
  89. package/src/methods/README.md +99 -99
  90. package/src/methods/activation/README.md +189 -189
  91. package/src/methods/cost/README.md +131 -131
  92. package/src/methods/rate/README.md +86 -86
  93. package/src/multithreading/README.md +77 -77
  94. package/src/multithreading/workers/browser/README.md +8 -8
  95. package/src/multithreading/workers/node/README.md +8 -8
  96. package/src/neat/README.md +148 -148
  97. package/src/neat/adaptive/README.md +120 -120
  98. package/src/neat/adaptive/acceptance/README.md +40 -40
  99. package/src/neat/adaptive/complexity/README.md +137 -137
  100. package/src/neat/adaptive/core/README.md +197 -197
  101. package/src/neat/adaptive/lineage/README.md +90 -90
  102. package/src/neat/adaptive/mutation/README.md +284 -284
  103. package/src/neat/compat/README.md +43 -43
  104. package/src/neat/compat/core/README.md +90 -90
  105. package/src/neat/diversity/README.md +35 -35
  106. package/src/neat/diversity/core/README.md +88 -88
  107. package/src/neat/evaluate/README.md +85 -85
  108. package/src/neat/evaluate/auto-distance/README.md +75 -75
  109. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  110. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  111. package/src/neat/evaluate/fitness/README.md +23 -23
  112. package/src/neat/evaluate/novelty/README.md +120 -120
  113. package/src/neat/evaluate/objectives/README.md +17 -17
  114. package/src/neat/evaluate/shared/README.md +94 -94
  115. package/src/neat/evolve/README.md +96 -96
  116. package/src/neat/evolve/adaptive/README.md +60 -60
  117. package/src/neat/evolve/objectives/README.md +63 -63
  118. package/src/neat/evolve/offspring/README.md +56 -56
  119. package/src/neat/evolve/population/README.md +171 -171
  120. package/src/neat/evolve/runtime/README.md +79 -79
  121. package/src/neat/evolve/speciation/README.md +74 -74
  122. package/src/neat/evolve/warnings/README.md +10 -10
  123. package/src/neat/export/README.md +114 -114
  124. package/src/neat/helpers/README.md +50 -50
  125. package/src/neat/init/README.md +9 -9
  126. package/src/neat/lineage/core/README.md +101 -101
  127. package/src/neat/multiobjective/category/README.md +74 -74
  128. package/src/neat/multiobjective/crowding/README.md +272 -272
  129. package/src/neat/multiobjective/dominance/README.md +171 -171
  130. package/src/neat/multiobjective/fronts/README.md +68 -68
  131. package/src/neat/multiobjective/metrics/README.md +43 -43
  132. package/src/neat/multiobjective/objectives/README.md +31 -31
  133. package/src/neat/multiobjective/shared/README.md +27 -27
  134. package/src/neat/mutation/README.md +97 -97
  135. package/src/neat/mutation/add-conn/README.md +115 -115
  136. package/src/neat/mutation/add-node/README.md +126 -126
  137. package/src/neat/mutation/flow/README.md +149 -149
  138. package/src/neat/mutation/repair/README.md +185 -185
  139. package/src/neat/mutation/select/README.md +117 -117
  140. package/src/neat/mutation/shared/README.md +32 -32
  141. package/src/neat/objectives/README.md +25 -25
  142. package/src/neat/objectives/core/README.md +67 -67
  143. package/src/neat/pruning/README.md +40 -40
  144. package/src/neat/pruning/core/README.md +171 -171
  145. package/src/neat/pruning/facade/README.md +32 -32
  146. package/src/neat/rng/README.md +104 -104
  147. package/src/neat/rng/core/README.md +137 -137
  148. package/src/neat/rng/facade/README.md +50 -50
  149. package/src/neat/selection/README.md +111 -111
  150. package/src/neat/selection/core/README.md +227 -227
  151. package/src/neat/selection/facade/README.md +61 -61
  152. package/src/neat/shared/README.md +163 -163
  153. package/src/neat/speciation/README.md +31 -31
  154. package/src/neat/speciation/threshold/README.md +35 -35
  155. package/src/neat/species/README.md +25 -25
  156. package/src/neat/species/core/README.md +20 -20
  157. package/src/neat/species/core/shared/README.md +18 -18
  158. package/src/neat/species/history/context/README.md +22 -22
  159. package/src/neat/telemetry/accessors/README.md +58 -58
  160. package/src/neat/telemetry/exports/README.md +233 -233
  161. package/src/neat/telemetry/facade/README.md +252 -252
  162. package/src/neat/telemetry/facade/archive/README.md +57 -57
  163. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  164. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  165. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  166. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  167. package/src/neat/telemetry/facade/species/README.md +27 -27
  168. package/src/neat/telemetry/metrics/README.md +696 -696
  169. package/src/neat/telemetry/recorder/README.md +57 -57
  170. package/src/neat/telemetry/types/README.md +32 -32
  171. package/src/neat/topology-intent/README.md +75 -75
  172. package/src/utils/README.md +193 -193
  173. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  174. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  175. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  176. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  177. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  178. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  179. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  180. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  181. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  182. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  183. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  184. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  185. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  186. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  187. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  189. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  190. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  191. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  192. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  193. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  194. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  195. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  196. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  197. package/test/examples/flappy_bird/environment/README.md +22 -22
  198. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  199. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  200. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  201. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  202. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  203. package/test/examples/flappy_bird/trainer/README.md +325 -325
  204. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  205. package/scripts/analyze-trace.ts +0 -590
  206. package/scripts/copy-examples.mjs +0 -114
  207. package/scripts/export-onnx.mjs +0 -86
  208. package/scripts/generate-bench-tables.mjs +0 -182
  209. package/scripts/generate-docs.ts +0 -2900
  210. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -2,57 +2,24 @@
2
2
 
3
3
  ## architecture/network/activate/network.activate.utils.types.ts
4
4
 
5
- ### INPUT_NODE_TYPE
6
-
7
- Node role label used by activation traversal for input neurons.
8
-
9
- ### OUTPUT_NODE_TYPE
10
-
11
- Node role label used by activation traversal for output neurons.
12
-
13
- ### NO_TRACE_FAST_SLAB_TRAINING_FLAG
14
-
15
- Training flag value used by no-trace fast slab eligibility checks.
16
-
17
- ### INITIAL_OUTPUT_WRITE_INDEX
18
-
19
- Initial write index used when collecting output activations.
20
-
21
- ### OUTPUT_WRITE_INDEX_INCREMENT
22
-
23
- Increment applied after writing one output activation value.
24
-
25
- ### UNDEFINED_INPUT_LENGTH_TEXT
26
-
27
- Fallback text for undefined input lengths when formatting validation errors.
28
-
29
- ### DEFAULT_MAX_ACTIVATION_DEPTH
30
-
31
- Default hard limit for recursive activation depth in raw activation mode.
5
+ ### ActivateRuntimeNetworkProps
32
6
 
33
- ### BATCH_INPUTS_COLLECTION_ERROR_MESSAGE
7
+ Runtime network view used by the object-graph activation pipeline.
34
8
 
35
- Error message used when batch activation receives a non-array container.
9
+ This intentionally describes the internal fields activation reads/writes
10
+ (training step, RNG, regularization knobs, and slab fast-path hooks).
36
11
 
37
12
  ### ActivationOutputBuffer
38
13
 
39
14
  Pooled activation output array type acquired from the shared activation array pool.
40
15
 
41
- ### NoTraceActivationContext
42
-
43
- Shared state used by no-trace activation orchestration and helpers.
44
-
45
- ### NoTraceNodeTraversalContext
46
-
47
- Shared state used for node traversal during no-trace activation.
48
-
49
- ### SingleNodeNoTraceActivationContext
16
+ ### ActivationStats
50
17
 
51
- Shared state used while activating one node during no-trace traversal.
18
+ Activation telemetry collected during a single activation pass.
52
19
 
53
- ### RawActivationContext
20
+ ### BATCH_INPUTS_COLLECTION_ERROR_MESSAGE
54
21
 
55
- Shared state used by raw activation orchestration.
22
+ Error message used when batch activation receives a non-array container.
56
23
 
57
24
  ### BatchActivationContext
58
25
 
@@ -62,12 +29,17 @@ Shared state used by batch activation orchestration.
62
29
 
63
30
  Shared state used while validating and activating one row in a batch.
64
31
 
65
- ### ActivateRuntimeNetworkProps
32
+ ### DEFAULT_MAX_ACTIVATION_DEPTH
66
33
 
67
- Runtime network view used by the object-graph activation pipeline.
34
+ Default hard limit for recursive activation depth in raw activation mode.
68
35
 
69
- This intentionally describes the internal fields activation reads/writes
70
- (training step, RNG, regularization knobs, and slab fast-path hooks).
36
+ ### INITIAL_OUTPUT_WRITE_INDEX
37
+
38
+ Initial write index used when collecting output activations.
39
+
40
+ ### INPUT_NODE_TYPE
41
+
42
+ Node role label used by activation traversal for input neurons.
71
43
 
72
44
  ### NetworkLayer
73
45
 
@@ -77,94 +49,65 @@ Layer container type used by the layered activation paths.
77
49
 
78
50
  Node collection type attached to a single network layer.
79
51
 
80
- ### WeightNoiseStats
52
+ ### NO_TRACE_FAST_SLAB_TRAINING_FLAG
81
53
 
82
- Weight-noise telemetry collected during a single activation pass.
54
+ Training flag value used by no-trace fast slab eligibility checks.
83
55
 
84
- ### ActivationStats
56
+ ### NoTraceActivationContext
85
57
 
86
- Activation telemetry collected during a single activation pass.
58
+ Shared state used by no-trace activation orchestration and helpers.
87
59
 
88
- ### WeightNoiseApplyResult
60
+ ### NoTraceNodeTraversalContext
89
61
 
90
- Marker returned by weight-noise application to drive safe restore logic.
62
+ Shared state used for node traversal during no-trace activation.
91
63
 
92
- ## architecture/network/activate/network.activate.utils.ts
64
+ ### OUTPUT_NODE_TYPE
93
65
 
94
- ### noTraceActivate
66
+ Node role label used by activation traversal for output neurons.
95
67
 
96
- ```ts
97
- noTraceActivate(
98
- input: number[],
99
- ): number[]
100
- ```
68
+ ### OUTPUT_WRITE_INDEX_INCREMENT
101
69
 
102
- Perform a forward pass without creating or updating training / gradient traces.
70
+ Increment applied after writing one output activation value.
103
71
 
104
- This is the most allocation‑sensitive activation path. Internally it will attempt
105
- to leverage a compact "fast slab" routine (an optimized, vectorized broadcast over
106
- contiguous activation buffers) when the Network instance indicates that such a path
107
- is currently valid. If that attempt fails (for instance because the slab is stale
108
- after a structural mutation) execution gracefully falls back to a node‑by‑node loop.
72
+ ### RawActivationContext
109
73
 
110
- Algorithm outline:
111
- 1. (Optional) Refresh cached topological order if the network enforces acyclicity
112
- and a structural change marked the order as dirty.
113
- 2. Validate the input dimensionality.
114
- 3. Try the fast slab path; if it throws, continue with the standard path.
115
- 4. Acquire a pooled output buffer sized to the number of output neurons.
116
- 5. Iterate all nodes in their internal order:
117
- - Input nodes: directly assign provided input values.
118
- - Hidden nodes: compute activation via Node.noTraceActivate (no bookkeeping).
119
- - Output nodes: compute activation and store it (in sequence) inside the
120
- pooled output buffer.
121
- 6. Copy the pooled buffer into a fresh array (detaches user from the pool) and
122
- release the pooled buffer back to the pool.
74
+ Shared state used by raw activation orchestration.
123
75
 
124
- Complexity considerations:
125
- - Time: O(N + E) where N = number of nodes, E = number of inbound edges processed
126
- inside each Node.noTraceActivate call (not explicit here but inside the node).
127
- - Space: O(O) transient (O = number of outputs) due to the pooled output buffer.
76
+ ### SingleNodeNoTraceActivationContext
128
77
 
129
- Parameters:
130
- - `this` - - Bound Network instance.
131
- - `input` - - Flat numeric vector whose length must equal network.input.
78
+ Shared state used while activating one node during no-trace traversal.
132
79
 
133
- Returns: Array of output neuron activations (length == network.output).
80
+ ### UNDEFINED_INPUT_LENGTH_TEXT
134
81
 
135
- Example:
82
+ Fallback text for undefined input lengths when formatting validation errors.
136
83
 
137
- const out = net.noTraceActivate([0.1, 0.2, 0.3]);
138
- console.log(out); // => e.g. [0.5123, 0.0441]
84
+ ### WeightNoiseApplyResult
139
85
 
140
- ### activateRaw
86
+ Marker returned by weight-noise application to drive safe restore logic.
87
+
88
+ ### WeightNoiseStats
89
+
90
+ Weight-noise telemetry collected during a single activation pass.
91
+
92
+ ## architecture/network/activate/network.activate.utils.ts
93
+
94
+ ### activate
141
95
 
142
96
  ```ts
143
- activateRaw(
97
+ activate(
144
98
  input: number[],
145
99
  training: boolean,
146
- maxActivationDepth: number,
147
100
  ): number[]
148
101
  ```
149
102
 
150
- Thin semantic alias to the network's main activation path.
151
-
152
- At present this simply forwards to {@link Network.activate}. The indirection is useful for:
153
- - Future differentiation between raw (immediate) activation and a mode that performs reuse /
154
- staged batching logic.
155
- - Providing a stable exported symbol for external tooling / instrumentation.
103
+ Execute the main activation routine and return plain numeric outputs.
156
104
 
157
105
  Parameters:
158
- - `this` - - Bound Network instance.
159
- - `input` - - Input vector (length == network.input).
160
- - `training` - - Whether to retain training traces / gradients (delegated downstream).
161
- - `maxActivationDepth` - - Guard against runaway recursion / cyclic activation attempts.
162
-
163
- Returns: Implementation-defined result of Network.activate (typically an output vector).
164
-
165
- Example:
106
+ - `this` - Bound network instance.
107
+ - `input` - Input values with length matching network input count.
108
+ - `training` - Whether training-time stochastic behavior is enabled.
166
109
 
167
- const y = net.activateRaw([0,1,0]);
110
+ Returns: Output activation values.
168
111
 
169
112
  ### activateBatch
170
113
 
@@ -196,23 +139,34 @@ Example:
196
139
  const batchOut = net.activateBatch([[0,0,1],[1,0,0],[0,1,0]]);
197
140
  console.log(batchOut.length); // 3 rows
198
141
 
199
- ### activate
142
+ ### activateRaw
200
143
 
201
144
  ```ts
202
- activate(
145
+ activateRaw(
203
146
  input: number[],
204
147
  training: boolean,
148
+ maxActivationDepth: number,
205
149
  ): number[]
206
150
  ```
207
151
 
208
- Execute the main activation routine and return plain numeric outputs.
152
+ Thin semantic alias to the network's main activation path.
153
+
154
+ At present this simply forwards to {@link Network.activate}. The indirection is useful for:
155
+ - Future differentiation between raw (immediate) activation and a mode that performs reuse /
156
+ staged batching logic.
157
+ - Providing a stable exported symbol for external tooling / instrumentation.
209
158
 
210
159
  Parameters:
211
- - `this` - Bound network instance.
212
- - `input` - Input values with length matching network input count.
213
- - `training` - Whether training-time stochastic behavior is enabled.
160
+ - `this` - - Bound Network instance.
161
+ - `input` - - Input vector (length == network.input).
162
+ - `training` - - Whether to retain training traces / gradients (delegated downstream).
163
+ - `maxActivationDepth` - - Guard against runaway recursion / cyclic activation attempts.
214
164
 
215
- Returns: Output activation values.
165
+ Returns: Implementation-defined result of Network.activate (typically an output vector).
166
+
167
+ Example:
168
+
169
+ const y = net.activateRaw([0,1,0]);
216
170
 
217
171
  ### gaussianRand
218
172
 
@@ -229,25 +183,68 @@ Parameters:
229
183
 
230
184
  Returns: Standard normal sample with mean 0 and variance 1.
231
185
 
186
+ ### noTraceActivate
187
+
188
+ ```ts
189
+ noTraceActivate(
190
+ input: number[],
191
+ ): number[]
192
+ ```
193
+
194
+ Perform a forward pass without creating or updating training / gradient traces.
195
+
196
+ This is the most allocation‑sensitive activation path. Internally it will attempt
197
+ to leverage a compact "fast slab" routine (an optimized, vectorized broadcast over
198
+ contiguous activation buffers) when the Network instance indicates that such a path
199
+ is currently valid. If that attempt fails (for instance because the slab is stale
200
+ after a structural mutation) execution gracefully falls back to a node‑by‑node loop.
201
+
202
+ Algorithm outline:
203
+ 1. (Optional) Refresh cached topological order if the network enforces acyclicity
204
+ and a structural change marked the order as dirty.
205
+ 2. Validate the input dimensionality.
206
+ 3. Try the fast slab path; if it throws, continue with the standard path.
207
+ 4. Acquire a pooled output buffer sized to the number of output neurons.
208
+ 5. Iterate all nodes in their internal order:
209
+ - Input nodes: directly assign provided input values.
210
+ - Hidden nodes: compute activation via Node.noTraceActivate (no bookkeeping).
211
+ - Output nodes: compute activation and store it (in sequence) inside the
212
+ pooled output buffer.
213
+ 6. Copy the pooled buffer into a fresh array (detaches user from the pool) and
214
+ release the pooled buffer back to the pool.
215
+
216
+ Complexity considerations:
217
+ - Time: O(N + E) where N = number of nodes, E = number of inbound edges processed
218
+ inside each Node.noTraceActivate call (not explicit here but inside the node).
219
+ - Space: O(O) transient (O = number of outputs) due to the pooled output buffer.
220
+
221
+ Parameters:
222
+ - `this` - - Bound Network instance.
223
+ - `input` - - Flat numeric vector whose length must equal network.input.
224
+
225
+ Returns: Array of output neuron activations (length == network.output).
226
+
227
+ Example:
228
+
229
+ const out = net.noTraceActivate([0.1, 0.2, 0.3]);
230
+ console.log(out); // => e.g. [0.5123, 0.0441]
231
+
232
232
  ## architecture/network/activate/network.activate.raw.utils.ts
233
233
 
234
- ### executeRawActivation
234
+ ### activateViaNetworkDelegate
235
235
 
236
236
  ```ts
237
- executeRawActivation(
237
+ activateViaNetworkDelegate(
238
238
  activationContext: RawActivationContext,
239
239
  ): number[]
240
240
  ```
241
241
 
242
- Execute raw activation through the network delegate using a compact orchestration flow.
243
-
244
- This helper keeps the exported activation method focused on context creation while this
245
- module owns the execution path and future branching behavior.
242
+ Delegate raw activation to the core network activation implementation.
246
243
 
247
244
  Parameters:
248
245
  - `activationContext` - - Shared raw activation state.
249
246
 
250
- Returns: Activation output vector from the network delegate.
247
+ Returns: Activation output vector.
251
248
 
252
249
  ### activateWithSelectedReusePath
253
250
 
@@ -264,37 +261,40 @@ Parameters:
264
261
 
265
262
  Returns: Activation output vector.
266
263
 
267
- ### activateViaNetworkDelegate
264
+ ### executeRawActivation
268
265
 
269
266
  ```ts
270
- activateViaNetworkDelegate(
267
+ executeRawActivation(
271
268
  activationContext: RawActivationContext,
272
269
  ): number[]
273
270
  ```
274
271
 
275
- Delegate raw activation to the core network activation implementation.
272
+ Execute raw activation through the network delegate using a compact orchestration flow.
273
+
274
+ This helper keeps the exported activation method focused on context creation while this
275
+ module owns the execution path and future branching behavior.
276
276
 
277
277
  Parameters:
278
278
  - `activationContext` - - Shared raw activation state.
279
279
 
280
- Returns: Activation output vector.
280
+ Returns: Activation output vector from the network delegate.
281
281
 
282
282
  ## architecture/network/activate/network.activate.core.utils.ts
283
283
 
284
- ### gaussianRand
284
+ ### acquireOutputBuffer
285
285
 
286
286
  ```ts
287
- gaussianRand(
288
- rng: () => number,
289
- ): number
287
+ acquireOutputBuffer(
288
+ outputSize: number,
289
+ ): ActivationArray
290
290
  ```
291
291
 
292
- Produce a normally distributed random sample using the Box-Muller transform.
292
+ Acquire a pooled activation output buffer for the current output width.
293
293
 
294
294
  Parameters:
295
- - `rng` - Pseudo-random source in the interval [0, 1).
295
+ - `outputSize` - Number of output slots.
296
296
 
297
- Returns: Standard normal sample with mean 0 and variance 1.
297
+ Returns: Mutable pooled output buffer.
298
298
 
299
299
  ### activate
300
300
 
@@ -314,215 +314,261 @@ Parameters:
314
314
 
315
315
  Returns: Output activation values.
316
316
 
317
- ### prepareTopologyForActivation
317
+ ### activateLayer
318
318
 
319
319
  ```ts
320
- prepareTopologyForActivation(
321
- runtimeNetwork: ActivateRuntimeNetworkProps,
322
- ): void
320
+ activateLayer(
321
+ currentLayer: default,
322
+ layerIndex: number,
323
+ inputVector: number[],
324
+ isTraining: boolean,
325
+ ): number[]
323
326
  ```
324
327
 
325
- Ensure topological order is refreshed before activation when acyclic mode requires it.
328
+ Activate one layer, routing input only for the first layer.
326
329
 
327
330
  Parameters:
328
- - `runtimeNetwork` - Runtime activation internals.
331
+ - `currentLayer` - Layer instance to activate.
332
+ - `layerIndex` - Layer index.
333
+ - `inputVector` - Network input vector.
334
+ - `isTraining` - Training-time flag.
329
335
 
330
- Returns: Nothing.
336
+ Returns: Layer activations.
331
337
 
332
- ### validateInputVector
338
+ ### activateLayeredNetworkWithDropout
333
339
 
334
340
  ```ts
335
- validateInputVector(
341
+ activateLayeredNetworkWithDropout(
336
342
  network: default,
343
+ runtimeNetwork: ActivateRuntimeNetworkProps,
337
344
  inputVector: number[],
345
+ isTraining: boolean,
346
+ outputBuffer: ActivationArray,
347
+ stats: ActivationStats,
338
348
  ): void
339
349
  ```
340
350
 
341
- Validate that the incoming input vector exists and matches expected input size.
351
+ Run layered activation with dropout masks and no stochastic-depth skips.
342
352
 
343
353
  Parameters:
344
354
  - `network` - Network being activated.
345
- - `inputVector` - Input vector to validate.
355
+ - `runtimeNetwork` - Runtime activation internals.
356
+ - `inputVector` - Input vector.
357
+ - `isTraining` - Training-time flag.
358
+ - `outputBuffer` - Mutable output buffer.
359
+ - `stats` - Activation stats accumulator.
346
360
 
347
361
  Returns: Nothing.
348
362
 
349
- ### tryFastSlabActivation
363
+ ### activateLayeredNetworkWithStochasticDepth
350
364
 
351
365
  ```ts
352
- tryFastSlabActivation(
366
+ activateLayeredNetworkWithStochasticDepth(
367
+ network: default,
353
368
  runtimeNetwork: ActivateRuntimeNetworkProps,
354
369
  inputVector: number[],
355
370
  isTraining: boolean,
356
- ): number[] | undefined
371
+ outputBuffer: ActivationArray,
372
+ stats: ActivationStats,
373
+ ): void
357
374
  ```
358
375
 
359
- Attempt fast slab activation and safely fall back to regular activation on failure.
376
+ Run layered activation with stochastic-depth skipping and inverse-survival scaling.
360
377
 
361
378
  Parameters:
379
+ - `network` - Network being activated.
362
380
  - `runtimeNetwork` - Runtime activation internals.
363
381
  - `inputVector` - Input vector.
364
382
  - `isTraining` - Training-time flag.
383
+ - `outputBuffer` - Mutable output buffer.
384
+ - `stats` - Activation stats accumulator.
365
385
 
366
- Returns: Fast slab output when available, otherwise undefined.
386
+ Returns: Nothing.
367
387
 
368
- ### acquireOutputBuffer
388
+ ### activateNodeNetworkFallback
369
389
 
370
390
  ```ts
371
- acquireOutputBuffer(
372
- outputSize: number,
373
- ): ActivationArray
391
+ activateNodeNetworkFallback(
392
+ network: default,
393
+ runtimeNetwork: ActivateRuntimeNetworkProps,
394
+ inputVector: number[],
395
+ isTraining: boolean,
396
+ outputBuffer: ActivationArray,
397
+ stats: ActivationStats,
398
+ ): void
374
399
  ```
375
400
 
376
- Acquire a pooled activation output buffer for the current output width.
401
+ Run fallback node-by-node activation for networks without explicit layer definitions.
377
402
 
378
403
  Parameters:
379
- - `outputSize` - Number of output slots.
404
+ - `network` - Network being activated.
405
+ - `runtimeNetwork` - Runtime activation internals.
406
+ - `inputVector` - Input vector.
407
+ - `isTraining` - Training-time flag.
408
+ - `outputBuffer` - Mutable output buffer.
409
+ - `stats` - Activation stats accumulator.
380
410
 
381
- Returns: Mutable pooled output buffer.
411
+ Returns: Nothing.
382
412
 
383
- ### validateNetworkNodes
413
+ ### activateNodesAndCollectOutputs
384
414
 
385
415
  ```ts
386
- validateNetworkNodes(
387
- network: default,
416
+ activateNodesAndCollectOutputs(
417
+ nodes: default[],
418
+ inputVector: number[],
419
+ outputBuffer: ActivationArray,
388
420
  ): void
389
421
  ```
390
422
 
391
- Assert that the network contains nodes before executing activation routines.
423
+ Activate raw nodes in order and collect output-node activations into output buffer.
392
424
 
393
425
  Parameters:
394
- - `network` - Network being activated.
426
+ - `nodes` - Network nodes in activation order.
427
+ - `inputVector` - Input vector.
428
+ - `outputBuffer` - Mutable output buffer.
395
429
 
396
430
  Returns: Nothing.
397
431
 
398
- ### resetSkippedLayers
432
+ ### applyDropConnect
399
433
 
400
434
  ```ts
401
- resetSkippedLayers(
435
+ applyDropConnect(
402
436
  network: default,
437
+ runtimeNetwork: ActivateRuntimeNetworkProps,
438
+ isTraining: boolean,
439
+ stats: ActivationStats,
403
440
  ): void
404
441
  ```
405
442
 
406
- Clear the runtime list of skipped layers before current activation pass.
443
+ Apply drop-connect masking and restore original weights where required.
407
444
 
408
445
  Parameters:
409
- - `network` - Network runtime owner.
446
+ - `network` - Network being activated.
447
+ - `runtimeNetwork` - Runtime activation internals.
448
+ - `isTraining` - Training-time flag.
449
+ - `stats` - Activation stats accumulator.
410
450
 
411
451
  Returns: Nothing.
412
452
 
413
- ### createActivationStats
453
+ ### applyFallbackHiddenDropout
414
454
 
415
455
  ```ts
416
- createActivationStats(
417
- totalConnections: number,
418
- ): ActivationStats
456
+ applyFallbackHiddenDropout(
457
+ hiddenNodes: default[],
458
+ runtimeNetwork: ActivateRuntimeNetworkProps,
459
+ dropoutProbability: number,
460
+ isTraining: boolean,
461
+ stats: ActivationStats,
462
+ ): void
419
463
  ```
420
464
 
421
- Create activation statistics container for the current pass.
465
+ Apply fallback dropout for hidden nodes in raw node traversal mode.
422
466
 
423
467
  Parameters:
424
- - `totalConnections` - Number of network connections.
425
-
426
- Returns: Initialized activation stats object.
427
-
428
- ### createWeightNoiseStats
429
-
430
- ```ts
431
- createWeightNoiseStats(): WeightNoiseStats
432
- ```
433
-
434
- Create the weight-noise statistics record with zeroed aggregates.
468
+ - `hiddenNodes` - Hidden nodes.
469
+ - `runtimeNetwork` - Runtime activation internals.
470
+ - `dropoutProbability` - Dropout probability.
471
+ - `isTraining` - Training-time flag.
472
+ - `stats` - Activation stats accumulator.
435
473
 
436
- Returns: Zero-initialized weight-noise stats.
474
+ Returns: Nothing.
437
475
 
438
- ### applyTrainingWeightNoise
476
+ ### applyFallbackWeightNoise
439
477
 
440
478
  ```ts
441
- applyTrainingWeightNoise(
479
+ applyFallbackWeightNoise(
442
480
  network: default,
443
481
  runtimeNetwork: ActivateRuntimeNetworkProps,
444
482
  isTraining: boolean,
445
- ): WeightNoiseApplyResult
483
+ ): void
446
484
  ```
447
485
 
448
- Apply per-connection training noise for the main activation flow.
486
+ Apply raw fallback weight noise to all connections using global standard deviation.
449
487
 
450
488
  Parameters:
451
489
  - `network` - Network being activated.
452
490
  - `runtimeNetwork` - Runtime activation internals.
453
491
  - `isTraining` - Training-time flag.
454
492
 
455
- Returns: Applied-state information for downstream restore logic.
493
+ Returns: Nothing.
456
494
 
457
- ### resolveDynamicWeightNoiseStd
495
+ ### applyHiddenLayerDropout
458
496
 
459
497
  ```ts
460
- resolveDynamicWeightNoiseStd(
498
+ applyHiddenLayerDropout(
499
+ layer: default,
500
+ rawActivations: number[],
461
501
  runtimeNetwork: ActivateRuntimeNetworkProps,
462
- ): number
502
+ dropoutProbability: number,
503
+ isTraining: boolean,
504
+ stats: ActivationStats,
505
+ ): void
463
506
  ```
464
507
 
465
- Resolve the training-step adjusted global weight-noise standard deviation.
508
+ Apply dropout masks to hidden layer nodes and enforce at least one active node.
466
509
 
467
510
  Parameters:
511
+ - `layer` - Hidden layer instance.
512
+ - `rawActivations` - Raw layer activations.
468
513
  - `runtimeNetwork` - Runtime activation internals.
514
+ - `dropoutProbability` - Layer dropout probability.
515
+ - `isTraining` - Training-time flag.
516
+ - `stats` - Activation stats accumulator.
469
517
 
470
- Returns: Effective weight-noise standard deviation for current training step.
518
+ Returns: Nothing.
471
519
 
472
- ### resolveConnectionNoiseStd
520
+ ### applyTrainingDropConnect
473
521
 
474
522
  ```ts
475
- resolveConnectionNoiseStd(
523
+ applyTrainingDropConnect(
476
524
  network: default,
477
525
  runtimeNetwork: ActivateRuntimeNetworkProps,
478
- connection: default,
479
- fallbackStandardDeviation: number,
480
- ): number
526
+ stats: ActivationStats,
527
+ ): void
481
528
  ```
482
529
 
483
- Resolve connection-specific weight-noise standard deviation, including per-hidden overrides.
530
+ Apply training-time drop-connect masks to each connection.
484
531
 
485
532
  Parameters:
486
533
  - `network` - Network being activated.
487
534
  - `runtimeNetwork` - Runtime activation internals.
488
- - `connection` - Current connection.
489
- - `fallbackStandardDeviation` - Global fallback deviation.
535
+ - `stats` - Activation stats accumulator.
490
536
 
491
- Returns: Effective standard deviation for this connection.
537
+ Returns: Nothing.
492
538
 
493
- ### findSourceLayerIndex
539
+ ### applyTrainingWeightNoise
494
540
 
495
541
  ```ts
496
- findSourceLayerIndex(
542
+ applyTrainingWeightNoise(
497
543
  network: default,
498
- connection: default,
499
- ): number
544
+ runtimeNetwork: ActivateRuntimeNetworkProps,
545
+ isTraining: boolean,
546
+ ): WeightNoiseApplyResult
500
547
  ```
501
548
 
502
- Find the layer index containing a connection source node.
549
+ Apply per-connection training noise for the main activation flow.
503
550
 
504
551
  Parameters:
505
552
  - `network` - Network being activated.
506
- - `connection` - Connection to inspect.
553
+ - `runtimeNetwork` - Runtime activation internals.
554
+ - `isTraining` - Training-time flag.
507
555
 
508
- Returns: Layer index for source node, or -1 when not found.
556
+ Returns: Applied-state information for downstream restore logic.
509
557
 
510
- ### updateStochasticDepthFromSchedule
558
+ ### collectHiddenNodes
511
559
 
512
560
  ```ts
513
- updateStochasticDepthFromSchedule(
514
- runtimeNetwork: ActivateRuntimeNetworkProps,
515
- isTraining: boolean,
516
- ): void
561
+ collectHiddenNodes(
562
+ nodes: default[],
563
+ ): default[]
517
564
  ```
518
565
 
519
- Update stochastic depth probabilities using a training schedule when valid.
566
+ Collect hidden nodes from a raw node list.
520
567
 
521
568
  Parameters:
522
- - `runtimeNetwork` - Runtime activation internals.
523
- - `isTraining` - Training-time flag.
569
+ - `nodes` - Network node collection.
524
570
 
525
- Returns: Nothing.
571
+ Returns: Hidden-only node list.
526
572
 
527
573
  ### containsInvalidProbability
528
574
 
@@ -539,67 +585,60 @@ Parameters:
539
585
 
540
586
  Returns: True when one or more probabilities are invalid.
541
587
 
542
- ### executeActivationPath
588
+ ### createActivationStats
543
589
 
544
590
  ```ts
545
- executeActivationPath(
546
- network: default,
547
- runtimeNetwork: ActivateRuntimeNetworkProps,
548
- inputVector: number[],
549
- isTraining: boolean,
550
- outputBuffer: ActivationArray,
551
- stats: ActivationStats,
552
- ): void
591
+ createActivationStats(
592
+ totalConnections: number,
593
+ ): ActivationStats
553
594
  ```
554
595
 
555
- Execute one of the three activation branches: stochastic layers, standard layers, or raw nodes.
596
+ Create activation statistics container for the current pass.
556
597
 
557
598
  Parameters:
558
- - `network` - Network being activated.
559
- - `runtimeNetwork` - Runtime activation internals.
560
- - `inputVector` - Input vector.
561
- - `isTraining` - Training-time flag.
562
- - `outputBuffer` - Mutable output buffer.
563
- - `stats` - Activation stats accumulator.
599
+ - `totalConnections` - Number of network connections.
564
600
 
565
- Returns: Nothing.
601
+ Returns: Initialized activation stats object.
566
602
 
567
- ### hasLayeredNetworkWithStochasticDepth
603
+ ### createWeightNoiseStats
568
604
 
569
605
  ```ts
570
- hasLayeredNetworkWithStochasticDepth(
571
- network: default,
572
- runtimeNetwork: ActivateRuntimeNetworkProps,
573
- ): boolean
606
+ createWeightNoiseStats(): WeightNoiseStats
574
607
  ```
575
608
 
576
- Check whether the network has layers and stochastic-depth configuration for layer skipping path.
609
+ Create the weight-noise statistics record with zeroed aggregates.
577
610
 
578
- Parameters:
579
- - `network` - Network being activated.
580
- - `runtimeNetwork` - Runtime activation internals.
581
-
582
- Returns: True when stochastic-depth layer path should run.
611
+ Returns: Zero-initialized weight-noise stats.
583
612
 
584
- ### hasLayeredNetwork
613
+ ### decideLayerSkip
585
614
 
586
615
  ```ts
587
- hasLayeredNetwork(
616
+ decideLayerSkip(
588
617
  network: default,
589
- ): boolean
618
+ runtimeNetwork: ActivateRuntimeNetworkProps,
619
+ currentLayerNodeCount: number,
620
+ layerIndex: number,
621
+ isTraining: boolean,
622
+ previousLayerActivations: number[] | undefined,
623
+ ): { shouldSkipLayer: boolean; surviveProbability: number; }
590
624
  ```
591
625
 
592
- Check whether the network has at least one explicit layer.
626
+ Decide whether a hidden layer should be skipped in stochastic-depth mode.
593
627
 
594
628
  Parameters:
595
629
  - `network` - Network being activated.
630
+ - `runtimeNetwork` - Runtime activation internals.
631
+ - `currentLayerNodeCount` - Number of nodes in current layer.
632
+ - `layerIndex` - Current layer index.
633
+ - `isTraining` - Training-time flag.
634
+ - `previousLayerActivations` - Last computed layer activations.
596
635
 
597
- Returns: True when layered activation path should run.
636
+ Returns: Skip decision and survival probability for the layer.
598
637
 
599
- ### activateLayeredNetworkWithStochasticDepth
638
+ ### executeActivationPath
600
639
 
601
640
  ```ts
602
- activateLayeredNetworkWithStochasticDepth(
641
+ executeActivationPath(
603
642
  network: default,
604
643
  runtimeNetwork: ActivateRuntimeNetworkProps,
605
644
  inputVector: number[],
@@ -609,7 +648,7 @@ activateLayeredNetworkWithStochasticDepth(
609
648
  ): void
610
649
  ```
611
650
 
612
- Run layered activation with stochastic-depth skipping and inverse-survival scaling.
651
+ Execute one of the three activation branches: stochastic layers, standard layers, or raw nodes.
613
652
 
614
653
  Parameters:
615
654
  - `network` - Network being activated.
@@ -621,457 +660,363 @@ Parameters:
621
660
 
622
661
  Returns: Nothing.
623
662
 
624
- ### decideLayerSkip
663
+ ### finalizeNodePathWeightNoiseRestore
625
664
 
626
665
  ```ts
627
- decideLayerSkip(
666
+ finalizeNodePathWeightNoiseRestore(
628
667
  network: default,
629
- runtimeNetwork: ActivateRuntimeNetworkProps,
630
- currentLayerNodeCount: number,
631
- layerIndex: number,
632
668
  isTraining: boolean,
633
- previousLayerActivations: number[] | undefined,
634
- ): { shouldSkipLayer: boolean; surviveProbability: number; }
669
+ appliedWeightNoise: boolean,
670
+ ): void
635
671
  ```
636
672
 
637
- Decide whether a hidden layer should be skipped in stochastic-depth mode.
673
+ Restore temporary weight-noise values for fallback node path only.
638
674
 
639
675
  Parameters:
640
676
  - `network` - Network being activated.
641
- - `runtimeNetwork` - Runtime activation internals.
642
- - `currentLayerNodeCount` - Number of nodes in current layer.
643
- - `layerIndex` - Current layer index.
644
677
  - `isTraining` - Training-time flag.
645
- - `previousLayerActivations` - Last computed layer activations.
646
-
647
- Returns: Skip decision and survival probability for the layer.
648
-
649
- ### isHiddenLayer
650
-
651
- ```ts
652
- isHiddenLayer(
653
- layerIndex: number,
654
- totalLayerCount: number,
655
- ): boolean
656
- ```
657
-
658
- Check whether a layer index refers to a hidden layer in a layered network.
659
-
660
- Parameters:
661
- - `layerIndex` - Current layer index.
662
- - `totalLayerCount` - Number of layers in the network.
663
-
664
- Returns: True when the layer is hidden.
665
-
666
- ### hasCompatibleSkipState
667
-
668
- ```ts
669
- hasCompatibleSkipState(
670
- previousLayerActivations: number[] | undefined,
671
- currentLayerNodeCount: number,
672
- ): boolean
673
- ```
674
-
675
- Validate whether previous activations can be reused as skip pass-through output.
676
-
677
- Parameters:
678
- - `previousLayerActivations` - Last computed layer activations.
679
- - `currentLayerNodeCount` - Current layer node count.
678
+ - `appliedWeightNoise` - Whether weight noise was applied during this pass.
680
679
 
681
- Returns: True when pass-through activations are compatible.
680
+ Returns: Nothing.
682
681
 
683
- ### activateLayer
682
+ ### finalizeTrainingStepAndStats
684
683
 
685
684
  ```ts
686
- activateLayer(
687
- currentLayer: default,
688
- layerIndex: number,
689
- inputVector: number[],
685
+ finalizeTrainingStepAndStats(
686
+ runtimeNetwork: ActivateRuntimeNetworkProps,
687
+ stats: ActivationStats,
690
688
  isTraining: boolean,
691
- ): number[]
689
+ ): void
692
690
  ```
693
691
 
694
- Activate one layer, routing input only for the first layer.
692
+ Finalize training counters and attach activation statistics to runtime state.
695
693
 
696
694
  Parameters:
697
- - `currentLayer` - Layer instance to activate.
698
- - `layerIndex` - Layer index.
699
- - `inputVector` - Network input vector.
695
+ - `runtimeNetwork` - Runtime activation internals.
696
+ - `stats` - Activation stats.
700
697
  - `isTraining` - Training-time flag.
701
698
 
702
- Returns: Layer activations.
699
+ Returns: Nothing.
703
700
 
704
- ### recordSkippedLayer
701
+ ### findSourceLayerIndex
705
702
 
706
703
  ```ts
707
- recordSkippedLayer(
704
+ findSourceLayerIndex(
708
705
  network: default,
709
- stats: ActivationStats,
710
- layerIndex: number,
711
- ): void
706
+ connection: default,
707
+ ): number
712
708
  ```
713
709
 
714
- Record a skipped layer in runtime and stats trackers.
710
+ Find the layer index containing a connection source node.
715
711
 
716
712
  Parameters:
717
713
  - `network` - Network being activated.
718
- - `stats` - Activation stats accumulator.
719
- - `layerIndex` - Skipped layer index.
714
+ - `connection` - Connection to inspect.
720
715
 
721
- Returns: Nothing.
716
+ Returns: Layer index for source node, or -1 when not found.
722
717
 
723
- ### scaleActivations
718
+ ### gaussianRand
724
719
 
725
720
  ```ts
726
- scaleActivations(
727
- activations: number[],
728
- scaleFactor: number,
729
- ): number[]
721
+ gaussianRand(
722
+ rng: () => number,
723
+ ): number
730
724
  ```
731
725
 
732
- Create a new activation vector by multiplying each activation by a scale factor.
726
+ Produce a normally distributed random sample using the Box-Muller transform.
733
727
 
734
728
  Parameters:
735
- - `activations` - Source activation vector.
736
- - `scaleFactor` - Multiplicative scale factor.
729
+ - `rng` - Pseudo-random source in the interval [0, 1).
737
730
 
738
- Returns: Scaled activation vector.
731
+ Returns: Standard normal sample with mean 0 and variance 1.
739
732
 
740
- ### writeLayerActivationsToOutput
733
+ ### hasCompatibleSkipState
741
734
 
742
735
  ```ts
743
- writeLayerActivationsToOutput(
744
- layerActivations: number[] | undefined,
745
- outputBuffer: ActivationArray,
746
- outputSize: number,
747
- ): void
736
+ hasCompatibleSkipState(
737
+ previousLayerActivations: number[] | undefined,
738
+ currentLayerNodeCount: number,
739
+ ): boolean
748
740
  ```
749
741
 
750
- Copy final layer activations into the pooled network output buffer.
742
+ Validate whether previous activations can be reused as skip pass-through output.
751
743
 
752
744
  Parameters:
753
- - `layerActivations` - Final layer activations.
754
- - `outputBuffer` - Mutable output buffer.
755
- - `outputSize` - Maximum output width.
745
+ - `previousLayerActivations` - Last computed layer activations.
746
+ - `currentLayerNodeCount` - Current layer node count.
756
747
 
757
- Returns: Nothing.
748
+ Returns: True when pass-through activations are compatible.
758
749
 
759
- ### activateLayeredNetworkWithDropout
750
+ ### hasLayeredNetwork
760
751
 
761
752
  ```ts
762
- activateLayeredNetworkWithDropout(
753
+ hasLayeredNetwork(
763
754
  network: default,
764
- runtimeNetwork: ActivateRuntimeNetworkProps,
765
- inputVector: number[],
766
- isTraining: boolean,
767
- outputBuffer: ActivationArray,
768
- stats: ActivationStats,
769
- ): void
755
+ ): boolean
770
756
  ```
771
757
 
772
- Run layered activation with dropout masks and no stochastic-depth skips.
758
+ Check whether the network has at least one explicit layer.
773
759
 
774
760
  Parameters:
775
761
  - `network` - Network being activated.
776
- - `runtimeNetwork` - Runtime activation internals.
777
- - `inputVector` - Input vector.
778
- - `isTraining` - Training-time flag.
779
- - `outputBuffer` - Mutable output buffer.
780
- - `stats` - Activation stats accumulator.
781
762
 
782
- Returns: Nothing.
763
+ Returns: True when layered activation path should run.
783
764
 
784
- ### applyHiddenLayerDropout
765
+ ### hasLayeredNetworkWithStochasticDepth
785
766
 
786
767
  ```ts
787
- applyHiddenLayerDropout(
788
- layer: default,
789
- rawActivations: number[],
768
+ hasLayeredNetworkWithStochasticDepth(
769
+ network: default,
790
770
  runtimeNetwork: ActivateRuntimeNetworkProps,
791
- dropoutProbability: number,
792
- isTraining: boolean,
793
- stats: ActivationStats,
794
- ): void
771
+ ): boolean
795
772
  ```
796
773
 
797
- Apply dropout masks to hidden layer nodes and enforce at least one active node.
774
+ Check whether the network has layers and stochastic-depth configuration for layer skipping path.
798
775
 
799
776
  Parameters:
800
- - `layer` - Hidden layer instance.
801
- - `rawActivations` - Raw layer activations.
777
+ - `network` - Network being activated.
802
778
  - `runtimeNetwork` - Runtime activation internals.
803
- - `dropoutProbability` - Layer dropout probability.
804
- - `isTraining` - Training-time flag.
805
- - `stats` - Activation stats accumulator.
806
779
 
807
- Returns: Nothing.
780
+ Returns: True when stochastic-depth layer path should run.
808
781
 
809
- ### setAllMasksToOne
782
+ ### hasOriginalWeightNoise
810
783
 
811
784
  ```ts
812
- setAllMasksToOne(
813
- nodes: default[],
814
- ): void
785
+ hasOriginalWeightNoise(
786
+ connection: default,
787
+ ): boolean
815
788
  ```
816
789
 
817
- Set mask value to one for every node in a layer.
790
+ Check whether a connection already has an original weight-noise snapshot.
818
791
 
819
792
  Parameters:
820
- - `nodes` - Layer nodes to normalize.
793
+ - `connection` - Connection to inspect.
821
794
 
822
- Returns: Nothing.
795
+ Returns: True when snapshot exists.
823
796
 
824
- ### activateNodeNetworkFallback
797
+ ### isHiddenLayer
825
798
 
826
799
  ```ts
827
- activateNodeNetworkFallback(
828
- network: default,
829
- runtimeNetwork: ActivateRuntimeNetworkProps,
830
- inputVector: number[],
831
- isTraining: boolean,
832
- outputBuffer: ActivationArray,
833
- stats: ActivationStats,
834
- ): void
800
+ isHiddenLayer(
801
+ layerIndex: number,
802
+ totalLayerCount: number,
803
+ ): boolean
835
804
  ```
836
805
 
837
- Run fallback node-by-node activation for networks without explicit layer definitions.
806
+ Check whether a layer index refers to a hidden layer in a layered network.
838
807
 
839
808
  Parameters:
840
- - `network` - Network being activated.
841
- - `runtimeNetwork` - Runtime activation internals.
842
- - `inputVector` - Input vector.
843
- - `isTraining` - Training-time flag.
844
- - `outputBuffer` - Mutable output buffer.
845
- - `stats` - Activation stats accumulator.
809
+ - `layerIndex` - Current layer index.
810
+ - `totalLayerCount` - Number of layers in the network.
846
811
 
847
- Returns: Nothing.
812
+ Returns: True when the layer is hidden.
848
813
 
849
- ### collectHiddenNodes
814
+ ### persistOriginalWeightNoise
850
815
 
851
816
  ```ts
852
- collectHiddenNodes(
853
- nodes: default[],
854
- ): default[]
817
+ persistOriginalWeightNoise(
818
+ connection: default,
819
+ ): void
855
820
  ```
856
821
 
857
- Collect hidden nodes from a raw node list.
822
+ Store current connection weight before applying temporary weight-noise modifications.
858
823
 
859
824
  Parameters:
860
- - `nodes` - Network node collection.
825
+ - `connection` - Connection to persist.
861
826
 
862
- Returns: Hidden-only node list.
827
+ Returns: Nothing.
863
828
 
864
- ### applyFallbackHiddenDropout
829
+ ### prepareTopologyForActivation
865
830
 
866
831
  ```ts
867
- applyFallbackHiddenDropout(
868
- hiddenNodes: default[],
832
+ prepareTopologyForActivation(
869
833
  runtimeNetwork: ActivateRuntimeNetworkProps,
870
- dropoutProbability: number,
871
- isTraining: boolean,
872
- stats: ActivationStats,
873
834
  ): void
874
835
  ```
875
836
 
876
- Apply fallback dropout for hidden nodes in raw node traversal mode.
837
+ Ensure topological order is refreshed before activation when acyclic mode requires it.
877
838
 
878
839
  Parameters:
879
- - `hiddenNodes` - Hidden nodes.
880
840
  - `runtimeNetwork` - Runtime activation internals.
881
- - `dropoutProbability` - Dropout probability.
882
- - `isTraining` - Training-time flag.
883
- - `stats` - Activation stats accumulator.
884
841
 
885
842
  Returns: Nothing.
886
843
 
887
- ### applyFallbackWeightNoise
844
+ ### recordSkippedLayer
888
845
 
889
846
  ```ts
890
- applyFallbackWeightNoise(
847
+ recordSkippedLayer(
891
848
  network: default,
892
- runtimeNetwork: ActivateRuntimeNetworkProps,
893
- isTraining: boolean,
849
+ stats: ActivationStats,
850
+ layerIndex: number,
894
851
  ): void
895
852
  ```
896
853
 
897
- Apply raw fallback weight noise to all connections using global standard deviation.
854
+ Record a skipped layer in runtime and stats trackers.
898
855
 
899
856
  Parameters:
900
857
  - `network` - Network being activated.
901
- - `runtimeNetwork` - Runtime activation internals.
902
- - `isTraining` - Training-time flag.
858
+ - `stats` - Activation stats accumulator.
859
+ - `layerIndex` - Skipped layer index.
903
860
 
904
861
  Returns: Nothing.
905
862
 
906
- ### activateNodesAndCollectOutputs
863
+ ### releaseBufferAndCreateResult
907
864
 
908
865
  ```ts
909
- activateNodesAndCollectOutputs(
910
- nodes: default[],
911
- inputVector: number[],
866
+ releaseBufferAndCreateResult(
912
867
  outputBuffer: ActivationArray,
913
- ): void
868
+ ): number[]
914
869
  ```
915
870
 
916
- Activate raw nodes in order and collect output-node activations into output buffer.
871
+ Release pooled output buffer and return a detached plain array copy.
917
872
 
918
873
  Parameters:
919
- - `nodes` - Network nodes in activation order.
920
- - `inputVector` - Input vector.
921
- - `outputBuffer` - Mutable output buffer.
874
+ - `outputBuffer` - Mutable pooled output buffer.
922
875
 
923
- Returns: Nothing.
876
+ Returns: Plain array of output values.
924
877
 
925
- ### applyDropConnect
878
+ ### resetSkippedLayers
926
879
 
927
880
  ```ts
928
- applyDropConnect(
881
+ resetSkippedLayers(
929
882
  network: default,
930
- runtimeNetwork: ActivateRuntimeNetworkProps,
931
- isTraining: boolean,
932
- stats: ActivationStats,
933
883
  ): void
934
884
  ```
935
885
 
936
- Apply drop-connect masking and restore original weights where required.
886
+ Clear the runtime list of skipped layers before current activation pass.
937
887
 
938
888
  Parameters:
939
- - `network` - Network being activated.
940
- - `runtimeNetwork` - Runtime activation internals.
941
- - `isTraining` - Training-time flag.
942
- - `stats` - Activation stats accumulator.
889
+ - `network` - Network runtime owner.
943
890
 
944
891
  Returns: Nothing.
945
892
 
946
- ### applyTrainingDropConnect
893
+ ### resolveConnectionNoiseStd
947
894
 
948
895
  ```ts
949
- applyTrainingDropConnect(
896
+ resolveConnectionNoiseStd(
950
897
  network: default,
951
898
  runtimeNetwork: ActivateRuntimeNetworkProps,
952
- stats: ActivationStats,
953
- ): void
899
+ connection: default,
900
+ fallbackStandardDeviation: number,
901
+ ): number
954
902
  ```
955
903
 
956
- Apply training-time drop-connect masks to each connection.
904
+ Resolve connection-specific weight-noise standard deviation, including per-hidden overrides.
957
905
 
958
906
  Parameters:
959
907
  - `network` - Network being activated.
960
908
  - `runtimeNetwork` - Runtime activation internals.
961
- - `stats` - Activation stats accumulator.
909
+ - `connection` - Current connection.
910
+ - `fallbackStandardDeviation` - Global fallback deviation.
962
911
 
963
- Returns: Nothing.
912
+ Returns: Effective standard deviation for this connection.
964
913
 
965
- ### restoreDropConnectWeights
914
+ ### resolveDynamicWeightNoiseStd
966
915
 
967
916
  ```ts
968
- restoreDropConnectWeights(
969
- network: default,
970
- ): void
917
+ resolveDynamicWeightNoiseStd(
918
+ runtimeNetwork: ActivateRuntimeNetworkProps,
919
+ ): number
971
920
  ```
972
921
 
973
- Restore drop-connect modified weights and normalize all masks back to one.
922
+ Resolve the training-step adjusted global weight-noise standard deviation.
974
923
 
975
924
  Parameters:
976
- - `network` - Network being activated.
925
+ - `runtimeNetwork` - Runtime activation internals.
977
926
 
978
- Returns: Nothing.
927
+ Returns: Effective weight-noise standard deviation for current training step.
979
928
 
980
- ### finalizeNodePathWeightNoiseRestore
929
+ ### restoreDropConnectWeights
981
930
 
982
931
  ```ts
983
- finalizeNodePathWeightNoiseRestore(
932
+ restoreDropConnectWeights(
984
933
  network: default,
985
- isTraining: boolean,
986
- appliedWeightNoise: boolean,
987
934
  ): void
988
935
  ```
989
936
 
990
- Restore temporary weight-noise values for fallback node path only.
937
+ Restore drop-connect modified weights and normalize all masks back to one.
991
938
 
992
939
  Parameters:
993
940
  - `network` - Network being activated.
994
- - `isTraining` - Training-time flag.
995
- - `appliedWeightNoise` - Whether weight noise was applied during this pass.
996
941
 
997
942
  Returns: Nothing.
998
943
 
999
- ### finalizeTrainingStepAndStats
944
+ ### restoreOriginalDropConnectWeight
1000
945
 
1001
946
  ```ts
1002
- finalizeTrainingStepAndStats(
1003
- runtimeNetwork: ActivateRuntimeNetworkProps,
1004
- stats: ActivationStats,
1005
- isTraining: boolean,
947
+ restoreOriginalDropConnectWeight(
948
+ connection: default,
1006
949
  ): void
1007
950
  ```
1008
951
 
1009
- Finalize training counters and attach activation statistics to runtime state.
1010
-
1011
- Parameters:
1012
- - `runtimeNetwork` - Runtime activation internals.
1013
- - `stats` - Activation stats.
1014
- - `isTraining` - Training-time flag.
952
+ Restore and clear original connection weight after drop-connect.
953
+
954
+ Parameters:
955
+ - `connection` - Connection to restore.
1015
956
 
1016
957
  Returns: Nothing.
1017
958
 
1018
- ### releaseBufferAndCreateResult
959
+ ### restoreOriginalWeightNoise
1019
960
 
1020
961
  ```ts
1021
- releaseBufferAndCreateResult(
1022
- outputBuffer: ActivationArray,
1023
- ): number[]
962
+ restoreOriginalWeightNoise(
963
+ connection: default,
964
+ ): void
1024
965
  ```
1025
966
 
1026
- Release pooled output buffer and return a detached plain array copy.
967
+ Restore and clear the original weight-noise snapshot for a connection.
1027
968
 
1028
969
  Parameters:
1029
- - `outputBuffer` - Mutable pooled output buffer.
970
+ - `connection` - Connection to restore.
1030
971
 
1031
- Returns: Plain array of output values.
972
+ Returns: Nothing.
1032
973
 
1033
- ### hasOriginalWeightNoise
974
+ ### scaleActivations
1034
975
 
1035
976
  ```ts
1036
- hasOriginalWeightNoise(
1037
- connection: default,
1038
- ): boolean
977
+ scaleActivations(
978
+ activations: number[],
979
+ scaleFactor: number,
980
+ ): number[]
1039
981
  ```
1040
982
 
1041
- Check whether a connection already has an original weight-noise snapshot.
983
+ Create a new activation vector by multiplying each activation by a scale factor.
1042
984
 
1043
985
  Parameters:
1044
- - `connection` - Connection to inspect.
986
+ - `activations` - Source activation vector.
987
+ - `scaleFactor` - Multiplicative scale factor.
1045
988
 
1046
- Returns: True when snapshot exists.
989
+ Returns: Scaled activation vector.
1047
990
 
1048
- ### persistOriginalWeightNoise
991
+ ### setAllMasksToOne
1049
992
 
1050
993
  ```ts
1051
- persistOriginalWeightNoise(
1052
- connection: default,
994
+ setAllMasksToOne(
995
+ nodes: default[],
1053
996
  ): void
1054
997
  ```
1055
998
 
1056
- Store current connection weight before applying temporary weight-noise modifications.
999
+ Set mask value to one for every node in a layer.
1057
1000
 
1058
1001
  Parameters:
1059
- - `connection` - Connection to persist.
1002
+ - `nodes` - Layer nodes to normalize.
1060
1003
 
1061
1004
  Returns: Nothing.
1062
1005
 
1063
- ### restoreOriginalWeightNoise
1006
+ ### setDropConnectMask
1064
1007
 
1065
1008
  ```ts
1066
- restoreOriginalWeightNoise(
1009
+ setDropConnectMask(
1067
1010
  connection: default,
1011
+ dropConnectMask: number,
1068
1012
  ): void
1069
1013
  ```
1070
1014
 
1071
- Restore and clear the original weight-noise snapshot for a connection.
1015
+ Set drop-connect mask value for a connection.
1072
1016
 
1073
1017
  Parameters:
1074
- - `connection` - Connection to restore.
1018
+ - `connection` - Connection to annotate.
1019
+ - `dropConnectMask` - Drop-connect mask value.
1075
1020
 
1076
1021
  Returns: Nothing.
1077
1022
 
@@ -1092,102 +1037,109 @@ Parameters:
1092
1037
 
1093
1038
  Returns: Nothing.
1094
1039
 
1095
- ### setDropConnectMask
1040
+ ### stashOriginalDropConnectWeight
1096
1041
 
1097
1042
  ```ts
1098
- setDropConnectMask(
1043
+ stashOriginalDropConnectWeight(
1099
1044
  connection: default,
1100
- dropConnectMask: number,
1101
1045
  ): void
1102
1046
  ```
1103
1047
 
1104
- Set drop-connect mask value for a connection.
1048
+ Store original connection weight before drop-connect zeroing.
1105
1049
 
1106
1050
  Parameters:
1107
- - `connection` - Connection to annotate.
1108
- - `dropConnectMask` - Drop-connect mask value.
1051
+ - `connection` - Connection to persist.
1109
1052
 
1110
1053
  Returns: Nothing.
1111
1054
 
1112
- ### stashOriginalDropConnectWeight
1055
+ ### tryFastSlabActivation
1113
1056
 
1114
1057
  ```ts
1115
- stashOriginalDropConnectWeight(
1116
- connection: default,
1117
- ): void
1058
+ tryFastSlabActivation(
1059
+ runtimeNetwork: ActivateRuntimeNetworkProps,
1060
+ inputVector: number[],
1061
+ isTraining: boolean,
1062
+ ): number[] | undefined
1118
1063
  ```
1119
1064
 
1120
- Store original connection weight before drop-connect zeroing.
1065
+ Attempt fast slab activation and safely fall back to regular activation on failure.
1121
1066
 
1122
1067
  Parameters:
1123
- - `connection` - Connection to persist.
1068
+ - `runtimeNetwork` - Runtime activation internals.
1069
+ - `inputVector` - Input vector.
1070
+ - `isTraining` - Training-time flag.
1124
1071
 
1125
- Returns: Nothing.
1072
+ Returns: Fast slab output when available, otherwise undefined.
1126
1073
 
1127
- ### restoreOriginalDropConnectWeight
1074
+ ### updateStochasticDepthFromSchedule
1128
1075
 
1129
1076
  ```ts
1130
- restoreOriginalDropConnectWeight(
1131
- connection: default,
1077
+ updateStochasticDepthFromSchedule(
1078
+ runtimeNetwork: ActivateRuntimeNetworkProps,
1079
+ isTraining: boolean,
1132
1080
  ): void
1133
1081
  ```
1134
1082
 
1135
- Restore and clear original connection weight after drop-connect.
1083
+ Update stochastic depth probabilities using a training schedule when valid.
1136
1084
 
1137
1085
  Parameters:
1138
- - `connection` - Connection to restore.
1086
+ - `runtimeNetwork` - Runtime activation internals.
1087
+ - `isTraining` - Training-time flag.
1139
1088
 
1140
1089
  Returns: Nothing.
1141
1090
 
1142
- ## architecture/network/activate/network.activate.batch.utils.ts
1143
-
1144
- ### executeBatchActivation
1091
+ ### validateInputVector
1145
1092
 
1146
1093
  ```ts
1147
- executeBatchActivation(
1148
- activationContext: BatchActivationContext,
1149
- ): number[][]
1094
+ validateInputVector(
1095
+ network: default,
1096
+ inputVector: number[],
1097
+ ): void
1150
1098
  ```
1151
1099
 
1152
- Execute mini-batch activation with top-level shape validation and per-row checks.
1153
-
1154
- The orchestration keeps behavior deterministic by validating the container first,
1155
- then validating each row before delegating to the core network activation function.
1100
+ Validate that the incoming input vector exists and matches expected input size.
1156
1101
 
1157
1102
  Parameters:
1158
- - `activationContext` - - Shared batch activation state.
1103
+ - `network` - Network being activated.
1104
+ - `inputVector` - Input vector to validate.
1159
1105
 
1160
- Returns: Matrix of activation outputs.
1106
+ Returns: Nothing.
1161
1107
 
1162
- ### assertBatchInputCollection
1108
+ ### validateNetworkNodes
1163
1109
 
1164
1110
  ```ts
1165
- assertBatchInputCollection(
1166
- batchInputs: number[][],
1111
+ validateNetworkNodes(
1112
+ network: default,
1167
1113
  ): void
1168
1114
  ```
1169
1115
 
1170
- Validate that the batch input collection is an array of rows.
1116
+ Assert that the network contains nodes before executing activation routines.
1171
1117
 
1172
1118
  Parameters:
1173
- - `batchInputs` - - Candidate batch input collection.
1119
+ - `network` - Network being activated.
1174
1120
 
1175
1121
  Returns: Nothing.
1176
1122
 
1177
- ### activateValidatedBatchRows
1123
+ ### writeLayerActivationsToOutput
1178
1124
 
1179
1125
  ```ts
1180
- activateValidatedBatchRows(
1181
- activationContext: BatchActivationContext,
1182
- ): number[][]
1126
+ writeLayerActivationsToOutput(
1127
+ layerActivations: number[] | undefined,
1128
+ outputBuffer: ActivationArray,
1129
+ outputSize: number,
1130
+ ): void
1183
1131
  ```
1184
1132
 
1185
- Activate each row in a validated batch matrix.
1133
+ Copy final layer activations into the pooled network output buffer.
1186
1134
 
1187
1135
  Parameters:
1188
- - `activationContext` - - Shared batch activation state.
1136
+ - `layerActivations` - Final layer activations.
1137
+ - `outputBuffer` - Mutable output buffer.
1138
+ - `outputSize` - Maximum output width.
1189
1139
 
1190
- Returns: Matrix of activation outputs.
1140
+ Returns: Nothing.
1141
+
1142
+ ## architecture/network/activate/network.activate.batch.utils.ts
1191
1143
 
1192
1144
  ### activateSingleBatchRow
1193
1145
 
@@ -1204,35 +1156,50 @@ Parameters:
1204
1156
 
1205
1157
  Returns: Activation output vector for the row.
1206
1158
 
1207
- ### assertBatchRowInputSize
1159
+ ### activateValidatedBatchRows
1208
1160
 
1209
1161
  ```ts
1210
- assertBatchRowInputSize(
1211
- rowActivationContext: BatchRowActivationContext,
1162
+ activateValidatedBatchRows(
1163
+ activationContext: BatchActivationContext,
1164
+ ): number[][]
1165
+ ```
1166
+
1167
+ Activate each row in a validated batch matrix.
1168
+
1169
+ Parameters:
1170
+ - `activationContext` - - Shared batch activation state.
1171
+
1172
+ Returns: Matrix of activation outputs.
1173
+
1174
+ ### assertBatchInputCollection
1175
+
1176
+ ```ts
1177
+ assertBatchInputCollection(
1178
+ batchInputs: number[][],
1212
1179
  ): void
1213
1180
  ```
1214
1181
 
1215
- Validate one batch row dimensionality.
1182
+ Validate that the batch input collection is an array of rows.
1216
1183
 
1217
1184
  Parameters:
1218
- - `rowActivationContext` - - Shared state for one batch-row activation.
1185
+ - `batchInputs` - - Candidate batch input collection.
1219
1186
 
1220
1187
  Returns: Nothing.
1221
1188
 
1222
- ### isBatchRowInputSizeValid
1189
+ ### assertBatchRowInputSize
1223
1190
 
1224
1191
  ```ts
1225
- isBatchRowInputSizeValid(
1192
+ assertBatchRowInputSize(
1226
1193
  rowActivationContext: BatchRowActivationContext,
1227
- ): boolean
1194
+ ): void
1228
1195
  ```
1229
1196
 
1230
- Determine whether one batch row matches the expected input dimensionality.
1197
+ Validate one batch row dimensionality.
1231
1198
 
1232
1199
  Parameters:
1233
1200
  - `rowActivationContext` - - Shared state for one batch-row activation.
1234
1201
 
1235
- Returns: True when row size is valid.
1202
+ Returns: Nothing.
1236
1203
 
1237
1204
  ### buildBatchRowInputSizeMismatchMessage
1238
1205
 
@@ -1249,76 +1216,74 @@ Parameters:
1249
1216
 
1250
1217
  Returns: Formatted error message for invalid row dimensionality.
1251
1218
 
1252
- ### formatInputLengthForMessage
1219
+ ### executeBatchActivation
1253
1220
 
1254
1221
  ```ts
1255
- formatInputLengthForMessage(
1256
- inputVector: number[],
1257
- ): string
1222
+ executeBatchActivation(
1223
+ activationContext: BatchActivationContext,
1224
+ ): number[][]
1258
1225
  ```
1259
1226
 
1260
- Convert input length into a display-safe string for error messaging.
1227
+ Execute mini-batch activation with top-level shape validation and per-row checks.
1261
1228
 
1262
- Parameters:
1263
- - `inputVector` - - Candidate batch row input vector.
1229
+ The orchestration keeps behavior deterministic by validating the container first,
1230
+ then validating each row before delegating to the core network activation function.
1264
1231
 
1265
- Returns: Numeric length as string or predefined undefined text.
1232
+ Parameters:
1233
+ - `activationContext` - - Shared batch activation state.
1266
1234
 
1267
- ## architecture/network/activate/network.activate.helpers.utils.ts
1235
+ Returns: Matrix of activation outputs.
1268
1236
 
1269
- ### executeNoTraceActivation
1237
+ ### formatInputLengthForMessage
1270
1238
 
1271
1239
  ```ts
1272
- executeNoTraceActivation(
1273
- activationContext: NoTraceActivationContext,
1274
- ): number[]
1240
+ formatInputLengthForMessage(
1241
+ inputVector: number[],
1242
+ ): string
1275
1243
  ```
1276
1244
 
1277
- Execute no-trace activation with a fast-path attempt and deterministic fallback traversal.
1278
-
1279
- The orchestration follows a strict sequence: refresh order guarantees, validate input shape,
1280
- try fast slab inference, then compute outputs through node traversal when needed.
1245
+ Convert input length into a display-safe string for error messaging.
1281
1246
 
1282
1247
  Parameters:
1283
- - `activationContext` - - Shared no-trace activation state.
1248
+ - `inputVector` - - Candidate batch row input vector.
1284
1249
 
1285
- Returns: Output activation vector detached from pooled storage.
1250
+ Returns: Numeric length as string or predefined undefined text.
1286
1251
 
1287
- ### executeRawActivation
1252
+ ### isBatchRowInputSizeValid
1288
1253
 
1289
1254
  ```ts
1290
- executeRawActivation(
1291
- activationContext: RawActivationContext,
1292
- ): number[]
1255
+ isBatchRowInputSizeValid(
1256
+ rowActivationContext: BatchRowActivationContext,
1257
+ ): boolean
1293
1258
  ```
1294
1259
 
1295
- Execute raw activation through the network delegate using a compact orchestration flow.
1296
-
1297
- This helper keeps the exported activation method focused on context creation while this
1298
- module owns the execution path and future branching behavior.
1260
+ Determine whether one batch row matches the expected input dimensionality.
1299
1261
 
1300
1262
  Parameters:
1301
- - `activationContext` - - Shared raw activation state.
1263
+ - `rowActivationContext` - - Shared state for one batch-row activation.
1302
1264
 
1303
- Returns: Activation output vector from the network delegate.
1265
+ Returns: True when row size is valid.
1304
1266
 
1305
- ### executeBatchActivation
1267
+ ## architecture/network/activate/network.activate.helpers.utils.ts
1268
+
1269
+ ### createBatchActivationContext
1306
1270
 
1307
1271
  ```ts
1308
- executeBatchActivation(
1309
- activationContext: BatchActivationContext,
1310
- ): number[][]
1272
+ createBatchActivationContext(
1273
+ network: default,
1274
+ batchInputs: number[][],
1275
+ isTraining: boolean,
1276
+ ): BatchActivationContext
1311
1277
  ```
1312
1278
 
1313
- Execute mini-batch activation with top-level shape validation and per-row checks.
1314
-
1315
- The orchestration keeps behavior deterministic by validating the container first,
1316
- then validating each row before delegating to the core network activation function.
1279
+ Build shared batch activation context for helper orchestration.
1317
1280
 
1318
1281
  Parameters:
1319
- - `activationContext` - - Shared batch activation state.
1282
+ - `network` - - Network instance bound to the activation call.
1283
+ - `batchInputs` - - Input matrix supplied by the caller.
1284
+ - `isTraining` - - Whether activation should retain training traces.
1320
1285
 
1321
- Returns: Matrix of activation outputs.
1286
+ Returns: Fully populated batch activation context.
1322
1287
 
1323
1288
  ### createNoTraceActivationContext
1324
1289
 
@@ -1358,26 +1323,23 @@ Parameters:
1358
1323
 
1359
1324
  Returns: Fully populated raw activation context.
1360
1325
 
1361
- ### createBatchActivationContext
1326
+ ### executeBatchActivation
1362
1327
 
1363
1328
  ```ts
1364
- createBatchActivationContext(
1365
- network: default,
1366
- batchInputs: number[][],
1367
- isTraining: boolean,
1368
- ): BatchActivationContext
1329
+ executeBatchActivation(
1330
+ activationContext: BatchActivationContext,
1331
+ ): number[][]
1369
1332
  ```
1370
1333
 
1371
- Build shared batch activation context for helper orchestration.
1334
+ Execute mini-batch activation with top-level shape validation and per-row checks.
1372
1335
 
1373
- Parameters:
1374
- - `network` - - Network instance bound to the activation call.
1375
- - `batchInputs` - - Input matrix supplied by the caller.
1376
- - `isTraining` - - Whether activation should retain training traces.
1336
+ The orchestration keeps behavior deterministic by validating the container first,
1337
+ then validating each row before delegating to the core network activation function.
1377
1338
 
1378
- Returns: Fully populated batch activation context.
1339
+ Parameters:
1340
+ - `activationContext` - - Shared batch activation state.
1379
1341
 
1380
- ## architecture/network/activate/network.activate.notrace.utils.ts
1342
+ Returns: Matrix of activation outputs.
1381
1343
 
1382
1344
  ### executeNoTraceActivation
1383
1345
 
@@ -1397,20 +1359,40 @@ Parameters:
1397
1359
 
1398
1360
  Returns: Output activation vector detached from pooled storage.
1399
1361
 
1400
- ### refreshTopologicalOrderWhenRequired
1362
+ ### executeRawActivation
1401
1363
 
1402
1364
  ```ts
1403
- refreshTopologicalOrderWhenRequired(
1365
+ executeRawActivation(
1366
+ activationContext: RawActivationContext,
1367
+ ): number[]
1368
+ ```
1369
+
1370
+ Execute raw activation through the network delegate using a compact orchestration flow.
1371
+
1372
+ This helper keeps the exported activation method focused on context creation while this
1373
+ module owns the execution path and future branching behavior.
1374
+
1375
+ Parameters:
1376
+ - `activationContext` - - Shared raw activation state.
1377
+
1378
+ Returns: Activation output vector from the network delegate.
1379
+
1380
+ ## architecture/network/activate/network.activate.notrace.utils.ts
1381
+
1382
+ ### activateWithoutTraceUsingNodeIteration
1383
+
1384
+ ```ts
1385
+ activateWithoutTraceUsingNodeIteration(
1404
1386
  activationContext: NoTraceActivationContext,
1405
- ): void
1387
+ ): number[]
1406
1388
  ```
1407
1389
 
1408
- Refresh cached topological order when acyclic mode is active and marked dirty.
1390
+ Execute no-trace activation through node traversal and pooled output collection.
1409
1391
 
1410
1392
  Parameters:
1411
1393
  - `activationContext` - - Shared no-trace activation state.
1412
1394
 
1413
- Returns: Nothing.
1395
+ Returns: Detached output activation vector.
1414
1396
 
1415
1397
  ### assertInputMatchesNetworkInputSize
1416
1398
 
@@ -1427,35 +1409,68 @@ Parameters:
1427
1409
 
1428
1410
  Returns: Nothing.
1429
1411
 
1430
- ### isInputVectorLengthValid
1412
+ ### buildInputSizeMismatchMessage
1431
1413
 
1432
1414
  ```ts
1433
- isInputVectorLengthValid(
1415
+ buildInputSizeMismatchMessage(
1416
+ activationContext: NoTraceActivationContext,
1417
+ ): string
1418
+ ```
1419
+
1420
+ Build a descriptive input mismatch message for activation validation errors.
1421
+
1422
+ Parameters:
1423
+ - `activationContext` - - Shared no-trace activation state.
1424
+
1425
+ Returns: Formatted mismatch error message.
1426
+
1427
+ ### canUseNoTraceFastSlab
1428
+
1429
+ ```ts
1430
+ canUseNoTraceFastSlab(
1434
1431
  activationContext: NoTraceActivationContext,
1435
1432
  ): boolean
1436
1433
  ```
1437
1434
 
1438
- Check whether the input vector has a valid length for activation.
1435
+ Determine whether fast slab activation is available for no-trace execution mode.
1439
1436
 
1440
1437
  Parameters:
1441
1438
  - `activationContext` - - Shared no-trace activation state.
1442
1439
 
1443
- Returns: True when the input vector is an array with expected length.
1440
+ Returns: True when slab execution is available for inference mode.
1444
1441
 
1445
- ### buildInputSizeMismatchMessage
1442
+ ### detachPooledOutputBuffer
1446
1443
 
1447
1444
  ```ts
1448
- buildInputSizeMismatchMessage(
1445
+ detachPooledOutputBuffer(
1446
+ pooledOutputBuffer: ActivationArray,
1447
+ ): number[]
1448
+ ```
1449
+
1450
+ Clone pooled output storage into a detached plain array.
1451
+
1452
+ Parameters:
1453
+ - `pooledOutputBuffer` - - Pooled activation output storage.
1454
+
1455
+ Returns: Detached output activation vector.
1456
+
1457
+ ### executeNoTraceActivation
1458
+
1459
+ ```ts
1460
+ executeNoTraceActivation(
1449
1461
  activationContext: NoTraceActivationContext,
1450
- ): string
1462
+ ): number[]
1451
1463
  ```
1452
1464
 
1453
- Build a descriptive input mismatch message for activation validation errors.
1465
+ Execute no-trace activation with a fast-path attempt and deterministic fallback traversal.
1466
+
1467
+ The orchestration follows a strict sequence: refresh order guarantees, validate input shape,
1468
+ try fast slab inference, then compute outputs through node traversal when needed.
1454
1469
 
1455
1470
  Parameters:
1456
1471
  - `activationContext` - - Shared no-trace activation state.
1457
1472
 
1458
- Returns: Formatted mismatch error message.
1473
+ Returns: Output activation vector detached from pooled storage.
1459
1474
 
1460
1475
  ### formatInputLengthForMessage
1461
1476
 
@@ -1472,67 +1487,71 @@ Parameters:
1472
1487
 
1473
1488
  Returns: Numeric length as string or predefined undefined text.
1474
1489
 
1475
- ### tryActivateWithFastSlab
1490
+ ### isInputVectorLengthValid
1476
1491
 
1477
1492
  ```ts
1478
- tryActivateWithFastSlab(
1493
+ isInputVectorLengthValid(
1479
1494
  activationContext: NoTraceActivationContext,
1480
- ): number[] | null
1495
+ ): boolean
1481
1496
  ```
1482
1497
 
1483
- Attempt fast slab activation and return null when slab execution is unavailable or fails.
1498
+ Check whether the input vector has a valid length for activation.
1484
1499
 
1485
1500
  Parameters:
1486
1501
  - `activationContext` - - Shared no-trace activation state.
1487
1502
 
1488
- Returns: Fast slab output when successful, otherwise null.
1503
+ Returns: True when the input vector is an array with expected length.
1489
1504
 
1490
- ### canUseNoTraceFastSlab
1505
+ ### refreshTopologicalOrderWhenRequired
1491
1506
 
1492
1507
  ```ts
1493
- canUseNoTraceFastSlab(
1508
+ refreshTopologicalOrderWhenRequired(
1494
1509
  activationContext: NoTraceActivationContext,
1495
- ): boolean
1510
+ ): void
1496
1511
  ```
1497
1512
 
1498
- Determine whether fast slab activation is available for no-trace execution mode.
1513
+ Refresh cached topological order when acyclic mode is active and marked dirty.
1499
1514
 
1500
1515
  Parameters:
1501
1516
  - `activationContext` - - Shared no-trace activation state.
1502
1517
 
1503
- Returns: True when slab execution is available for inference mode.
1518
+ Returns: Nothing.
1504
1519
 
1505
- ### activateWithoutTraceUsingNodeIteration
1520
+ ### tryActivateWithFastSlab
1506
1521
 
1507
1522
  ```ts
1508
- activateWithoutTraceUsingNodeIteration(
1523
+ tryActivateWithFastSlab(
1509
1524
  activationContext: NoTraceActivationContext,
1510
- ): number[]
1525
+ ): number[] | null
1511
1526
  ```
1512
1527
 
1513
- Execute no-trace activation through node traversal and pooled output collection.
1528
+ Attempt fast slab activation and return null when slab execution is unavailable or fails.
1514
1529
 
1515
1530
  Parameters:
1516
1531
  - `activationContext` - - Shared no-trace activation state.
1517
1532
 
1518
- Returns: Detached output activation vector.
1533
+ Returns: Fast slab output when successful, otherwise null.
1519
1534
 
1520
- ### detachPooledOutputBuffer
1535
+ ## architecture/network/activate/network.activate.contexts.utils.ts
1536
+
1537
+ ### createBatchActivationContext
1521
1538
 
1522
1539
  ```ts
1523
- detachPooledOutputBuffer(
1524
- pooledOutputBuffer: ActivationArray,
1525
- ): number[]
1540
+ createBatchActivationContext(
1541
+ network: default,
1542
+ batchInputs: number[][],
1543
+ isTraining: boolean,
1544
+ ): BatchActivationContext
1526
1545
  ```
1527
1546
 
1528
- Clone pooled output storage into a detached plain array.
1547
+ Build shared batch activation context for helper orchestration.
1529
1548
 
1530
1549
  Parameters:
1531
- - `pooledOutputBuffer` - - Pooled activation output storage.
1532
-
1533
- Returns: Detached output activation vector.
1550
+ - `network` - - Network instance bound to the activation call.
1551
+ - `batchInputs` - - Input matrix supplied by the caller.
1552
+ - `isTraining` - - Whether activation should retain training traces.
1534
1553
 
1535
- ## architecture/network/activate/network.activate.contexts.utils.ts
1554
+ Returns: Fully populated batch activation context.
1536
1555
 
1537
1556
  ### createNoTraceActivationContext
1538
1557
 
@@ -1572,25 +1591,6 @@ Parameters:
1572
1591
 
1573
1592
  Returns: Fully populated raw activation context.
1574
1593
 
1575
- ### createBatchActivationContext
1576
-
1577
- ```ts
1578
- createBatchActivationContext(
1579
- network: default,
1580
- batchInputs: number[][],
1581
- isTraining: boolean,
1582
- ): BatchActivationContext
1583
- ```
1584
-
1585
- Build shared batch activation context for helper orchestration.
1586
-
1587
- Parameters:
1588
- - `network` - - Network instance bound to the activation call.
1589
- - `batchInputs` - - Input matrix supplied by the caller.
1590
- - `isTraining` - - Whether activation should retain training traces.
1591
-
1592
- Returns: Fully populated batch activation context.
1593
-
1594
1594
  ### toNetworkInternals
1595
1595
 
1596
1596
  ```ts
@@ -1608,24 +1608,51 @@ Returns: Network internals view used by activation helper modules.
1608
1608
 
1609
1609
  ## architecture/network/activate/network.activate.notrace.traversal.utils.ts
1610
1610
 
1611
- ### populatePooledOutputBufferFromNodes
1611
+ ### activateHiddenNode
1612
1612
 
1613
1613
  ```ts
1614
- populatePooledOutputBufferFromNodes(
1615
- traversalContext: NoTraceNodeTraversalContext,
1614
+ activateHiddenNode(
1615
+ networkNode: default,
1616
1616
  ): void
1617
1617
  ```
1618
1618
 
1619
- Traverse nodes in activation order and write output activations into pooled storage.
1619
+ Activate a hidden node without trace bookkeeping.
1620
1620
 
1621
- This helper isolates traversal concerns from no-trace orchestration so the main flow
1622
- can remain focused on high-level activation phases.
1621
+ Parameters:
1622
+ - `networkNode` - - Hidden-role node to activate.
1623
+
1624
+ Returns: Nothing.
1625
+
1626
+ ### activateInputNode
1627
+
1628
+ ```ts
1629
+ activateInputNode(
1630
+ activationContext: SingleNodeNoTraceActivationContext,
1631
+ ): void
1632
+ ```
1633
+
1634
+ Activate an input node using the matching input vector value.
1623
1635
 
1624
1636
  Parameters:
1625
- - `traversalContext` - - Inputs required to process each node and collect outputs.
1637
+ - `activationContext` - - Node-specific activation state.
1626
1638
 
1627
1639
  Returns: Nothing.
1628
1640
 
1641
+ ### activateOutputNodeAndAdvanceIndex
1642
+
1643
+ ```ts
1644
+ activateOutputNodeAndAdvanceIndex(
1645
+ activationContext: SingleNodeNoTraceActivationContext,
1646
+ ): number
1647
+ ```
1648
+
1649
+ Activate an output node, write the activation value, and advance the output index.
1650
+
1651
+ Parameters:
1652
+ - `activationContext` - - Node-specific activation state.
1653
+
1654
+ Returns: Next output write index.
1655
+
1629
1656
  ### activateSingleNodeWithoutTrace
1630
1657
 
1631
1658
  ```ts
@@ -1671,47 +1698,20 @@ Parameters:
1671
1698
 
1672
1699
  Returns: True when node role is output.
1673
1700
 
1674
- ### activateInputNode
1701
+ ### populatePooledOutputBufferFromNodes
1675
1702
 
1676
1703
  ```ts
1677
- activateInputNode(
1678
- activationContext: SingleNodeNoTraceActivationContext,
1704
+ populatePooledOutputBufferFromNodes(
1705
+ traversalContext: NoTraceNodeTraversalContext,
1679
1706
  ): void
1680
1707
  ```
1681
1708
 
1682
- Activate an input node using the matching input vector value.
1683
-
1684
- Parameters:
1685
- - `activationContext` - - Node-specific activation state.
1686
-
1687
- Returns: Nothing.
1688
-
1689
- ### activateOutputNodeAndAdvanceIndex
1690
-
1691
- ```ts
1692
- activateOutputNodeAndAdvanceIndex(
1693
- activationContext: SingleNodeNoTraceActivationContext,
1694
- ): number
1695
- ```
1696
-
1697
- Activate an output node, write the activation value, and advance the output index.
1698
-
1699
- Parameters:
1700
- - `activationContext` - - Node-specific activation state.
1701
-
1702
- Returns: Next output write index.
1703
-
1704
- ### activateHiddenNode
1705
-
1706
- ```ts
1707
- activateHiddenNode(
1708
- networkNode: default,
1709
- ): void
1710
- ```
1709
+ Traverse nodes in activation order and write output activations into pooled storage.
1711
1710
 
1712
- Activate a hidden node without trace bookkeeping.
1711
+ This helper isolates traversal concerns from no-trace orchestration so the main flow
1712
+ can remain focused on high-level activation phases.
1713
1713
 
1714
1714
  Parameters:
1715
- - `networkNode` - - Hidden-role node to activate.
1715
+ - `traversalContext` - - Inputs required to process each node and collect outputs.
1716
1716
 
1717
1717
  Returns: Nothing.