@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.
- package/.github/copilot-instructions.md +11 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
- package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/package.json +19 -13
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
- package/plans/README.md +24 -0
- package/plans/Roadmap.md +62 -40
- package/plans/analyze-trace-solid-split.plans.md +66 -0
- package/plans/architecture-solid-split.plans.md +9 -15
- package/plans/asciiMaze-typescript-repair.plans.md +1 -1
- package/plans/generate-docs-solid-split.plans.md +87 -0
- package/plans/methods-docs.plans.md +25 -1
- package/plans/methods-solid-split.plans.md +14 -14
- package/plans/neat-docs.plans.md +9 -1
- package/plans/neat-test-surface-repair.plans.md +1 -1
- package/plans/render-docs-html-solid-split.plans.md +68 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
- package/plans/utils-docs.plans.md +6 -1
- package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
- package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
- package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
- package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
- package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
- package/scripts/analyze-trace/analyze-trace.ts +45 -0
- package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
- package/scripts/assets/theme.css +80 -23
- package/scripts/copy-examples.ts +239 -0
- package/scripts/export-onnx.ts +223 -0
- package/scripts/generate-bench-tables.ts +378 -37
- package/scripts/generate-docs/generate-docs.constants.ts +107 -0
- package/scripts/generate-docs/generate-docs.order.ts +355 -0
- package/scripts/generate-docs/generate-docs.state.ts +31 -0
- package/scripts/generate-docs/generate-docs.targets.ts +165 -0
- package/scripts/generate-docs/generate-docs.ts +63 -0
- package/scripts/generate-docs/generate-docs.types.ts +112 -0
- package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
- package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
- package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
- package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
- package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
- package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
- package/scripts/mermaid-cli.mjs +102 -22
- package/scripts/mermaid-cli.ts +736 -0
- package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
- package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
- package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
- package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
- package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
- package/scripts/render-docs-html.ts +23 -587
- package/scripts/run-docs.ts +238 -0
- package/scripts/write-dist-docs-pkg.ts +40 -0
- package/src/README.md +75 -75
- package/src/architecture/connection/README.md +5 -5
- package/src/architecture/layer/README.md +508 -508
- package/src/architecture/network/README.md +1458 -1458
- package/src/architecture/network/activate/README.md +694 -694
- package/src/architecture/network/bootstrap/README.md +77 -77
- package/src/architecture/network/connect/README.md +74 -74
- package/src/architecture/network/deterministic/README.md +135 -135
- package/src/architecture/network/evolve/README.md +364 -364
- package/src/architecture/network/gating/README.md +130 -130
- package/src/architecture/network/genetic/README.md +399 -399
- package/src/architecture/network/mutate/README.md +897 -897
- package/src/architecture/network/onnx/README.md +720 -720
- package/src/architecture/network/onnx/export/README.md +728 -728
- package/src/architecture/network/onnx/export/layers/README.md +450 -450
- package/src/architecture/network/onnx/import/README.md +618 -618
- package/src/architecture/network/onnx/schema/README.md +32 -32
- package/src/architecture/network/prune/README.md +245 -245
- package/src/architecture/network/remove/README.md +135 -135
- package/src/architecture/network/runtime/README.md +106 -106
- package/src/architecture/network/serialize/README.md +542 -542
- package/src/architecture/network/slab/README.md +608 -608
- package/src/architecture/network/standalone/README.md +212 -212
- package/src/architecture/network/stats/README.md +84 -84
- package/src/architecture/network/topology/README.md +465 -465
- package/src/architecture/network/training/README.md +200 -200
- package/src/architecture/node/README.md +5 -5
- package/src/architecture/nodePool/README.md +14 -14
- package/src/methods/README.md +99 -99
- package/src/methods/activation/README.md +189 -189
- package/src/methods/cost/README.md +131 -131
- package/src/methods/rate/README.md +86 -86
- package/src/multithreading/README.md +77 -77
- package/src/multithreading/workers/browser/README.md +8 -8
- package/src/multithreading/workers/node/README.md +8 -8
- package/src/neat/README.md +148 -148
- package/src/neat/adaptive/README.md +120 -120
- package/src/neat/adaptive/acceptance/README.md +40 -40
- package/src/neat/adaptive/complexity/README.md +137 -137
- package/src/neat/adaptive/core/README.md +197 -197
- package/src/neat/adaptive/lineage/README.md +90 -90
- package/src/neat/adaptive/mutation/README.md +284 -284
- package/src/neat/compat/README.md +43 -43
- package/src/neat/compat/core/README.md +90 -90
- package/src/neat/diversity/README.md +35 -35
- package/src/neat/diversity/core/README.md +88 -88
- package/src/neat/evaluate/README.md +85 -85
- package/src/neat/evaluate/auto-distance/README.md +75 -75
- package/src/neat/evaluate/entropy-compat/README.md +37 -37
- package/src/neat/evaluate/entropy-sharing/README.md +43 -43
- package/src/neat/evaluate/fitness/README.md +23 -23
- package/src/neat/evaluate/novelty/README.md +120 -120
- package/src/neat/evaluate/objectives/README.md +17 -17
- package/src/neat/evaluate/shared/README.md +94 -94
- package/src/neat/evolve/README.md +96 -96
- package/src/neat/evolve/adaptive/README.md +60 -60
- package/src/neat/evolve/objectives/README.md +63 -63
- package/src/neat/evolve/offspring/README.md +56 -56
- package/src/neat/evolve/population/README.md +171 -171
- package/src/neat/evolve/runtime/README.md +79 -79
- package/src/neat/evolve/speciation/README.md +74 -74
- package/src/neat/evolve/warnings/README.md +10 -10
- package/src/neat/export/README.md +114 -114
- package/src/neat/helpers/README.md +50 -50
- package/src/neat/init/README.md +9 -9
- package/src/neat/lineage/core/README.md +101 -101
- package/src/neat/multiobjective/category/README.md +74 -74
- package/src/neat/multiobjective/crowding/README.md +272 -272
- package/src/neat/multiobjective/dominance/README.md +171 -171
- package/src/neat/multiobjective/fronts/README.md +68 -68
- package/src/neat/multiobjective/metrics/README.md +43 -43
- package/src/neat/multiobjective/objectives/README.md +31 -31
- package/src/neat/multiobjective/shared/README.md +27 -27
- package/src/neat/mutation/README.md +97 -97
- package/src/neat/mutation/add-conn/README.md +115 -115
- package/src/neat/mutation/add-node/README.md +126 -126
- package/src/neat/mutation/flow/README.md +149 -149
- package/src/neat/mutation/repair/README.md +185 -185
- package/src/neat/mutation/select/README.md +117 -117
- package/src/neat/mutation/shared/README.md +32 -32
- package/src/neat/objectives/README.md +25 -25
- package/src/neat/objectives/core/README.md +67 -67
- package/src/neat/pruning/README.md +40 -40
- package/src/neat/pruning/core/README.md +171 -171
- package/src/neat/pruning/facade/README.md +32 -32
- package/src/neat/rng/README.md +104 -104
- package/src/neat/rng/core/README.md +137 -137
- package/src/neat/rng/facade/README.md +50 -50
- package/src/neat/selection/README.md +111 -111
- package/src/neat/selection/core/README.md +227 -227
- package/src/neat/selection/facade/README.md +61 -61
- package/src/neat/shared/README.md +163 -163
- package/src/neat/speciation/README.md +31 -31
- package/src/neat/speciation/threshold/README.md +35 -35
- package/src/neat/species/README.md +25 -25
- package/src/neat/species/core/README.md +20 -20
- package/src/neat/species/core/shared/README.md +18 -18
- package/src/neat/species/history/context/README.md +22 -22
- package/src/neat/telemetry/accessors/README.md +58 -58
- package/src/neat/telemetry/exports/README.md +233 -233
- package/src/neat/telemetry/facade/README.md +252 -252
- package/src/neat/telemetry/facade/archive/README.md +57 -57
- package/src/neat/telemetry/facade/buffer/README.md +43 -43
- package/src/neat/telemetry/facade/lineage/README.md +12 -12
- package/src/neat/telemetry/facade/objectives/README.md +44 -44
- package/src/neat/telemetry/facade/runtime/README.md +26 -26
- package/src/neat/telemetry/facade/species/README.md +27 -27
- package/src/neat/telemetry/metrics/README.md +696 -696
- package/src/neat/telemetry/recorder/README.md +57 -57
- package/src/neat/telemetry/types/README.md +32 -32
- package/src/neat/topology-intent/README.md +75 -75
- package/src/utils/README.md +193 -193
- package/test/examples/asciiMaze/browser-entry/README.md +92 -92
- package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
- package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
- package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
- package/test/examples/flappy_bird/browser-entry/README.md +508 -508
- package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
- package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
- package/test/examples/flappy_bird/constants/README.md +1070 -1070
- package/test/examples/flappy_bird/environment/README.md +22 -22
- package/test/examples/flappy_bird/evaluation/README.md +32 -32
- package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
- package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
- package/test/examples/flappy_bird/trainer/README.md +325 -325
- package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
- package/scripts/analyze-trace.ts +0 -590
- package/scripts/copy-examples.mjs +0 -114
- package/scripts/export-onnx.mjs +0 -86
- package/scripts/generate-bench-tables.mjs +0 -182
- package/scripts/generate-docs.ts +0 -2900
- 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
|
-
###
|
|
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
|
-
|
|
7
|
+
Runtime network view used by the object-graph activation pipeline.
|
|
34
8
|
|
|
35
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
18
|
+
Activation telemetry collected during a single activation pass.
|
|
52
19
|
|
|
53
|
-
###
|
|
20
|
+
### BATCH_INPUTS_COLLECTION_ERROR_MESSAGE
|
|
54
21
|
|
|
55
|
-
|
|
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
|
-
###
|
|
32
|
+
### DEFAULT_MAX_ACTIVATION_DEPTH
|
|
66
33
|
|
|
67
|
-
|
|
34
|
+
Default hard limit for recursive activation depth in raw activation mode.
|
|
68
35
|
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
###
|
|
52
|
+
### NO_TRACE_FAST_SLAB_TRAINING_FLAG
|
|
81
53
|
|
|
82
|
-
|
|
54
|
+
Training flag value used by no-trace fast slab eligibility checks.
|
|
83
55
|
|
|
84
|
-
###
|
|
56
|
+
### NoTraceActivationContext
|
|
85
57
|
|
|
86
|
-
|
|
58
|
+
Shared state used by no-trace activation orchestration and helpers.
|
|
87
59
|
|
|
88
|
-
###
|
|
60
|
+
### NoTraceNodeTraversalContext
|
|
89
61
|
|
|
90
|
-
|
|
62
|
+
Shared state used for node traversal during no-trace activation.
|
|
91
63
|
|
|
92
|
-
|
|
64
|
+
### OUTPUT_NODE_TYPE
|
|
93
65
|
|
|
94
|
-
|
|
66
|
+
Node role label used by activation traversal for output neurons.
|
|
95
67
|
|
|
96
|
-
|
|
97
|
-
noTraceActivate(
|
|
98
|
-
input: number[],
|
|
99
|
-
): number[]
|
|
100
|
-
```
|
|
68
|
+
### OUTPUT_WRITE_INDEX_INCREMENT
|
|
101
69
|
|
|
102
|
-
|
|
70
|
+
Increment applied after writing one output activation value.
|
|
103
71
|
|
|
104
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
80
|
+
### UNDEFINED_INPUT_LENGTH_TEXT
|
|
134
81
|
|
|
135
|
-
|
|
82
|
+
Fallback text for undefined input lengths when formatting validation errors.
|
|
136
83
|
|
|
137
|
-
|
|
138
|
-
console.log(out); // => e.g. [0.5123, 0.0441]
|
|
84
|
+
### WeightNoiseApplyResult
|
|
139
85
|
|
|
140
|
-
|
|
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
|
-
|
|
97
|
+
activate(
|
|
144
98
|
input: number[],
|
|
145
99
|
training: boolean,
|
|
146
|
-
maxActivationDepth: number,
|
|
147
100
|
): number[]
|
|
148
101
|
```
|
|
149
102
|
|
|
150
|
-
|
|
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` -
|
|
159
|
-
- `input` -
|
|
160
|
-
- `training` -
|
|
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
|
-
|
|
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
|
-
###
|
|
142
|
+
### activateRaw
|
|
200
143
|
|
|
201
144
|
```ts
|
|
202
|
-
|
|
145
|
+
activateRaw(
|
|
203
146
|
input: number[],
|
|
204
147
|
training: boolean,
|
|
148
|
+
maxActivationDepth: number,
|
|
205
149
|
): number[]
|
|
206
150
|
```
|
|
207
151
|
|
|
208
|
-
|
|
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
|
|
212
|
-
- `input` - Input
|
|
213
|
-
- `training` - Whether training
|
|
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:
|
|
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
|
-
###
|
|
234
|
+
### activateViaNetworkDelegate
|
|
235
235
|
|
|
236
236
|
```ts
|
|
237
|
-
|
|
237
|
+
activateViaNetworkDelegate(
|
|
238
238
|
activationContext: RawActivationContext,
|
|
239
239
|
): number[]
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
|
|
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
|
|
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
|
-
###
|
|
264
|
+
### executeRawActivation
|
|
268
265
|
|
|
269
266
|
```ts
|
|
270
|
-
|
|
267
|
+
executeRawActivation(
|
|
271
268
|
activationContext: RawActivationContext,
|
|
272
269
|
): number[]
|
|
273
270
|
```
|
|
274
271
|
|
|
275
|
-
|
|
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
|
-
###
|
|
284
|
+
### acquireOutputBuffer
|
|
285
285
|
|
|
286
286
|
```ts
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
):
|
|
287
|
+
acquireOutputBuffer(
|
|
288
|
+
outputSize: number,
|
|
289
|
+
): ActivationArray
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
Acquire a pooled activation output buffer for the current output width.
|
|
293
293
|
|
|
294
294
|
Parameters:
|
|
295
|
-
- `
|
|
295
|
+
- `outputSize` - Number of output slots.
|
|
296
296
|
|
|
297
|
-
Returns:
|
|
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
|
-
###
|
|
317
|
+
### activateLayer
|
|
318
318
|
|
|
319
319
|
```ts
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
activateLayer(
|
|
321
|
+
currentLayer: default,
|
|
322
|
+
layerIndex: number,
|
|
323
|
+
inputVector: number[],
|
|
324
|
+
isTraining: boolean,
|
|
325
|
+
): number[]
|
|
323
326
|
```
|
|
324
327
|
|
|
325
|
-
|
|
328
|
+
Activate one layer, routing input only for the first layer.
|
|
326
329
|
|
|
327
330
|
Parameters:
|
|
328
|
-
- `
|
|
331
|
+
- `currentLayer` - Layer instance to activate.
|
|
332
|
+
- `layerIndex` - Layer index.
|
|
333
|
+
- `inputVector` - Network input vector.
|
|
334
|
+
- `isTraining` - Training-time flag.
|
|
329
335
|
|
|
330
|
-
Returns:
|
|
336
|
+
Returns: Layer activations.
|
|
331
337
|
|
|
332
|
-
###
|
|
338
|
+
### activateLayeredNetworkWithDropout
|
|
333
339
|
|
|
334
340
|
```ts
|
|
335
|
-
|
|
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
|
-
|
|
351
|
+
Run layered activation with dropout masks and no stochastic-depth skips.
|
|
342
352
|
|
|
343
353
|
Parameters:
|
|
344
354
|
- `network` - Network being activated.
|
|
345
|
-
- `
|
|
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
|
-
###
|
|
363
|
+
### activateLayeredNetworkWithStochasticDepth
|
|
350
364
|
|
|
351
365
|
```ts
|
|
352
|
-
|
|
366
|
+
activateLayeredNetworkWithStochasticDepth(
|
|
367
|
+
network: default,
|
|
353
368
|
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
354
369
|
inputVector: number[],
|
|
355
370
|
isTraining: boolean,
|
|
356
|
-
|
|
371
|
+
outputBuffer: ActivationArray,
|
|
372
|
+
stats: ActivationStats,
|
|
373
|
+
): void
|
|
357
374
|
```
|
|
358
375
|
|
|
359
|
-
|
|
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:
|
|
386
|
+
Returns: Nothing.
|
|
367
387
|
|
|
368
|
-
###
|
|
388
|
+
### activateNodeNetworkFallback
|
|
369
389
|
|
|
370
390
|
```ts
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
|
|
401
|
+
Run fallback node-by-node activation for networks without explicit layer definitions.
|
|
377
402
|
|
|
378
403
|
Parameters:
|
|
379
|
-
- `
|
|
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:
|
|
411
|
+
Returns: Nothing.
|
|
382
412
|
|
|
383
|
-
###
|
|
413
|
+
### activateNodesAndCollectOutputs
|
|
384
414
|
|
|
385
415
|
```ts
|
|
386
|
-
|
|
387
|
-
|
|
416
|
+
activateNodesAndCollectOutputs(
|
|
417
|
+
nodes: default[],
|
|
418
|
+
inputVector: number[],
|
|
419
|
+
outputBuffer: ActivationArray,
|
|
388
420
|
): void
|
|
389
421
|
```
|
|
390
422
|
|
|
391
|
-
|
|
423
|
+
Activate raw nodes in order and collect output-node activations into output buffer.
|
|
392
424
|
|
|
393
425
|
Parameters:
|
|
394
|
-
- `
|
|
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
|
-
###
|
|
432
|
+
### applyDropConnect
|
|
399
433
|
|
|
400
434
|
```ts
|
|
401
|
-
|
|
435
|
+
applyDropConnect(
|
|
402
436
|
network: default,
|
|
437
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
438
|
+
isTraining: boolean,
|
|
439
|
+
stats: ActivationStats,
|
|
403
440
|
): void
|
|
404
441
|
```
|
|
405
442
|
|
|
406
|
-
|
|
443
|
+
Apply drop-connect masking and restore original weights where required.
|
|
407
444
|
|
|
408
445
|
Parameters:
|
|
409
|
-
- `network` - Network
|
|
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
|
-
###
|
|
453
|
+
### applyFallbackHiddenDropout
|
|
414
454
|
|
|
415
455
|
```ts
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
456
|
+
applyFallbackHiddenDropout(
|
|
457
|
+
hiddenNodes: default[],
|
|
458
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
459
|
+
dropoutProbability: number,
|
|
460
|
+
isTraining: boolean,
|
|
461
|
+
stats: ActivationStats,
|
|
462
|
+
): void
|
|
419
463
|
```
|
|
420
464
|
|
|
421
|
-
|
|
465
|
+
Apply fallback dropout for hidden nodes in raw node traversal mode.
|
|
422
466
|
|
|
423
467
|
Parameters:
|
|
424
|
-
- `
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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:
|
|
474
|
+
Returns: Nothing.
|
|
437
475
|
|
|
438
|
-
###
|
|
476
|
+
### applyFallbackWeightNoise
|
|
439
477
|
|
|
440
478
|
```ts
|
|
441
|
-
|
|
479
|
+
applyFallbackWeightNoise(
|
|
442
480
|
network: default,
|
|
443
481
|
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
444
482
|
isTraining: boolean,
|
|
445
|
-
):
|
|
483
|
+
): void
|
|
446
484
|
```
|
|
447
485
|
|
|
448
|
-
Apply
|
|
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:
|
|
493
|
+
Returns: Nothing.
|
|
456
494
|
|
|
457
|
-
###
|
|
495
|
+
### applyHiddenLayerDropout
|
|
458
496
|
|
|
459
497
|
```ts
|
|
460
|
-
|
|
498
|
+
applyHiddenLayerDropout(
|
|
499
|
+
layer: default,
|
|
500
|
+
rawActivations: number[],
|
|
461
501
|
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
462
|
-
|
|
502
|
+
dropoutProbability: number,
|
|
503
|
+
isTraining: boolean,
|
|
504
|
+
stats: ActivationStats,
|
|
505
|
+
): void
|
|
463
506
|
```
|
|
464
507
|
|
|
465
|
-
|
|
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:
|
|
518
|
+
Returns: Nothing.
|
|
471
519
|
|
|
472
|
-
###
|
|
520
|
+
### applyTrainingDropConnect
|
|
473
521
|
|
|
474
522
|
```ts
|
|
475
|
-
|
|
523
|
+
applyTrainingDropConnect(
|
|
476
524
|
network: default,
|
|
477
525
|
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
): number
|
|
526
|
+
stats: ActivationStats,
|
|
527
|
+
): void
|
|
481
528
|
```
|
|
482
529
|
|
|
483
|
-
|
|
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
|
-
- `
|
|
489
|
-
- `fallbackStandardDeviation` - Global fallback deviation.
|
|
535
|
+
- `stats` - Activation stats accumulator.
|
|
490
536
|
|
|
491
|
-
Returns:
|
|
537
|
+
Returns: Nothing.
|
|
492
538
|
|
|
493
|
-
###
|
|
539
|
+
### applyTrainingWeightNoise
|
|
494
540
|
|
|
495
541
|
```ts
|
|
496
|
-
|
|
542
|
+
applyTrainingWeightNoise(
|
|
497
543
|
network: default,
|
|
498
|
-
|
|
499
|
-
|
|
544
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
545
|
+
isTraining: boolean,
|
|
546
|
+
): WeightNoiseApplyResult
|
|
500
547
|
```
|
|
501
548
|
|
|
502
|
-
|
|
549
|
+
Apply per-connection training noise for the main activation flow.
|
|
503
550
|
|
|
504
551
|
Parameters:
|
|
505
552
|
- `network` - Network being activated.
|
|
506
|
-
- `
|
|
553
|
+
- `runtimeNetwork` - Runtime activation internals.
|
|
554
|
+
- `isTraining` - Training-time flag.
|
|
507
555
|
|
|
508
|
-
Returns:
|
|
556
|
+
Returns: Applied-state information for downstream restore logic.
|
|
509
557
|
|
|
510
|
-
###
|
|
558
|
+
### collectHiddenNodes
|
|
511
559
|
|
|
512
560
|
```ts
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
): void
|
|
561
|
+
collectHiddenNodes(
|
|
562
|
+
nodes: default[],
|
|
563
|
+
): default[]
|
|
517
564
|
```
|
|
518
565
|
|
|
519
|
-
|
|
566
|
+
Collect hidden nodes from a raw node list.
|
|
520
567
|
|
|
521
568
|
Parameters:
|
|
522
|
-
- `
|
|
523
|
-
- `isTraining` - Training-time flag.
|
|
569
|
+
- `nodes` - Network node collection.
|
|
524
570
|
|
|
525
|
-
Returns:
|
|
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
|
-
###
|
|
588
|
+
### createActivationStats
|
|
543
589
|
|
|
544
590
|
```ts
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
-
|
|
596
|
+
Create activation statistics container for the current pass.
|
|
556
597
|
|
|
557
598
|
Parameters:
|
|
558
|
-
- `
|
|
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:
|
|
601
|
+
Returns: Initialized activation stats object.
|
|
566
602
|
|
|
567
|
-
###
|
|
603
|
+
### createWeightNoiseStats
|
|
568
604
|
|
|
569
605
|
```ts
|
|
570
|
-
|
|
571
|
-
network: default,
|
|
572
|
-
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
573
|
-
): boolean
|
|
606
|
+
createWeightNoiseStats(): WeightNoiseStats
|
|
574
607
|
```
|
|
575
608
|
|
|
576
|
-
|
|
609
|
+
Create the weight-noise statistics record with zeroed aggregates.
|
|
577
610
|
|
|
578
|
-
|
|
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
|
-
###
|
|
613
|
+
### decideLayerSkip
|
|
585
614
|
|
|
586
615
|
```ts
|
|
587
|
-
|
|
616
|
+
decideLayerSkip(
|
|
588
617
|
network: default,
|
|
589
|
-
|
|
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
|
-
|
|
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:
|
|
636
|
+
Returns: Skip decision and survival probability for the layer.
|
|
598
637
|
|
|
599
|
-
###
|
|
638
|
+
### executeActivationPath
|
|
600
639
|
|
|
601
640
|
```ts
|
|
602
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
663
|
+
### finalizeNodePathWeightNoiseRestore
|
|
625
664
|
|
|
626
665
|
```ts
|
|
627
|
-
|
|
666
|
+
finalizeNodePathWeightNoiseRestore(
|
|
628
667
|
network: default,
|
|
629
|
-
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
630
|
-
currentLayerNodeCount: number,
|
|
631
|
-
layerIndex: number,
|
|
632
668
|
isTraining: boolean,
|
|
633
|
-
|
|
634
|
-
):
|
|
669
|
+
appliedWeightNoise: boolean,
|
|
670
|
+
): void
|
|
635
671
|
```
|
|
636
672
|
|
|
637
|
-
|
|
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
|
-
- `
|
|
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:
|
|
680
|
+
Returns: Nothing.
|
|
682
681
|
|
|
683
|
-
###
|
|
682
|
+
### finalizeTrainingStepAndStats
|
|
684
683
|
|
|
685
684
|
```ts
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
inputVector: number[],
|
|
685
|
+
finalizeTrainingStepAndStats(
|
|
686
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
687
|
+
stats: ActivationStats,
|
|
690
688
|
isTraining: boolean,
|
|
691
|
-
):
|
|
689
|
+
): void
|
|
692
690
|
```
|
|
693
691
|
|
|
694
|
-
|
|
692
|
+
Finalize training counters and attach activation statistics to runtime state.
|
|
695
693
|
|
|
696
694
|
Parameters:
|
|
697
|
-
- `
|
|
698
|
-
- `
|
|
699
|
-
- `inputVector` - Network input vector.
|
|
695
|
+
- `runtimeNetwork` - Runtime activation internals.
|
|
696
|
+
- `stats` - Activation stats.
|
|
700
697
|
- `isTraining` - Training-time flag.
|
|
701
698
|
|
|
702
|
-
Returns:
|
|
699
|
+
Returns: Nothing.
|
|
703
700
|
|
|
704
|
-
###
|
|
701
|
+
### findSourceLayerIndex
|
|
705
702
|
|
|
706
703
|
```ts
|
|
707
|
-
|
|
704
|
+
findSourceLayerIndex(
|
|
708
705
|
network: default,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
): void
|
|
706
|
+
connection: default,
|
|
707
|
+
): number
|
|
712
708
|
```
|
|
713
709
|
|
|
714
|
-
|
|
710
|
+
Find the layer index containing a connection source node.
|
|
715
711
|
|
|
716
712
|
Parameters:
|
|
717
713
|
- `network` - Network being activated.
|
|
718
|
-
- `
|
|
719
|
-
- `layerIndex` - Skipped layer index.
|
|
714
|
+
- `connection` - Connection to inspect.
|
|
720
715
|
|
|
721
|
-
Returns:
|
|
716
|
+
Returns: Layer index for source node, or -1 when not found.
|
|
722
717
|
|
|
723
|
-
###
|
|
718
|
+
### gaussianRand
|
|
724
719
|
|
|
725
720
|
```ts
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
): number[]
|
|
721
|
+
gaussianRand(
|
|
722
|
+
rng: () => number,
|
|
723
|
+
): number
|
|
730
724
|
```
|
|
731
725
|
|
|
732
|
-
|
|
726
|
+
Produce a normally distributed random sample using the Box-Muller transform.
|
|
733
727
|
|
|
734
728
|
Parameters:
|
|
735
|
-
- `
|
|
736
|
-
- `scaleFactor` - Multiplicative scale factor.
|
|
729
|
+
- `rng` - Pseudo-random source in the interval [0, 1).
|
|
737
730
|
|
|
738
|
-
Returns:
|
|
731
|
+
Returns: Standard normal sample with mean 0 and variance 1.
|
|
739
732
|
|
|
740
|
-
###
|
|
733
|
+
### hasCompatibleSkipState
|
|
741
734
|
|
|
742
735
|
```ts
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
): void
|
|
736
|
+
hasCompatibleSkipState(
|
|
737
|
+
previousLayerActivations: number[] | undefined,
|
|
738
|
+
currentLayerNodeCount: number,
|
|
739
|
+
): boolean
|
|
748
740
|
```
|
|
749
741
|
|
|
750
|
-
|
|
742
|
+
Validate whether previous activations can be reused as skip pass-through output.
|
|
751
743
|
|
|
752
744
|
Parameters:
|
|
753
|
-
- `
|
|
754
|
-
- `
|
|
755
|
-
- `outputSize` - Maximum output width.
|
|
745
|
+
- `previousLayerActivations` - Last computed layer activations.
|
|
746
|
+
- `currentLayerNodeCount` - Current layer node count.
|
|
756
747
|
|
|
757
|
-
Returns:
|
|
748
|
+
Returns: True when pass-through activations are compatible.
|
|
758
749
|
|
|
759
|
-
###
|
|
750
|
+
### hasLayeredNetwork
|
|
760
751
|
|
|
761
752
|
```ts
|
|
762
|
-
|
|
753
|
+
hasLayeredNetwork(
|
|
763
754
|
network: default,
|
|
764
|
-
|
|
765
|
-
inputVector: number[],
|
|
766
|
-
isTraining: boolean,
|
|
767
|
-
outputBuffer: ActivationArray,
|
|
768
|
-
stats: ActivationStats,
|
|
769
|
-
): void
|
|
755
|
+
): boolean
|
|
770
756
|
```
|
|
771
757
|
|
|
772
|
-
|
|
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:
|
|
763
|
+
Returns: True when layered activation path should run.
|
|
783
764
|
|
|
784
|
-
###
|
|
765
|
+
### hasLayeredNetworkWithStochasticDepth
|
|
785
766
|
|
|
786
767
|
```ts
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
rawActivations: number[],
|
|
768
|
+
hasLayeredNetworkWithStochasticDepth(
|
|
769
|
+
network: default,
|
|
790
770
|
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
791
|
-
|
|
792
|
-
isTraining: boolean,
|
|
793
|
-
stats: ActivationStats,
|
|
794
|
-
): void
|
|
771
|
+
): boolean
|
|
795
772
|
```
|
|
796
773
|
|
|
797
|
-
|
|
774
|
+
Check whether the network has layers and stochastic-depth configuration for layer skipping path.
|
|
798
775
|
|
|
799
776
|
Parameters:
|
|
800
|
-
- `
|
|
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:
|
|
780
|
+
Returns: True when stochastic-depth layer path should run.
|
|
808
781
|
|
|
809
|
-
###
|
|
782
|
+
### hasOriginalWeightNoise
|
|
810
783
|
|
|
811
784
|
```ts
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
):
|
|
785
|
+
hasOriginalWeightNoise(
|
|
786
|
+
connection: default,
|
|
787
|
+
): boolean
|
|
815
788
|
```
|
|
816
789
|
|
|
817
|
-
|
|
790
|
+
Check whether a connection already has an original weight-noise snapshot.
|
|
818
791
|
|
|
819
792
|
Parameters:
|
|
820
|
-
- `
|
|
793
|
+
- `connection` - Connection to inspect.
|
|
821
794
|
|
|
822
|
-
Returns:
|
|
795
|
+
Returns: True when snapshot exists.
|
|
823
796
|
|
|
824
|
-
###
|
|
797
|
+
### isHiddenLayer
|
|
825
798
|
|
|
826
799
|
```ts
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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
|
-
|
|
806
|
+
Check whether a layer index refers to a hidden layer in a layered network.
|
|
838
807
|
|
|
839
808
|
Parameters:
|
|
840
|
-
- `
|
|
841
|
-
- `
|
|
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:
|
|
812
|
+
Returns: True when the layer is hidden.
|
|
848
813
|
|
|
849
|
-
###
|
|
814
|
+
### persistOriginalWeightNoise
|
|
850
815
|
|
|
851
816
|
```ts
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
):
|
|
817
|
+
persistOriginalWeightNoise(
|
|
818
|
+
connection: default,
|
|
819
|
+
): void
|
|
855
820
|
```
|
|
856
821
|
|
|
857
|
-
|
|
822
|
+
Store current connection weight before applying temporary weight-noise modifications.
|
|
858
823
|
|
|
859
824
|
Parameters:
|
|
860
|
-
- `
|
|
825
|
+
- `connection` - Connection to persist.
|
|
861
826
|
|
|
862
|
-
Returns:
|
|
827
|
+
Returns: Nothing.
|
|
863
828
|
|
|
864
|
-
###
|
|
829
|
+
### prepareTopologyForActivation
|
|
865
830
|
|
|
866
831
|
```ts
|
|
867
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
844
|
+
### recordSkippedLayer
|
|
888
845
|
|
|
889
846
|
```ts
|
|
890
|
-
|
|
847
|
+
recordSkippedLayer(
|
|
891
848
|
network: default,
|
|
892
|
-
|
|
893
|
-
|
|
849
|
+
stats: ActivationStats,
|
|
850
|
+
layerIndex: number,
|
|
894
851
|
): void
|
|
895
852
|
```
|
|
896
853
|
|
|
897
|
-
|
|
854
|
+
Record a skipped layer in runtime and stats trackers.
|
|
898
855
|
|
|
899
856
|
Parameters:
|
|
900
857
|
- `network` - Network being activated.
|
|
901
|
-
- `
|
|
902
|
-
- `
|
|
858
|
+
- `stats` - Activation stats accumulator.
|
|
859
|
+
- `layerIndex` - Skipped layer index.
|
|
903
860
|
|
|
904
861
|
Returns: Nothing.
|
|
905
862
|
|
|
906
|
-
###
|
|
863
|
+
### releaseBufferAndCreateResult
|
|
907
864
|
|
|
908
865
|
```ts
|
|
909
|
-
|
|
910
|
-
nodes: default[],
|
|
911
|
-
inputVector: number[],
|
|
866
|
+
releaseBufferAndCreateResult(
|
|
912
867
|
outputBuffer: ActivationArray,
|
|
913
|
-
):
|
|
868
|
+
): number[]
|
|
914
869
|
```
|
|
915
870
|
|
|
916
|
-
|
|
871
|
+
Release pooled output buffer and return a detached plain array copy.
|
|
917
872
|
|
|
918
873
|
Parameters:
|
|
919
|
-
- `
|
|
920
|
-
- `inputVector` - Input vector.
|
|
921
|
-
- `outputBuffer` - Mutable output buffer.
|
|
874
|
+
- `outputBuffer` - Mutable pooled output buffer.
|
|
922
875
|
|
|
923
|
-
Returns:
|
|
876
|
+
Returns: Plain array of output values.
|
|
924
877
|
|
|
925
|
-
###
|
|
878
|
+
### resetSkippedLayers
|
|
926
879
|
|
|
927
880
|
```ts
|
|
928
|
-
|
|
881
|
+
resetSkippedLayers(
|
|
929
882
|
network: default,
|
|
930
|
-
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
931
|
-
isTraining: boolean,
|
|
932
|
-
stats: ActivationStats,
|
|
933
883
|
): void
|
|
934
884
|
```
|
|
935
885
|
|
|
936
|
-
|
|
886
|
+
Clear the runtime list of skipped layers before current activation pass.
|
|
937
887
|
|
|
938
888
|
Parameters:
|
|
939
|
-
- `network` - Network
|
|
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
|
-
###
|
|
893
|
+
### resolveConnectionNoiseStd
|
|
947
894
|
|
|
948
895
|
```ts
|
|
949
|
-
|
|
896
|
+
resolveConnectionNoiseStd(
|
|
950
897
|
network: default,
|
|
951
898
|
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
952
|
-
|
|
953
|
-
|
|
899
|
+
connection: default,
|
|
900
|
+
fallbackStandardDeviation: number,
|
|
901
|
+
): number
|
|
954
902
|
```
|
|
955
903
|
|
|
956
|
-
|
|
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
|
-
- `
|
|
909
|
+
- `connection` - Current connection.
|
|
910
|
+
- `fallbackStandardDeviation` - Global fallback deviation.
|
|
962
911
|
|
|
963
|
-
Returns:
|
|
912
|
+
Returns: Effective standard deviation for this connection.
|
|
964
913
|
|
|
965
|
-
###
|
|
914
|
+
### resolveDynamicWeightNoiseStd
|
|
966
915
|
|
|
967
916
|
```ts
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
):
|
|
917
|
+
resolveDynamicWeightNoiseStd(
|
|
918
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
919
|
+
): number
|
|
971
920
|
```
|
|
972
921
|
|
|
973
|
-
|
|
922
|
+
Resolve the training-step adjusted global weight-noise standard deviation.
|
|
974
923
|
|
|
975
924
|
Parameters:
|
|
976
|
-
- `
|
|
925
|
+
- `runtimeNetwork` - Runtime activation internals.
|
|
977
926
|
|
|
978
|
-
Returns:
|
|
927
|
+
Returns: Effective weight-noise standard deviation for current training step.
|
|
979
928
|
|
|
980
|
-
###
|
|
929
|
+
### restoreDropConnectWeights
|
|
981
930
|
|
|
982
931
|
```ts
|
|
983
|
-
|
|
932
|
+
restoreDropConnectWeights(
|
|
984
933
|
network: default,
|
|
985
|
-
isTraining: boolean,
|
|
986
|
-
appliedWeightNoise: boolean,
|
|
987
934
|
): void
|
|
988
935
|
```
|
|
989
936
|
|
|
990
|
-
Restore
|
|
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
|
-
###
|
|
944
|
+
### restoreOriginalDropConnectWeight
|
|
1000
945
|
|
|
1001
946
|
```ts
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
stats: ActivationStats,
|
|
1005
|
-
isTraining: boolean,
|
|
947
|
+
restoreOriginalDropConnectWeight(
|
|
948
|
+
connection: default,
|
|
1006
949
|
): void
|
|
1007
950
|
```
|
|
1008
951
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
Parameters:
|
|
1012
|
-
- `
|
|
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
|
-
###
|
|
959
|
+
### restoreOriginalWeightNoise
|
|
1019
960
|
|
|
1020
961
|
```ts
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
):
|
|
962
|
+
restoreOriginalWeightNoise(
|
|
963
|
+
connection: default,
|
|
964
|
+
): void
|
|
1024
965
|
```
|
|
1025
966
|
|
|
1026
|
-
|
|
967
|
+
Restore and clear the original weight-noise snapshot for a connection.
|
|
1027
968
|
|
|
1028
969
|
Parameters:
|
|
1029
|
-
- `
|
|
970
|
+
- `connection` - Connection to restore.
|
|
1030
971
|
|
|
1031
|
-
Returns:
|
|
972
|
+
Returns: Nothing.
|
|
1032
973
|
|
|
1033
|
-
###
|
|
974
|
+
### scaleActivations
|
|
1034
975
|
|
|
1035
976
|
```ts
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
977
|
+
scaleActivations(
|
|
978
|
+
activations: number[],
|
|
979
|
+
scaleFactor: number,
|
|
980
|
+
): number[]
|
|
1039
981
|
```
|
|
1040
982
|
|
|
1041
|
-
|
|
983
|
+
Create a new activation vector by multiplying each activation by a scale factor.
|
|
1042
984
|
|
|
1043
985
|
Parameters:
|
|
1044
|
-
- `
|
|
986
|
+
- `activations` - Source activation vector.
|
|
987
|
+
- `scaleFactor` - Multiplicative scale factor.
|
|
1045
988
|
|
|
1046
|
-
Returns:
|
|
989
|
+
Returns: Scaled activation vector.
|
|
1047
990
|
|
|
1048
|
-
###
|
|
991
|
+
### setAllMasksToOne
|
|
1049
992
|
|
|
1050
993
|
```ts
|
|
1051
|
-
|
|
1052
|
-
|
|
994
|
+
setAllMasksToOne(
|
|
995
|
+
nodes: default[],
|
|
1053
996
|
): void
|
|
1054
997
|
```
|
|
1055
998
|
|
|
1056
|
-
|
|
999
|
+
Set mask value to one for every node in a layer.
|
|
1057
1000
|
|
|
1058
1001
|
Parameters:
|
|
1059
|
-
- `
|
|
1002
|
+
- `nodes` - Layer nodes to normalize.
|
|
1060
1003
|
|
|
1061
1004
|
Returns: Nothing.
|
|
1062
1005
|
|
|
1063
|
-
###
|
|
1006
|
+
### setDropConnectMask
|
|
1064
1007
|
|
|
1065
1008
|
```ts
|
|
1066
|
-
|
|
1009
|
+
setDropConnectMask(
|
|
1067
1010
|
connection: default,
|
|
1011
|
+
dropConnectMask: number,
|
|
1068
1012
|
): void
|
|
1069
1013
|
```
|
|
1070
1014
|
|
|
1071
|
-
|
|
1015
|
+
Set drop-connect mask value for a connection.
|
|
1072
1016
|
|
|
1073
1017
|
Parameters:
|
|
1074
|
-
- `connection` - Connection to
|
|
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
|
-
###
|
|
1040
|
+
### stashOriginalDropConnectWeight
|
|
1096
1041
|
|
|
1097
1042
|
```ts
|
|
1098
|
-
|
|
1043
|
+
stashOriginalDropConnectWeight(
|
|
1099
1044
|
connection: default,
|
|
1100
|
-
dropConnectMask: number,
|
|
1101
1045
|
): void
|
|
1102
1046
|
```
|
|
1103
1047
|
|
|
1104
|
-
|
|
1048
|
+
Store original connection weight before drop-connect zeroing.
|
|
1105
1049
|
|
|
1106
1050
|
Parameters:
|
|
1107
|
-
- `connection` - Connection to
|
|
1108
|
-
- `dropConnectMask` - Drop-connect mask value.
|
|
1051
|
+
- `connection` - Connection to persist.
|
|
1109
1052
|
|
|
1110
1053
|
Returns: Nothing.
|
|
1111
1054
|
|
|
1112
|
-
###
|
|
1055
|
+
### tryFastSlabActivation
|
|
1113
1056
|
|
|
1114
1057
|
```ts
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1058
|
+
tryFastSlabActivation(
|
|
1059
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
1060
|
+
inputVector: number[],
|
|
1061
|
+
isTraining: boolean,
|
|
1062
|
+
): number[] | undefined
|
|
1118
1063
|
```
|
|
1119
1064
|
|
|
1120
|
-
|
|
1065
|
+
Attempt fast slab activation and safely fall back to regular activation on failure.
|
|
1121
1066
|
|
|
1122
1067
|
Parameters:
|
|
1123
|
-
- `
|
|
1068
|
+
- `runtimeNetwork` - Runtime activation internals.
|
|
1069
|
+
- `inputVector` - Input vector.
|
|
1070
|
+
- `isTraining` - Training-time flag.
|
|
1124
1071
|
|
|
1125
|
-
Returns:
|
|
1072
|
+
Returns: Fast slab output when available, otherwise undefined.
|
|
1126
1073
|
|
|
1127
|
-
###
|
|
1074
|
+
### updateStochasticDepthFromSchedule
|
|
1128
1075
|
|
|
1129
1076
|
```ts
|
|
1130
|
-
|
|
1131
|
-
|
|
1077
|
+
updateStochasticDepthFromSchedule(
|
|
1078
|
+
runtimeNetwork: ActivateRuntimeNetworkProps,
|
|
1079
|
+
isTraining: boolean,
|
|
1132
1080
|
): void
|
|
1133
1081
|
```
|
|
1134
1082
|
|
|
1135
|
-
|
|
1083
|
+
Update stochastic depth probabilities using a training schedule when valid.
|
|
1136
1084
|
|
|
1137
1085
|
Parameters:
|
|
1138
|
-
- `
|
|
1086
|
+
- `runtimeNetwork` - Runtime activation internals.
|
|
1087
|
+
- `isTraining` - Training-time flag.
|
|
1139
1088
|
|
|
1140
1089
|
Returns: Nothing.
|
|
1141
1090
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
### executeBatchActivation
|
|
1091
|
+
### validateInputVector
|
|
1145
1092
|
|
|
1146
1093
|
```ts
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1094
|
+
validateInputVector(
|
|
1095
|
+
network: default,
|
|
1096
|
+
inputVector: number[],
|
|
1097
|
+
): void
|
|
1150
1098
|
```
|
|
1151
1099
|
|
|
1152
|
-
|
|
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
|
-
- `
|
|
1103
|
+
- `network` - Network being activated.
|
|
1104
|
+
- `inputVector` - Input vector to validate.
|
|
1159
1105
|
|
|
1160
|
-
Returns:
|
|
1106
|
+
Returns: Nothing.
|
|
1161
1107
|
|
|
1162
|
-
###
|
|
1108
|
+
### validateNetworkNodes
|
|
1163
1109
|
|
|
1164
1110
|
```ts
|
|
1165
|
-
|
|
1166
|
-
|
|
1111
|
+
validateNetworkNodes(
|
|
1112
|
+
network: default,
|
|
1167
1113
|
): void
|
|
1168
1114
|
```
|
|
1169
1115
|
|
|
1170
|
-
|
|
1116
|
+
Assert that the network contains nodes before executing activation routines.
|
|
1171
1117
|
|
|
1172
1118
|
Parameters:
|
|
1173
|
-
- `
|
|
1119
|
+
- `network` - Network being activated.
|
|
1174
1120
|
|
|
1175
1121
|
Returns: Nothing.
|
|
1176
1122
|
|
|
1177
|
-
###
|
|
1123
|
+
### writeLayerActivationsToOutput
|
|
1178
1124
|
|
|
1179
1125
|
```ts
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1126
|
+
writeLayerActivationsToOutput(
|
|
1127
|
+
layerActivations: number[] | undefined,
|
|
1128
|
+
outputBuffer: ActivationArray,
|
|
1129
|
+
outputSize: number,
|
|
1130
|
+
): void
|
|
1183
1131
|
```
|
|
1184
1132
|
|
|
1185
|
-
|
|
1133
|
+
Copy final layer activations into the pooled network output buffer.
|
|
1186
1134
|
|
|
1187
1135
|
Parameters:
|
|
1188
|
-
- `
|
|
1136
|
+
- `layerActivations` - Final layer activations.
|
|
1137
|
+
- `outputBuffer` - Mutable output buffer.
|
|
1138
|
+
- `outputSize` - Maximum output width.
|
|
1189
1139
|
|
|
1190
|
-
Returns:
|
|
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
|
-
###
|
|
1159
|
+
### activateValidatedBatchRows
|
|
1208
1160
|
|
|
1209
1161
|
```ts
|
|
1210
|
-
|
|
1211
|
-
|
|
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
|
|
1182
|
+
Validate that the batch input collection is an array of rows.
|
|
1216
1183
|
|
|
1217
1184
|
Parameters:
|
|
1218
|
-
- `
|
|
1185
|
+
- `batchInputs` - - Candidate batch input collection.
|
|
1219
1186
|
|
|
1220
1187
|
Returns: Nothing.
|
|
1221
1188
|
|
|
1222
|
-
###
|
|
1189
|
+
### assertBatchRowInputSize
|
|
1223
1190
|
|
|
1224
1191
|
```ts
|
|
1225
|
-
|
|
1192
|
+
assertBatchRowInputSize(
|
|
1226
1193
|
rowActivationContext: BatchRowActivationContext,
|
|
1227
|
-
):
|
|
1194
|
+
): void
|
|
1228
1195
|
```
|
|
1229
1196
|
|
|
1230
|
-
|
|
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:
|
|
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
|
-
###
|
|
1219
|
+
### executeBatchActivation
|
|
1253
1220
|
|
|
1254
1221
|
```ts
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
):
|
|
1222
|
+
executeBatchActivation(
|
|
1223
|
+
activationContext: BatchActivationContext,
|
|
1224
|
+
): number[][]
|
|
1258
1225
|
```
|
|
1259
1226
|
|
|
1260
|
-
|
|
1227
|
+
Execute mini-batch activation with top-level shape validation and per-row checks.
|
|
1261
1228
|
|
|
1262
|
-
|
|
1263
|
-
|
|
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
|
-
|
|
1232
|
+
Parameters:
|
|
1233
|
+
- `activationContext` - - Shared batch activation state.
|
|
1266
1234
|
|
|
1267
|
-
|
|
1235
|
+
Returns: Matrix of activation outputs.
|
|
1268
1236
|
|
|
1269
|
-
###
|
|
1237
|
+
### formatInputLengthForMessage
|
|
1270
1238
|
|
|
1271
1239
|
```ts
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
):
|
|
1240
|
+
formatInputLengthForMessage(
|
|
1241
|
+
inputVector: number[],
|
|
1242
|
+
): string
|
|
1275
1243
|
```
|
|
1276
1244
|
|
|
1277
|
-
|
|
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
|
-
- `
|
|
1248
|
+
- `inputVector` - - Candidate batch row input vector.
|
|
1284
1249
|
|
|
1285
|
-
Returns:
|
|
1250
|
+
Returns: Numeric length as string or predefined undefined text.
|
|
1286
1251
|
|
|
1287
|
-
###
|
|
1252
|
+
### isBatchRowInputSizeValid
|
|
1288
1253
|
|
|
1289
1254
|
```ts
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
):
|
|
1255
|
+
isBatchRowInputSizeValid(
|
|
1256
|
+
rowActivationContext: BatchRowActivationContext,
|
|
1257
|
+
): boolean
|
|
1293
1258
|
```
|
|
1294
1259
|
|
|
1295
|
-
|
|
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
|
-
- `
|
|
1263
|
+
- `rowActivationContext` - - Shared state for one batch-row activation.
|
|
1302
1264
|
|
|
1303
|
-
Returns:
|
|
1265
|
+
Returns: True when row size is valid.
|
|
1304
1266
|
|
|
1305
|
-
|
|
1267
|
+
## architecture/network/activate/network.activate.helpers.utils.ts
|
|
1268
|
+
|
|
1269
|
+
### createBatchActivationContext
|
|
1306
1270
|
|
|
1307
1271
|
```ts
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1272
|
+
createBatchActivationContext(
|
|
1273
|
+
network: default,
|
|
1274
|
+
batchInputs: number[][],
|
|
1275
|
+
isTraining: boolean,
|
|
1276
|
+
): BatchActivationContext
|
|
1311
1277
|
```
|
|
1312
1278
|
|
|
1313
|
-
|
|
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
|
-
- `
|
|
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:
|
|
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
|
-
###
|
|
1326
|
+
### executeBatchActivation
|
|
1362
1327
|
|
|
1363
1328
|
```ts
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
isTraining: boolean,
|
|
1368
|
-
): BatchActivationContext
|
|
1329
|
+
executeBatchActivation(
|
|
1330
|
+
activationContext: BatchActivationContext,
|
|
1331
|
+
): number[][]
|
|
1369
1332
|
```
|
|
1370
1333
|
|
|
1371
|
-
|
|
1334
|
+
Execute mini-batch activation with top-level shape validation and per-row checks.
|
|
1372
1335
|
|
|
1373
|
-
|
|
1374
|
-
|
|
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
|
-
|
|
1339
|
+
Parameters:
|
|
1340
|
+
- `activationContext` - - Shared batch activation state.
|
|
1379
1341
|
|
|
1380
|
-
|
|
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
|
-
###
|
|
1362
|
+
### executeRawActivation
|
|
1401
1363
|
|
|
1402
1364
|
```ts
|
|
1403
|
-
|
|
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
|
-
):
|
|
1387
|
+
): number[]
|
|
1406
1388
|
```
|
|
1407
1389
|
|
|
1408
|
-
|
|
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:
|
|
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
|
-
###
|
|
1412
|
+
### buildInputSizeMismatchMessage
|
|
1431
1413
|
|
|
1432
1414
|
```ts
|
|
1433
|
-
|
|
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
|
-
|
|
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
|
|
1440
|
+
Returns: True when slab execution is available for inference mode.
|
|
1444
1441
|
|
|
1445
|
-
###
|
|
1442
|
+
### detachPooledOutputBuffer
|
|
1446
1443
|
|
|
1447
1444
|
```ts
|
|
1448
|
-
|
|
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
|
-
):
|
|
1462
|
+
): number[]
|
|
1451
1463
|
```
|
|
1452
1464
|
|
|
1453
|
-
|
|
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:
|
|
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
|
-
###
|
|
1490
|
+
### isInputVectorLengthValid
|
|
1476
1491
|
|
|
1477
1492
|
```ts
|
|
1478
|
-
|
|
1493
|
+
isInputVectorLengthValid(
|
|
1479
1494
|
activationContext: NoTraceActivationContext,
|
|
1480
|
-
):
|
|
1495
|
+
): boolean
|
|
1481
1496
|
```
|
|
1482
1497
|
|
|
1483
|
-
|
|
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:
|
|
1503
|
+
Returns: True when the input vector is an array with expected length.
|
|
1489
1504
|
|
|
1490
|
-
###
|
|
1505
|
+
### refreshTopologicalOrderWhenRequired
|
|
1491
1506
|
|
|
1492
1507
|
```ts
|
|
1493
|
-
|
|
1508
|
+
refreshTopologicalOrderWhenRequired(
|
|
1494
1509
|
activationContext: NoTraceActivationContext,
|
|
1495
|
-
):
|
|
1510
|
+
): void
|
|
1496
1511
|
```
|
|
1497
1512
|
|
|
1498
|
-
|
|
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:
|
|
1518
|
+
Returns: Nothing.
|
|
1504
1519
|
|
|
1505
|
-
###
|
|
1520
|
+
### tryActivateWithFastSlab
|
|
1506
1521
|
|
|
1507
1522
|
```ts
|
|
1508
|
-
|
|
1523
|
+
tryActivateWithFastSlab(
|
|
1509
1524
|
activationContext: NoTraceActivationContext,
|
|
1510
|
-
): number[]
|
|
1525
|
+
): number[] | null
|
|
1511
1526
|
```
|
|
1512
1527
|
|
|
1513
|
-
|
|
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:
|
|
1533
|
+
Returns: Fast slab output when successful, otherwise null.
|
|
1519
1534
|
|
|
1520
|
-
|
|
1535
|
+
## architecture/network/activate/network.activate.contexts.utils.ts
|
|
1536
|
+
|
|
1537
|
+
### createBatchActivationContext
|
|
1521
1538
|
|
|
1522
1539
|
```ts
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1540
|
+
createBatchActivationContext(
|
|
1541
|
+
network: default,
|
|
1542
|
+
batchInputs: number[][],
|
|
1543
|
+
isTraining: boolean,
|
|
1544
|
+
): BatchActivationContext
|
|
1526
1545
|
```
|
|
1527
1546
|
|
|
1528
|
-
|
|
1547
|
+
Build shared batch activation context for helper orchestration.
|
|
1529
1548
|
|
|
1530
1549
|
Parameters:
|
|
1531
|
-
- `
|
|
1532
|
-
|
|
1533
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
1611
|
+
### activateHiddenNode
|
|
1612
1612
|
|
|
1613
1613
|
```ts
|
|
1614
|
-
|
|
1615
|
-
|
|
1614
|
+
activateHiddenNode(
|
|
1615
|
+
networkNode: default,
|
|
1616
1616
|
): void
|
|
1617
1617
|
```
|
|
1618
1618
|
|
|
1619
|
-
|
|
1619
|
+
Activate a hidden node without trace bookkeeping.
|
|
1620
1620
|
|
|
1621
|
-
|
|
1622
|
-
|
|
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
|
-
- `
|
|
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
|
-
###
|
|
1701
|
+
### populatePooledOutputBufferFromNodes
|
|
1675
1702
|
|
|
1676
1703
|
```ts
|
|
1677
|
-
|
|
1678
|
-
|
|
1704
|
+
populatePooledOutputBufferFromNodes(
|
|
1705
|
+
traversalContext: NoTraceNodeTraversalContext,
|
|
1679
1706
|
): void
|
|
1680
1707
|
```
|
|
1681
1708
|
|
|
1682
|
-
|
|
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
|
-
|
|
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
|
-
- `
|
|
1715
|
+
- `traversalContext` - - Inputs required to process each node and collect outputs.
|
|
1716
1716
|
|
|
1717
1717
|
Returns: Nothing.
|