@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
|
@@ -32,57 +32,69 @@ console.log('First weight from->to', slab.weights[0], slab.from[0], slab.to[0]);
|
|
|
32
32
|
|
|
33
33
|
## architecture/network/slab/network.slab.utils.types.ts
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### BuildAdjacencyContext
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Shared immutable inputs used across the adjacency build pipeline.
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### ConnectionInternals
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Internal Connection properties accessed during slab operations.
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### ConnectionSlabView
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Shape returned by getConnectionSlab describing the packed SoA view.
|
|
46
46
|
|
|
47
|
-
###
|
|
47
|
+
### FanOutCollectionContext
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Context for fan-out collection: build inputs plus the output count buffer.
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### FastSlabNodeRuntime
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
Node shape required by fast slab activation kernels.
|
|
54
54
|
|
|
55
|
-
###
|
|
55
|
+
### NetworkActivationRuntime
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Runtime activation contract used by slab-based execution paths.
|
|
58
58
|
|
|
59
59
|
### NetworkSlabProps
|
|
60
60
|
|
|
61
61
|
Internal Network properties for slab operations.
|
|
62
62
|
|
|
63
|
+
### NetworkTopoRuntime
|
|
64
|
+
|
|
65
|
+
Runtime topology contract used to lazily rebuild topological order.
|
|
66
|
+
|
|
67
|
+
### OutgoingOrderBuildContext
|
|
68
|
+
|
|
69
|
+
Context for constructing source-grouped outgoing connection order.
|
|
70
|
+
|
|
63
71
|
### PoolKeyMetrics
|
|
64
72
|
|
|
65
73
|
Per-pool-key allocation & reuse counters (educational / diagnostics).
|
|
66
74
|
|
|
67
|
-
###
|
|
75
|
+
### PublishAdjacencyContext
|
|
68
76
|
|
|
69
|
-
|
|
77
|
+
Context for publishing fully built adjacency slabs to internal network state.
|
|
70
78
|
|
|
71
|
-
###
|
|
79
|
+
### SLAB_DEFAULT_ASYNC_CHUNK_SIZE
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
Default async slab rebuild chunk size when no override is provided.
|
|
74
82
|
|
|
75
|
-
###
|
|
83
|
+
### SLAB_GROWTH_FACTOR_BROWSER
|
|
76
84
|
|
|
77
|
-
|
|
85
|
+
Capacity growth factor for browser slab allocations.
|
|
78
86
|
|
|
79
|
-
###
|
|
87
|
+
### SLAB_GROWTH_FACTOR_NODE
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
Capacity growth factor for Node.js slab allocations.
|
|
82
90
|
|
|
83
|
-
###
|
|
91
|
+
### SLAB_ONE
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
Numeric one sentinel used for neutral gain defaults and index math.
|
|
94
|
+
|
|
95
|
+
### SLAB_ZERO
|
|
96
|
+
|
|
97
|
+
Numeric zero sentinel used across slab orchestration and helper pipelines.
|
|
86
98
|
|
|
87
99
|
### SlabBuildContext
|
|
88
100
|
|
|
@@ -96,31 +108,78 @@ Result of scanning and populating optional gain/plastic slab arrays.
|
|
|
96
108
|
|
|
97
109
|
Writable slab arrays targeted during connection serialization.
|
|
98
110
|
|
|
111
|
+
### StartIndicesBuildContext
|
|
112
|
+
|
|
113
|
+
Context for constructing CSR start offsets from precomputed fan-out counts.
|
|
114
|
+
|
|
115
|
+
### TypedArray
|
|
116
|
+
|
|
117
|
+
Union of slab typed array element container types.
|
|
118
|
+
|
|
119
|
+
### TypedArrayConstructor
|
|
120
|
+
|
|
121
|
+
Constructor type for typed arrays used in slabs.
|
|
122
|
+
|
|
123
|
+
## architecture/network/slab/network.slab.utils.ts
|
|
124
|
+
|
|
125
|
+
### canUseFastSlab
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
canUseFastSlab(
|
|
129
|
+
training: boolean,
|
|
130
|
+
): boolean
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Public convenience wrapper exposing fast path eligibility.
|
|
134
|
+
Mirrors `_canUseFastSlab` internal predicate.
|
|
135
|
+
|
|
136
|
+
Parameters:
|
|
137
|
+
- `training` - Whether caller is performing training (disables fast path if true).
|
|
138
|
+
|
|
139
|
+
Returns: True when slab fast path predicates hold.
|
|
140
|
+
|
|
99
141
|
### ConnectionSlabView
|
|
100
142
|
|
|
101
143
|
Shape returned by getConnectionSlab describing the packed SoA view.
|
|
102
144
|
|
|
103
|
-
###
|
|
145
|
+
### fastSlabActivate
|
|
104
146
|
|
|
105
|
-
|
|
147
|
+
```ts
|
|
148
|
+
fastSlabActivate(
|
|
149
|
+
input: number[],
|
|
150
|
+
): number[]
|
|
151
|
+
```
|
|
106
152
|
|
|
107
|
-
|
|
153
|
+
High‑performance forward pass using packed slabs + CSR adjacency.
|
|
108
154
|
|
|
109
|
-
|
|
155
|
+
Fallback Conditions (auto‑detected):
|
|
156
|
+
- Missing slabs / adjacency structures.
|
|
157
|
+
- Topology/gating/stochastic predicates fail (see `_canUseFastSlab`).
|
|
158
|
+
- Gating present, when applicable (explicit guard).
|
|
110
159
|
|
|
111
|
-
|
|
160
|
+
Implementation Notes:
|
|
161
|
+
- Reuses internal activation/state buffers to reduce per‑step allocation churn.
|
|
162
|
+
- Applies gain multiplication if optional gain slab exists.
|
|
163
|
+
- Assumes acyclic graph; topological order recomputed on demand if marked dirty.
|
|
112
164
|
|
|
113
|
-
|
|
165
|
+
Parameters:
|
|
166
|
+
- `input` - Input vector (length must equal `network.input`).
|
|
114
167
|
|
|
115
|
-
|
|
168
|
+
Returns: Output activations (detached plain array) of length `network.output`.
|
|
116
169
|
|
|
117
|
-
|
|
170
|
+
### getConnectionSlab
|
|
118
171
|
|
|
119
|
-
|
|
172
|
+
```ts
|
|
173
|
+
getConnectionSlab(): ConnectionSlabView
|
|
174
|
+
```
|
|
120
175
|
|
|
121
|
-
|
|
176
|
+
Obtain (and lazily rebuild if dirty) the current packed SoA view of connections.
|
|
122
177
|
|
|
123
|
-
|
|
178
|
+
Gain Omission: If the internal gain slab is absent (all gains neutral) a synthetic
|
|
179
|
+
neutral array is created and returned (NOT retained) to keep external educational
|
|
180
|
+
tooling branch‑free while preserving omission memory savings internally.
|
|
181
|
+
|
|
182
|
+
Returns: Read‑only style view (do not mutate) containing typed arrays + metadata.
|
|
124
183
|
|
|
125
184
|
### getSlabAllocationStats
|
|
126
185
|
|
|
@@ -139,6 +198,16 @@ NOTE: Stats are cumulative (not auto‑reset); callers may diff successive snaps
|
|
|
139
198
|
|
|
140
199
|
Returns: Plain object copy (safe to serialize) of current allocator counters.
|
|
141
200
|
|
|
201
|
+
### getSlabVersion
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
getSlabVersion(): number
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Retrieve current monotonic slab version (increments on each successful rebuild).
|
|
208
|
+
|
|
209
|
+
Returns: Non‑negative integer (0 if slab never built yet).
|
|
210
|
+
|
|
142
211
|
### rebuildConnectionSlab
|
|
143
212
|
|
|
144
213
|
```ts
|
|
@@ -188,75 +257,6 @@ Parameters:
|
|
|
188
257
|
|
|
189
258
|
Returns: Promise resolving once rebuild completes.
|
|
190
259
|
|
|
191
|
-
### getConnectionSlab
|
|
192
|
-
|
|
193
|
-
```ts
|
|
194
|
-
getConnectionSlab(): ConnectionSlabView
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Obtain (and lazily rebuild if dirty) the current packed SoA view of connections.
|
|
198
|
-
|
|
199
|
-
Gain Omission: If the internal gain slab is absent (all gains neutral) a synthetic
|
|
200
|
-
neutral array is created and returned (NOT retained) to keep external educational
|
|
201
|
-
tooling branch‑free while preserving omission memory savings internally.
|
|
202
|
-
|
|
203
|
-
Returns: Read‑only style view (do not mutate) containing typed arrays + metadata.
|
|
204
|
-
|
|
205
|
-
### fastSlabActivate
|
|
206
|
-
|
|
207
|
-
```ts
|
|
208
|
-
fastSlabActivate(
|
|
209
|
-
input: number[],
|
|
210
|
-
): number[]
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
High‑performance forward pass using packed slabs + CSR adjacency.
|
|
214
|
-
|
|
215
|
-
Fallback Conditions (auto‑detected):
|
|
216
|
-
- Missing slabs / adjacency structures.
|
|
217
|
-
- Topology/gating/stochastic predicates fail (see `_canUseFastSlab`).
|
|
218
|
-
- Gating present, when applicable (explicit guard).
|
|
219
|
-
|
|
220
|
-
Implementation Notes:
|
|
221
|
-
- Reuses internal activation/state buffers to reduce per‑step allocation churn.
|
|
222
|
-
- Applies gain multiplication if optional gain slab exists.
|
|
223
|
-
- Assumes acyclic graph; topological order recomputed on demand if marked dirty.
|
|
224
|
-
|
|
225
|
-
Parameters:
|
|
226
|
-
- `input` - Input vector (length must equal `network.input`).
|
|
227
|
-
|
|
228
|
-
Returns: Output activations (detached plain array) of length `network.output`.
|
|
229
|
-
|
|
230
|
-
### canUseFastSlab
|
|
231
|
-
|
|
232
|
-
```ts
|
|
233
|
-
canUseFastSlab(
|
|
234
|
-
training: boolean,
|
|
235
|
-
): boolean
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
Public convenience wrapper exposing fast path eligibility.
|
|
239
|
-
Mirrors `_canUseFastSlab` internal predicate.
|
|
240
|
-
|
|
241
|
-
Parameters:
|
|
242
|
-
- `training` - Whether caller is performing training (disables fast path if true).
|
|
243
|
-
|
|
244
|
-
Returns: True when slab fast path predicates hold.
|
|
245
|
-
|
|
246
|
-
### getSlabVersion
|
|
247
|
-
|
|
248
|
-
```ts
|
|
249
|
-
getSlabVersion(): number
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Retrieve current monotonic slab version (increments on each successful rebuild).
|
|
253
|
-
|
|
254
|
-
Returns: Non‑negative integer (0 if slab never built yet).
|
|
255
|
-
|
|
256
|
-
### ConnectionSlabView
|
|
257
|
-
|
|
258
|
-
Shape returned by getConnectionSlab describing the packed SoA view.
|
|
259
|
-
|
|
260
260
|
## architecture/network/slab/network.slab.pool.utils.ts
|
|
261
261
|
|
|
262
262
|
Internal slab pool/stat helpers extracted from network.slab.utils.ts.
|
|
@@ -282,25 +282,6 @@ Parameters:
|
|
|
282
282
|
|
|
283
283
|
Returns: Acquired typed array.
|
|
284
284
|
|
|
285
|
-
### _releaseTA
|
|
286
|
-
|
|
287
|
-
```ts
|
|
288
|
-
_releaseTA(
|
|
289
|
-
kind: string,
|
|
290
|
-
bytesPerElement: number,
|
|
291
|
-
arr: TypedArray,
|
|
292
|
-
): void
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
Releases a typed array back to bounded per-key pool.
|
|
296
|
-
|
|
297
|
-
Parameters:
|
|
298
|
-
- `kind` - - Pool kind discriminator.
|
|
299
|
-
- `bytesPerElement` - - Element byte width for keying.
|
|
300
|
-
- `arr` - - Typed array instance to retain when room exists.
|
|
301
|
-
|
|
302
|
-
Returns: Nothing.
|
|
303
|
-
|
|
304
285
|
### _getSlabAllocationStatsSnapshot
|
|
305
286
|
|
|
306
287
|
```ts
|
|
@@ -311,16 +292,6 @@ Returns allocation stats snapshot for slab typed arrays.
|
|
|
311
292
|
|
|
312
293
|
Returns: Serializable snapshot of fresh, pooled, and per-key metrics.
|
|
313
294
|
|
|
314
|
-
### _slabPoolCap
|
|
315
|
-
|
|
316
|
-
```ts
|
|
317
|
-
_slabPoolCap(): number
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
Computes retention cap per key.
|
|
321
|
-
|
|
322
|
-
Returns: Non-negative max retained arrays per key.
|
|
323
|
-
|
|
324
295
|
### _poolKey
|
|
325
296
|
|
|
326
297
|
```ts
|
|
@@ -340,52 +311,66 @@ Parameters:
|
|
|
340
311
|
|
|
341
312
|
Returns: Stable pool key.
|
|
342
313
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
### _createConnectionSlabView
|
|
314
|
+
### _releaseTA
|
|
346
315
|
|
|
347
316
|
```ts
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
317
|
+
_releaseTA(
|
|
318
|
+
kind: string,
|
|
319
|
+
bytesPerElement: number,
|
|
320
|
+
arr: TypedArray,
|
|
321
|
+
): void
|
|
351
322
|
```
|
|
352
323
|
|
|
353
|
-
|
|
324
|
+
Releases a typed array back to bounded per-key pool.
|
|
354
325
|
|
|
355
326
|
Parameters:
|
|
356
|
-
- `
|
|
327
|
+
- `kind` - - Pool kind discriminator.
|
|
328
|
+
- `bytesPerElement` - - Element byte width for keying.
|
|
329
|
+
- `arr` - - Typed array instance to retain when room exists.
|
|
357
330
|
|
|
358
|
-
Returns:
|
|
331
|
+
Returns: Nothing.
|
|
359
332
|
|
|
360
|
-
###
|
|
333
|
+
### _slabPoolCap
|
|
361
334
|
|
|
362
335
|
```ts
|
|
363
|
-
|
|
336
|
+
_slabPoolCap(): number
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Computes retention cap per key.
|
|
340
|
+
|
|
341
|
+
Returns: Non-negative max retained arrays per key.
|
|
342
|
+
|
|
343
|
+
## architecture/network/slab/network.slab.view.utils.ts
|
|
344
|
+
|
|
345
|
+
### _createConnectionSlabView
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
_createConnectionSlabView(
|
|
364
349
|
network: default,
|
|
365
|
-
):
|
|
350
|
+
): ConnectionSlabView
|
|
366
351
|
```
|
|
367
352
|
|
|
368
|
-
|
|
353
|
+
Creates a read-oriented packed slab view from current network internals.
|
|
369
354
|
|
|
370
355
|
Parameters:
|
|
371
356
|
- `network` - - Target network.
|
|
372
357
|
|
|
373
|
-
Returns:
|
|
358
|
+
Returns: Packed connection slab view.
|
|
374
359
|
|
|
375
|
-
###
|
|
360
|
+
### _readSlabVersion
|
|
376
361
|
|
|
377
362
|
```ts
|
|
378
|
-
|
|
379
|
-
|
|
363
|
+
_readSlabVersion(
|
|
364
|
+
network: default,
|
|
380
365
|
): number
|
|
381
366
|
```
|
|
382
367
|
|
|
383
|
-
|
|
368
|
+
Reads the current monotonic slab version from network internals.
|
|
384
369
|
|
|
385
370
|
Parameters:
|
|
386
|
-
- `
|
|
371
|
+
- `network` - - Target network.
|
|
387
372
|
|
|
388
|
-
Returns:
|
|
373
|
+
Returns: Non-negative slab version counter.
|
|
389
374
|
|
|
390
375
|
### _resolveConnectionGainView
|
|
391
376
|
|
|
@@ -404,6 +389,21 @@ Parameters:
|
|
|
404
389
|
|
|
405
390
|
Returns: Gain array view.
|
|
406
391
|
|
|
392
|
+
### _resolveConnectionSlabCapacity
|
|
393
|
+
|
|
394
|
+
```ts
|
|
395
|
+
_resolveConnectionSlabCapacity(
|
|
396
|
+
internalNet: NetworkSlabProps,
|
|
397
|
+
): number
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Resolves effective slab capacity using explicit capacity first.
|
|
401
|
+
|
|
402
|
+
Parameters:
|
|
403
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
404
|
+
|
|
405
|
+
Returns: Effective capacity value.
|
|
406
|
+
|
|
407
407
|
## architecture/network/slab/network.slab.setup.utils.ts
|
|
408
408
|
|
|
409
409
|
### _prepareSlabBuildPreconditions
|
|
@@ -461,112 +461,63 @@ Returns: Nothing.
|
|
|
461
461
|
|
|
462
462
|
Internal slab rebuild helper functions extracted from network.slab.utils.ts.
|
|
463
463
|
|
|
464
|
-
###
|
|
465
|
-
|
|
466
|
-
```ts
|
|
467
|
-
_createSlabBuildContext(
|
|
468
|
-
network: default,
|
|
469
|
-
growthFactor: number,
|
|
470
|
-
): SlabBuildContext
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
Creates immutable slab build context for one rebuild pass.
|
|
474
|
-
|
|
475
|
-
Parameters:
|
|
476
|
-
- `network` - - Target network.
|
|
477
|
-
- `growthFactor` - - Capacity growth multiplier.
|
|
478
|
-
|
|
479
|
-
Returns: Build context.
|
|
480
|
-
|
|
481
|
-
### _shouldSkipSlabRebuild
|
|
482
|
-
|
|
483
|
-
```ts
|
|
484
|
-
_shouldSkipSlabRebuild(
|
|
485
|
-
internalNet: NetworkSlabProps,
|
|
486
|
-
force: boolean,
|
|
487
|
-
): boolean
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
Determines whether slab rebuild can be skipped.
|
|
491
|
-
|
|
492
|
-
Parameters:
|
|
493
|
-
- `internalNet` - - Internal slab runtime shape.
|
|
494
|
-
- `force` - - True when rebuild must run regardless of dirty state.
|
|
495
|
-
|
|
496
|
-
Returns: True when rebuild can be skipped.
|
|
497
|
-
|
|
498
|
-
### _ensureSlabCapacitySync
|
|
464
|
+
### _allocateCoreSlabArrays
|
|
499
465
|
|
|
500
466
|
```ts
|
|
501
|
-
|
|
467
|
+
_allocateCoreSlabArrays(
|
|
502
468
|
buildContext: SlabBuildContext,
|
|
503
469
|
): void
|
|
504
470
|
```
|
|
505
471
|
|
|
506
|
-
|
|
472
|
+
Allocates core slab arrays (weights/from/to/flags).
|
|
507
473
|
|
|
508
474
|
Parameters:
|
|
509
475
|
- `buildContext` - - Slab build context.
|
|
510
476
|
|
|
511
477
|
Returns: Nothing.
|
|
512
478
|
|
|
513
|
-
###
|
|
479
|
+
### _allocateGainSlabForAsync
|
|
514
480
|
|
|
515
481
|
```ts
|
|
516
|
-
|
|
482
|
+
_allocateGainSlabForAsync(
|
|
517
483
|
buildContext: SlabBuildContext,
|
|
518
484
|
): void
|
|
519
485
|
```
|
|
520
486
|
|
|
521
|
-
|
|
487
|
+
Allocates gain slab for async pass prefill strategy.
|
|
522
488
|
|
|
523
489
|
Parameters:
|
|
524
490
|
- `buildContext` - - Slab build context.
|
|
525
491
|
|
|
526
492
|
Returns: Nothing.
|
|
527
493
|
|
|
528
|
-
###
|
|
529
|
-
|
|
530
|
-
```ts
|
|
531
|
-
_populateSlabConnectionsSync(
|
|
532
|
-
buildContext: SlabBuildContext,
|
|
533
|
-
): SlabPopulateResult
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
Populates core slab arrays in synchronous single pass.
|
|
537
|
-
|
|
538
|
-
Parameters:
|
|
539
|
-
- `buildContext` - - Slab build context.
|
|
540
|
-
|
|
541
|
-
Returns: Population result flags and optional slabs.
|
|
542
|
-
|
|
543
|
-
### _populateSlabConnectionsAsync
|
|
494
|
+
### _applyGainOmissionPolicy
|
|
544
495
|
|
|
545
496
|
```ts
|
|
546
|
-
|
|
497
|
+
_applyGainOmissionPolicy(
|
|
547
498
|
buildContext: SlabBuildContext,
|
|
548
|
-
|
|
549
|
-
):
|
|
499
|
+
populateResult: SlabPopulateResult,
|
|
500
|
+
): void
|
|
550
501
|
```
|
|
551
502
|
|
|
552
|
-
|
|
503
|
+
Applies gain omission rule by releasing neutral gain slab.
|
|
553
504
|
|
|
554
505
|
Parameters:
|
|
555
506
|
- `buildContext` - - Slab build context.
|
|
556
|
-
- `
|
|
507
|
+
- `populateResult` - - Populate result.
|
|
557
508
|
|
|
558
|
-
Returns:
|
|
509
|
+
Returns: Nothing.
|
|
559
510
|
|
|
560
|
-
###
|
|
511
|
+
### _applyPlasticPolicyAsync
|
|
561
512
|
|
|
562
513
|
```ts
|
|
563
|
-
|
|
514
|
+
_applyPlasticPolicyAsync(
|
|
564
515
|
buildContext: SlabBuildContext,
|
|
565
516
|
populateResult: SlabPopulateResult,
|
|
566
517
|
): void
|
|
567
518
|
```
|
|
568
519
|
|
|
569
|
-
Applies
|
|
520
|
+
Applies async plastic slab allocation/release policy.
|
|
570
521
|
|
|
571
522
|
Parameters:
|
|
572
523
|
- `buildContext` - - Slab build context.
|
|
@@ -591,99 +542,101 @@ Parameters:
|
|
|
591
542
|
|
|
592
543
|
Returns: Nothing.
|
|
593
544
|
|
|
594
|
-
###
|
|
545
|
+
### _createInitialSlabPopulateResult
|
|
595
546
|
|
|
596
547
|
```ts
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
): void
|
|
548
|
+
_createInitialSlabPopulateResult(
|
|
549
|
+
internalNet: NetworkSlabProps,
|
|
550
|
+
): SlabPopulateResult
|
|
601
551
|
```
|
|
602
552
|
|
|
603
|
-
|
|
553
|
+
Creates initial populate result from current optional slab state.
|
|
604
554
|
|
|
605
555
|
Parameters:
|
|
606
|
-
- `
|
|
607
|
-
- `populateResult` - - Populate result.
|
|
556
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
608
557
|
|
|
609
|
-
Returns:
|
|
558
|
+
Returns: Initial populate result.
|
|
610
559
|
|
|
611
|
-
###
|
|
560
|
+
### _createSlabBuildContext
|
|
612
561
|
|
|
613
562
|
```ts
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
):
|
|
563
|
+
_createSlabBuildContext(
|
|
564
|
+
network: default,
|
|
565
|
+
growthFactor: number,
|
|
566
|
+
): SlabBuildContext
|
|
618
567
|
```
|
|
619
568
|
|
|
620
|
-
|
|
569
|
+
Creates immutable slab build context for one rebuild pass.
|
|
621
570
|
|
|
622
571
|
Parameters:
|
|
623
|
-
- `
|
|
624
|
-
- `
|
|
572
|
+
- `network` - - Target network.
|
|
573
|
+
- `growthFactor` - - Capacity growth multiplier.
|
|
625
574
|
|
|
626
|
-
Returns:
|
|
575
|
+
Returns: Build context.
|
|
627
576
|
|
|
628
|
-
###
|
|
577
|
+
### _createSlabWriteArrays
|
|
629
578
|
|
|
630
579
|
```ts
|
|
631
|
-
|
|
580
|
+
_createSlabWriteArrays(
|
|
632
581
|
buildContext: SlabBuildContext,
|
|
633
|
-
):
|
|
582
|
+
): SlabWriteArrays
|
|
634
583
|
```
|
|
635
584
|
|
|
636
|
-
|
|
585
|
+
Creates strongly typed write-array bundle for connection population.
|
|
637
586
|
|
|
638
587
|
Parameters:
|
|
639
588
|
- `buildContext` - - Slab build context.
|
|
640
589
|
|
|
641
|
-
Returns:
|
|
590
|
+
Returns: Write-array bundle.
|
|
642
591
|
|
|
643
|
-
###
|
|
592
|
+
### _ensureGainArrayExistsForIndex
|
|
644
593
|
|
|
645
594
|
```ts
|
|
646
|
-
|
|
595
|
+
_ensureGainArrayExistsForIndex(
|
|
647
596
|
buildContext: SlabBuildContext,
|
|
597
|
+
populateResult: SlabPopulateResult,
|
|
598
|
+
connectionIndex: number,
|
|
648
599
|
): void
|
|
649
600
|
```
|
|
650
601
|
|
|
651
|
-
|
|
602
|
+
Ensures gain slab exists before writing non-neutral value.
|
|
652
603
|
|
|
653
604
|
Parameters:
|
|
654
605
|
- `buildContext` - - Slab build context.
|
|
606
|
+
- `populateResult` - - Mutable populate result.
|
|
607
|
+
- `connectionIndex` - - Current connection index.
|
|
655
608
|
|
|
656
609
|
Returns: Nothing.
|
|
657
610
|
|
|
658
|
-
###
|
|
611
|
+
### _ensureSlabCapacityAsync
|
|
659
612
|
|
|
660
613
|
```ts
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
):
|
|
614
|
+
_ensureSlabCapacityAsync(
|
|
615
|
+
buildContext: SlabBuildContext,
|
|
616
|
+
): void
|
|
664
617
|
```
|
|
665
618
|
|
|
666
|
-
|
|
619
|
+
Ensures async rebuild has enough slab capacity.
|
|
667
620
|
|
|
668
621
|
Parameters:
|
|
669
|
-
- `
|
|
622
|
+
- `buildContext` - - Slab build context.
|
|
670
623
|
|
|
671
|
-
Returns:
|
|
624
|
+
Returns: Nothing.
|
|
672
625
|
|
|
673
|
-
###
|
|
626
|
+
### _ensureSlabCapacitySync
|
|
674
627
|
|
|
675
628
|
```ts
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
):
|
|
629
|
+
_ensureSlabCapacitySync(
|
|
630
|
+
buildContext: SlabBuildContext,
|
|
631
|
+
): void
|
|
679
632
|
```
|
|
680
633
|
|
|
681
|
-
|
|
634
|
+
Ensures sync rebuild has enough slab capacity.
|
|
682
635
|
|
|
683
636
|
Parameters:
|
|
684
|
-
- `
|
|
637
|
+
- `buildContext` - - Slab build context.
|
|
685
638
|
|
|
686
|
-
Returns:
|
|
639
|
+
Returns: Nothing.
|
|
687
640
|
|
|
688
641
|
### _expandSlabCapacity
|
|
689
642
|
|
|
@@ -704,177 +657,190 @@ Parameters:
|
|
|
704
657
|
|
|
705
658
|
Returns: Expanded capacity.
|
|
706
659
|
|
|
707
|
-
###
|
|
660
|
+
### _fillPlasticityRates
|
|
708
661
|
|
|
709
662
|
```ts
|
|
710
|
-
|
|
711
|
-
|
|
663
|
+
_fillPlasticityRates(
|
|
664
|
+
network: default,
|
|
665
|
+
plasticArray: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
666
|
+
connectionCount: number,
|
|
712
667
|
): void
|
|
713
668
|
```
|
|
714
669
|
|
|
715
|
-
|
|
670
|
+
Fills plastic slab values from connection plasticity rates.
|
|
716
671
|
|
|
717
672
|
Parameters:
|
|
718
|
-
- `
|
|
673
|
+
- `network` - - Target network.
|
|
674
|
+
- `plasticArray` - - Plastic slab array.
|
|
675
|
+
- `connectionCount` - - Number of active connections.
|
|
719
676
|
|
|
720
677
|
Returns: Nothing.
|
|
721
678
|
|
|
722
|
-
###
|
|
679
|
+
### _finalizeAsyncSlabRebuild
|
|
723
680
|
|
|
724
681
|
```ts
|
|
725
|
-
|
|
682
|
+
_finalizeAsyncSlabRebuild(
|
|
726
683
|
buildContext: SlabBuildContext,
|
|
727
684
|
): void
|
|
728
685
|
```
|
|
729
686
|
|
|
730
|
-
|
|
687
|
+
Finalizes async rebuild bookkeeping fields.
|
|
731
688
|
|
|
732
689
|
Parameters:
|
|
733
690
|
- `buildContext` - - Slab build context.
|
|
734
691
|
|
|
735
692
|
Returns: Nothing.
|
|
736
693
|
|
|
737
|
-
###
|
|
694
|
+
### _finalizeSharedSlabState
|
|
738
695
|
|
|
739
696
|
```ts
|
|
740
|
-
|
|
741
|
-
|
|
697
|
+
_finalizeSharedSlabState(
|
|
698
|
+
internalNet: NetworkSlabProps,
|
|
699
|
+
connectionCount: number,
|
|
742
700
|
): void
|
|
743
701
|
```
|
|
744
702
|
|
|
745
|
-
|
|
703
|
+
Finalizes shared rebuild bookkeeping fields.
|
|
746
704
|
|
|
747
705
|
Parameters:
|
|
748
|
-
- `
|
|
706
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
707
|
+
- `connectionCount` - - Number of active connections.
|
|
749
708
|
|
|
750
709
|
Returns: Nothing.
|
|
751
710
|
|
|
752
|
-
###
|
|
711
|
+
### _finalizeSyncSlabRebuild
|
|
753
712
|
|
|
754
713
|
```ts
|
|
755
|
-
|
|
756
|
-
|
|
714
|
+
_finalizeSyncSlabRebuild(
|
|
715
|
+
buildContext: SlabBuildContext,
|
|
757
716
|
): void
|
|
758
717
|
```
|
|
759
718
|
|
|
760
|
-
|
|
719
|
+
Finalizes sync rebuild bookkeeping fields.
|
|
761
720
|
|
|
762
721
|
Parameters:
|
|
763
|
-
- `
|
|
722
|
+
- `buildContext` - - Slab build context.
|
|
764
723
|
|
|
765
724
|
Returns: Nothing.
|
|
766
725
|
|
|
767
|
-
###
|
|
726
|
+
### _populateAsyncChunkRange
|
|
768
727
|
|
|
769
728
|
```ts
|
|
770
|
-
|
|
729
|
+
_populateAsyncChunkRange(
|
|
771
730
|
buildContext: SlabBuildContext,
|
|
772
|
-
|
|
731
|
+
writeArrays: SlabWriteArrays,
|
|
732
|
+
populateResult: SlabPopulateResult,
|
|
733
|
+
startIndex: number,
|
|
734
|
+
endIndex: number,
|
|
735
|
+
): void
|
|
773
736
|
```
|
|
774
737
|
|
|
775
|
-
|
|
738
|
+
Populates one inclusive-exclusive chunk range for async rebuild.
|
|
776
739
|
|
|
777
740
|
Parameters:
|
|
778
741
|
- `buildContext` - - Slab build context.
|
|
742
|
+
- `writeArrays` - - Core write arrays.
|
|
743
|
+
- `populateResult` - - Mutable populate result.
|
|
744
|
+
- `startIndex` - - Chunk start index.
|
|
745
|
+
- `endIndex` - - Chunk end index.
|
|
779
746
|
|
|
780
|
-
Returns:
|
|
747
|
+
Returns: Nothing.
|
|
781
748
|
|
|
782
|
-
###
|
|
749
|
+
### _populateSlabConnectionsAsync
|
|
783
750
|
|
|
784
751
|
```ts
|
|
785
|
-
|
|
786
|
-
|
|
752
|
+
_populateSlabConnectionsAsync(
|
|
753
|
+
buildContext: SlabBuildContext,
|
|
754
|
+
chunkSize: number,
|
|
755
|
+
): Promise<SlabPopulateResult>
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
Populates core slab arrays in cooperative async chunks.
|
|
759
|
+
|
|
760
|
+
Parameters:
|
|
761
|
+
- `buildContext` - - Slab build context.
|
|
762
|
+
- `chunkSize` - - Maximum items per chunk.
|
|
763
|
+
|
|
764
|
+
Returns: Population result flags and optional slabs.
|
|
765
|
+
|
|
766
|
+
### _populateSlabConnectionsSync
|
|
767
|
+
|
|
768
|
+
```ts
|
|
769
|
+
_populateSlabConnectionsSync(
|
|
770
|
+
buildContext: SlabBuildContext,
|
|
787
771
|
): SlabPopulateResult
|
|
788
772
|
```
|
|
789
773
|
|
|
790
|
-
|
|
774
|
+
Populates core slab arrays in synchronous single pass.
|
|
791
775
|
|
|
792
776
|
Parameters:
|
|
793
|
-
- `
|
|
777
|
+
- `buildContext` - - Slab build context.
|
|
794
778
|
|
|
795
|
-
Returns:
|
|
779
|
+
Returns: Population result flags and optional slabs.
|
|
796
780
|
|
|
797
|
-
###
|
|
781
|
+
### _releaseExistingSlabArrays
|
|
798
782
|
|
|
799
783
|
```ts
|
|
800
|
-
|
|
784
|
+
_releaseExistingSlabArrays(
|
|
801
785
|
buildContext: SlabBuildContext,
|
|
802
|
-
writeArrays: SlabWriteArrays,
|
|
803
|
-
populateResult: SlabPopulateResult,
|
|
804
|
-
startIndex: number,
|
|
805
|
-
endIndex: number,
|
|
806
786
|
): void
|
|
807
787
|
```
|
|
808
788
|
|
|
809
|
-
|
|
789
|
+
Releases all currently allocated slab arrays back to pool.
|
|
810
790
|
|
|
811
791
|
Parameters:
|
|
812
792
|
- `buildContext` - - Slab build context.
|
|
813
|
-
- `writeArrays` - - Core write arrays.
|
|
814
|
-
- `populateResult` - - Mutable populate result.
|
|
815
|
-
- `startIndex` - - Chunk start index.
|
|
816
|
-
- `endIndex` - - Chunk end index.
|
|
817
793
|
|
|
818
794
|
Returns: Nothing.
|
|
819
795
|
|
|
820
|
-
###
|
|
796
|
+
### _resetOptionalSlabArraysAfterSyncAllocate
|
|
821
797
|
|
|
822
798
|
```ts
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
connection: ConnectionInternals,
|
|
826
|
-
connectionIndex: number,
|
|
799
|
+
_resetOptionalSlabArraysAfterSyncAllocate(
|
|
800
|
+
internalNet: NetworkSlabProps,
|
|
827
801
|
): void
|
|
828
802
|
```
|
|
829
803
|
|
|
830
|
-
|
|
804
|
+
Resets optional slabs after sync allocation to keep omission semantics.
|
|
831
805
|
|
|
832
806
|
Parameters:
|
|
833
|
-
- `
|
|
834
|
-
- `connection` - - Connection internals.
|
|
835
|
-
- `connectionIndex` - - Connection index.
|
|
807
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
836
808
|
|
|
837
809
|
Returns: Nothing.
|
|
838
810
|
|
|
839
|
-
###
|
|
811
|
+
### _resolveAsyncChunkSize
|
|
840
812
|
|
|
841
813
|
```ts
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
connectionIndex: number,
|
|
847
|
-
): void
|
|
814
|
+
_resolveAsyncChunkSize(
|
|
815
|
+
totalConnections: number,
|
|
816
|
+
requestedChunkSize: number,
|
|
817
|
+
): number
|
|
848
818
|
```
|
|
849
819
|
|
|
850
|
-
|
|
820
|
+
Resolves effective async chunk size using adaptive heuristics.
|
|
851
821
|
|
|
852
822
|
Parameters:
|
|
853
|
-
- `
|
|
854
|
-
- `
|
|
855
|
-
- `connection` - - Connection internals.
|
|
856
|
-
- `connectionIndex` - - Connection index.
|
|
823
|
+
- `totalConnections` - - Number of active connections.
|
|
824
|
+
- `requestedChunkSize` - - Requested chunk size.
|
|
857
825
|
|
|
858
|
-
Returns:
|
|
826
|
+
Returns: Effective chunk size.
|
|
859
827
|
|
|
860
|
-
###
|
|
828
|
+
### _shouldSkipSlabRebuild
|
|
861
829
|
|
|
862
830
|
```ts
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
): void
|
|
831
|
+
_shouldSkipSlabRebuild(
|
|
832
|
+
internalNet: NetworkSlabProps,
|
|
833
|
+
force: boolean,
|
|
834
|
+
): boolean
|
|
868
835
|
```
|
|
869
836
|
|
|
870
|
-
|
|
837
|
+
Determines whether slab rebuild can be skipped.
|
|
871
838
|
|
|
872
839
|
Parameters:
|
|
873
|
-
- `
|
|
874
|
-
- `
|
|
875
|
-
- `connectionIndex` - - Current connection index.
|
|
840
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
841
|
+
- `force` - - True when rebuild must run regardless of dirty state.
|
|
876
842
|
|
|
877
|
-
Returns:
|
|
843
|
+
Returns: True when rebuild can be skipped.
|
|
878
844
|
|
|
879
845
|
### _updatePlasticPresence
|
|
880
846
|
|
|
@@ -893,39 +859,73 @@ Parameters:
|
|
|
893
859
|
|
|
894
860
|
Returns: Nothing.
|
|
895
861
|
|
|
896
|
-
###
|
|
862
|
+
### _weightArrayCtor
|
|
897
863
|
|
|
898
864
|
```ts
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
865
|
+
_weightArrayCtor(
|
|
866
|
+
useFloat32Weights: boolean | undefined,
|
|
867
|
+
): Float32ArrayConstructor | Float64ArrayConstructor
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
Resolves typed-array constructor for weight slabs.
|
|
871
|
+
|
|
872
|
+
Parameters:
|
|
873
|
+
- `useFloat32Weights` - - True when 32-bit weights are enabled.
|
|
874
|
+
|
|
875
|
+
Returns: Matching typed-array constructor.
|
|
876
|
+
|
|
877
|
+
### _weightByteWidth
|
|
878
|
+
|
|
879
|
+
```ts
|
|
880
|
+
_weightByteWidth(
|
|
881
|
+
useFloat32Weights: boolean | undefined,
|
|
882
|
+
): number
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
Resolves byte width for weight slab arrays.
|
|
886
|
+
|
|
887
|
+
Parameters:
|
|
888
|
+
- `useFloat32Weights` - - True when 32-bit weights are enabled.
|
|
889
|
+
|
|
890
|
+
Returns: Byte width for weight elements.
|
|
891
|
+
|
|
892
|
+
### _writeConnectionCoreFields
|
|
893
|
+
|
|
894
|
+
```ts
|
|
895
|
+
_writeConnectionCoreFields(
|
|
896
|
+
writeArrays: SlabWriteArrays,
|
|
897
|
+
connection: ConnectionInternals,
|
|
898
|
+
connectionIndex: number,
|
|
903
899
|
): void
|
|
904
900
|
```
|
|
905
901
|
|
|
906
|
-
|
|
902
|
+
Writes core fields for one connection into slab arrays.
|
|
907
903
|
|
|
908
904
|
Parameters:
|
|
909
|
-
- `
|
|
910
|
-
- `
|
|
911
|
-
- `
|
|
905
|
+
- `writeArrays` - - Core write arrays.
|
|
906
|
+
- `connection` - - Connection internals.
|
|
907
|
+
- `connectionIndex` - - Connection index.
|
|
912
908
|
|
|
913
909
|
Returns: Nothing.
|
|
914
910
|
|
|
915
|
-
###
|
|
911
|
+
### _writeConnectionGainField
|
|
916
912
|
|
|
917
913
|
```ts
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
914
|
+
_writeConnectionGainField(
|
|
915
|
+
buildContext: SlabBuildContext,
|
|
916
|
+
populateResult: SlabPopulateResult,
|
|
917
|
+
connection: ConnectionInternals,
|
|
918
|
+
connectionIndex: number,
|
|
921
919
|
): void
|
|
922
920
|
```
|
|
923
921
|
|
|
924
|
-
|
|
922
|
+
Writes gain field for one connection and updates gain flags.
|
|
925
923
|
|
|
926
924
|
Parameters:
|
|
927
|
-
- `
|
|
928
|
-
- `
|
|
925
|
+
- `buildContext` - - Slab build context.
|
|
926
|
+
- `populateResult` - - Mutable populate result.
|
|
927
|
+
- `connection` - - Connection internals.
|
|
928
|
+
- `connectionIndex` - - Connection index.
|
|
929
929
|
|
|
930
930
|
Returns: Nothing.
|
|
931
931
|
|
|
@@ -948,35 +948,35 @@ Parameters:
|
|
|
948
948
|
|
|
949
949
|
Returns: Nothing.
|
|
950
950
|
|
|
951
|
-
###
|
|
951
|
+
### asNetworkSlabProps
|
|
952
952
|
|
|
953
953
|
```ts
|
|
954
|
-
|
|
954
|
+
asNetworkSlabProps(
|
|
955
955
|
network: default,
|
|
956
|
-
):
|
|
956
|
+
): NetworkSlabProps
|
|
957
957
|
```
|
|
958
958
|
|
|
959
|
-
|
|
959
|
+
Cast network instance into internal slab-backed shape.
|
|
960
960
|
|
|
961
961
|
Parameters:
|
|
962
962
|
- `network` - - Target network.
|
|
963
963
|
|
|
964
|
-
Returns:
|
|
964
|
+
Returns: Internal slab-backed network representation.
|
|
965
965
|
|
|
966
|
-
###
|
|
966
|
+
### buildOutgoingOrder
|
|
967
967
|
|
|
968
968
|
```ts
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
buildOutgoingOrder(
|
|
970
|
+
outgoingOrderBuildContext: OutgoingOrderBuildContext,
|
|
971
971
|
): Uint32Array<ArrayBufferLike>
|
|
972
972
|
```
|
|
973
973
|
|
|
974
|
-
|
|
974
|
+
Build source-grouped outgoing order using CSR start offsets.
|
|
975
975
|
|
|
976
976
|
Parameters:
|
|
977
|
-
- `
|
|
977
|
+
- `outgoingOrderBuildContext` - - Context holding build data and start offsets.
|
|
978
978
|
|
|
979
|
-
Returns:
|
|
979
|
+
Returns: Ordered outgoing connection indices.
|
|
980
980
|
|
|
981
981
|
### buildOutgoingStartIndices
|
|
982
982
|
|
|
@@ -993,35 +993,35 @@ Parameters:
|
|
|
993
993
|
|
|
994
994
|
Returns: Outgoing start indices slab.
|
|
995
995
|
|
|
996
|
-
###
|
|
996
|
+
### collectFanOutCounts
|
|
997
997
|
|
|
998
998
|
```ts
|
|
999
|
-
|
|
1000
|
-
|
|
999
|
+
collectFanOutCounts(
|
|
1000
|
+
buildContext: BuildAdjacencyContext,
|
|
1001
1001
|
): Uint32Array<ArrayBufferLike>
|
|
1002
1002
|
```
|
|
1003
1003
|
|
|
1004
|
-
|
|
1004
|
+
Collect fan-out counts for each source node.
|
|
1005
1005
|
|
|
1006
1006
|
Parameters:
|
|
1007
|
-
- `
|
|
1007
|
+
- `buildContext` - - Shared adjacency build context.
|
|
1008
1008
|
|
|
1009
|
-
Returns:
|
|
1009
|
+
Returns: Fan-out counts per node.
|
|
1010
1010
|
|
|
1011
|
-
###
|
|
1011
|
+
### createBuildAdjacencyContext
|
|
1012
1012
|
|
|
1013
1013
|
```ts
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
):
|
|
1014
|
+
createBuildAdjacencyContext(
|
|
1015
|
+
network: default,
|
|
1016
|
+
): BuildAdjacencyContext | null
|
|
1017
1017
|
```
|
|
1018
1018
|
|
|
1019
|
-
|
|
1019
|
+
Build adjacency context when required slabs are available.
|
|
1020
1020
|
|
|
1021
1021
|
Parameters:
|
|
1022
|
-
- `
|
|
1022
|
+
- `network` - - Target network.
|
|
1023
1023
|
|
|
1024
|
-
Returns:
|
|
1024
|
+
Returns: Build context or null when adjacency cannot be built yet.
|
|
1025
1025
|
|
|
1026
1026
|
### createFanOutCollectionContext
|
|
1027
1027
|
|
|
@@ -1038,50 +1038,50 @@ Parameters:
|
|
|
1038
1038
|
|
|
1039
1039
|
Returns: Fan-out collection context.
|
|
1040
1040
|
|
|
1041
|
-
###
|
|
1041
|
+
### createFanOutCountsBuffer
|
|
1042
1042
|
|
|
1043
1043
|
```ts
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
):
|
|
1044
|
+
createFanOutCountsBuffer(
|
|
1045
|
+
nodeCount: number,
|
|
1046
|
+
): Uint32Array<ArrayBufferLike>
|
|
1047
1047
|
```
|
|
1048
1048
|
|
|
1049
|
-
|
|
1049
|
+
Allocate fan-out counts buffer.
|
|
1050
1050
|
|
|
1051
1051
|
Parameters:
|
|
1052
|
-
- `
|
|
1052
|
+
- `nodeCount` - - Number of nodes.
|
|
1053
1053
|
|
|
1054
|
-
Returns:
|
|
1054
|
+
Returns: Zero-initialized fan-out counts.
|
|
1055
1055
|
|
|
1056
|
-
###
|
|
1056
|
+
### createInsertionCursor
|
|
1057
1057
|
|
|
1058
1058
|
```ts
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
):
|
|
1059
|
+
createInsertionCursor(
|
|
1060
|
+
outgoingStartIndices: Uint32Array<ArrayBufferLike>,
|
|
1061
|
+
): Uint32Array<ArrayBufferLike>
|
|
1062
1062
|
```
|
|
1063
1063
|
|
|
1064
|
-
|
|
1064
|
+
Create insertion cursor copy from outgoing start indices.
|
|
1065
1065
|
|
|
1066
1066
|
Parameters:
|
|
1067
|
-
- `
|
|
1067
|
+
- `outgoingStartIndices` - - Outgoing start indices slab.
|
|
1068
1068
|
|
|
1069
|
-
Returns:
|
|
1069
|
+
Returns: Mutable insertion cursor.
|
|
1070
1070
|
|
|
1071
|
-
###
|
|
1071
|
+
### createOutgoingOrderBuffer
|
|
1072
1072
|
|
|
1073
1073
|
```ts
|
|
1074
|
-
|
|
1075
|
-
|
|
1074
|
+
createOutgoingOrderBuffer(
|
|
1075
|
+
connectionCount: number,
|
|
1076
1076
|
): Uint32Array<ArrayBufferLike>
|
|
1077
1077
|
```
|
|
1078
1078
|
|
|
1079
|
-
Allocate
|
|
1079
|
+
Allocate outgoing order buffer.
|
|
1080
1080
|
|
|
1081
1081
|
Parameters:
|
|
1082
|
-
- `
|
|
1082
|
+
- `connectionCount` - - Number of active connections.
|
|
1083
1083
|
|
|
1084
|
-
Returns:
|
|
1084
|
+
Returns: Outgoing order buffer.
|
|
1085
1085
|
|
|
1086
1086
|
### createOutgoingStartIndicesBuffer
|
|
1087
1087
|
|
|
@@ -1098,78 +1098,33 @@ Parameters:
|
|
|
1098
1098
|
|
|
1099
1099
|
Returns: Outgoing start indices buffer.
|
|
1100
1100
|
|
|
1101
|
-
###
|
|
1102
|
-
|
|
1103
|
-
```ts
|
|
1104
|
-
populateOutgoingStartIndices(
|
|
1105
|
-
context: { fanOutCounts: Uint32Array<ArrayBufferLike>; outgoingStartIndices: Uint32Array<ArrayBufferLike>; },
|
|
1106
|
-
): number
|
|
1107
|
-
```
|
|
1108
|
-
|
|
1109
|
-
Populate outgoing start indices and return terminal offset.
|
|
1110
|
-
|
|
1111
|
-
Parameters:
|
|
1112
|
-
- `context` - - Population context.
|
|
1113
|
-
|
|
1114
|
-
Returns: Terminal running offset after the last node.
|
|
1115
|
-
|
|
1116
|
-
### setTerminalOutgoingStartOffset
|
|
1117
|
-
|
|
1118
|
-
```ts
|
|
1119
|
-
setTerminalOutgoingStartOffset(
|
|
1120
|
-
context: { nodeCount: number; outgoingStartIndices: Uint32Array<ArrayBufferLike>; terminalRunningOffset: number; },
|
|
1121
|
-
): void
|
|
1122
|
-
```
|
|
1123
|
-
|
|
1124
|
-
Set terminal outgoing start offset at the tail slot.
|
|
1125
|
-
|
|
1126
|
-
Parameters:
|
|
1127
|
-
- `context` - - Terminal offset context.
|
|
1128
|
-
|
|
1129
|
-
Returns: Nothing.
|
|
1130
|
-
|
|
1131
|
-
### createOutgoingOrderBuffer
|
|
1132
|
-
|
|
1133
|
-
```ts
|
|
1134
|
-
createOutgoingOrderBuffer(
|
|
1135
|
-
connectionCount: number,
|
|
1136
|
-
): Uint32Array<ArrayBufferLike>
|
|
1137
|
-
```
|
|
1138
|
-
|
|
1139
|
-
Allocate outgoing order buffer.
|
|
1140
|
-
|
|
1141
|
-
Parameters:
|
|
1142
|
-
- `connectionCount` - - Number of active connections.
|
|
1143
|
-
|
|
1144
|
-
Returns: Outgoing order buffer.
|
|
1145
|
-
|
|
1146
|
-
### createInsertionCursor
|
|
1101
|
+
### hasRequiredConnectionSlabs
|
|
1147
1102
|
|
|
1148
1103
|
```ts
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
):
|
|
1104
|
+
hasRequiredConnectionSlabs(
|
|
1105
|
+
internalNet: NetworkSlabProps,
|
|
1106
|
+
): boolean
|
|
1152
1107
|
```
|
|
1153
1108
|
|
|
1154
|
-
|
|
1109
|
+
Check whether required connection slabs exist.
|
|
1155
1110
|
|
|
1156
1111
|
Parameters:
|
|
1157
|
-
- `
|
|
1112
|
+
- `internalNet` - - Internal slab-backed network representation.
|
|
1158
1113
|
|
|
1159
|
-
Returns:
|
|
1114
|
+
Returns: True when adjacency build prerequisites are present.
|
|
1160
1115
|
|
|
1161
|
-
###
|
|
1116
|
+
### incrementFanOutCountAtSource
|
|
1162
1117
|
|
|
1163
1118
|
```ts
|
|
1164
|
-
|
|
1165
|
-
context: {
|
|
1119
|
+
incrementFanOutCountAtSource(
|
|
1120
|
+
context: { fanOutCounts: Uint32Array<ArrayBufferLike>; connectionFromSlab: Uint32Array<ArrayBufferLike>; connectionIndex: number; },
|
|
1166
1121
|
): void
|
|
1167
1122
|
```
|
|
1168
1123
|
|
|
1169
|
-
|
|
1124
|
+
Increment fan-out count for one connection source index.
|
|
1170
1125
|
|
|
1171
1126
|
Parameters:
|
|
1172
|
-
- `context` - -
|
|
1127
|
+
- `context` - - Increment context.
|
|
1173
1128
|
|
|
1174
1129
|
Returns: Nothing.
|
|
1175
1130
|
|
|
@@ -1222,204 +1177,169 @@ Parameters:
|
|
|
1222
1177
|
|
|
1223
1178
|
Returns: Nothing.
|
|
1224
1179
|
|
|
1225
|
-
###
|
|
1226
|
-
|
|
1227
|
-
```ts
|
|
1228
|
-
hasRequiredConnectionSlabs(
|
|
1229
|
-
internalNet: NetworkSlabProps,
|
|
1230
|
-
): boolean
|
|
1231
|
-
```
|
|
1232
|
-
|
|
1233
|
-
Check whether required connection slabs exist.
|
|
1234
|
-
|
|
1235
|
-
Parameters:
|
|
1236
|
-
- `internalNet` - - Internal slab-backed network representation.
|
|
1237
|
-
|
|
1238
|
-
Returns: True when adjacency build prerequisites are present.
|
|
1239
|
-
|
|
1240
|
-
### asNetworkSlabProps
|
|
1180
|
+
### populateFanOutCounts
|
|
1241
1181
|
|
|
1242
1182
|
```ts
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
):
|
|
1183
|
+
populateFanOutCounts(
|
|
1184
|
+
fanOutCollectionContext: FanOutCollectionContext,
|
|
1185
|
+
): void
|
|
1246
1186
|
```
|
|
1247
1187
|
|
|
1248
|
-
|
|
1188
|
+
Populate fan-out counts from the connection source slab.
|
|
1249
1189
|
|
|
1250
1190
|
Parameters:
|
|
1251
|
-
- `
|
|
1252
|
-
|
|
1253
|
-
Returns: Internal slab-backed network representation.
|
|
1254
|
-
|
|
1255
|
-
## architecture/network/slab/network.slab.fast-path.helpers.utils.ts
|
|
1191
|
+
- `fanOutCollectionContext` - - Fan-out collection context.
|
|
1256
1192
|
|
|
1257
|
-
|
|
1193
|
+
Returns: Nothing.
|
|
1258
1194
|
|
|
1259
|
-
###
|
|
1195
|
+
### populateOutgoingOrder
|
|
1260
1196
|
|
|
1261
1197
|
```ts
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
):
|
|
1198
|
+
populateOutgoingOrder(
|
|
1199
|
+
context: { connectionCount: number; connectionFromSlab: Uint32Array<ArrayBufferLike>; outgoingOrder: Uint32Array<ArrayBufferLike>; insertionCursor: Uint32Array<ArrayBufferLike>; },
|
|
1200
|
+
): void
|
|
1265
1201
|
```
|
|
1266
1202
|
|
|
1267
|
-
|
|
1203
|
+
Populate outgoing order by source-grouped insertion.
|
|
1268
1204
|
|
|
1269
1205
|
Parameters:
|
|
1270
|
-
- `
|
|
1206
|
+
- `context` - - Outgoing order population context.
|
|
1271
1207
|
|
|
1272
|
-
Returns:
|
|
1208
|
+
Returns: Nothing.
|
|
1273
1209
|
|
|
1274
|
-
###
|
|
1210
|
+
### populateOutgoingStartIndices
|
|
1275
1211
|
|
|
1276
1212
|
```ts
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
): number[] | null
|
|
1213
|
+
populateOutgoingStartIndices(
|
|
1214
|
+
context: { fanOutCounts: Uint32Array<ArrayBufferLike>; outgoingStartIndices: Uint32Array<ArrayBufferLike>; },
|
|
1215
|
+
): number
|
|
1281
1216
|
```
|
|
1282
1217
|
|
|
1283
|
-
|
|
1218
|
+
Populate outgoing start indices and return terminal offset.
|
|
1284
1219
|
|
|
1285
1220
|
Parameters:
|
|
1286
|
-
- `
|
|
1287
|
-
- `input` - - Activation input.
|
|
1221
|
+
- `context` - - Population context.
|
|
1288
1222
|
|
|
1289
|
-
Returns:
|
|
1223
|
+
Returns: Terminal running offset after the last node.
|
|
1290
1224
|
|
|
1291
|
-
###
|
|
1225
|
+
### publishAdjacency
|
|
1292
1226
|
|
|
1293
1227
|
```ts
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
input: number[],
|
|
1298
|
-
): number[] | null
|
|
1228
|
+
publishAdjacency(
|
|
1229
|
+
publishAdjacencyContext: PublishAdjacencyContext,
|
|
1230
|
+
): void
|
|
1299
1231
|
```
|
|
1300
1232
|
|
|
1301
|
-
|
|
1233
|
+
Publish adjacency slabs and clear dirty flag.
|
|
1302
1234
|
|
|
1303
1235
|
Parameters:
|
|
1304
|
-
- `
|
|
1305
|
-
- `internalNet` - - Internal slab runtime shape.
|
|
1306
|
-
- `input` - - Activation input.
|
|
1236
|
+
- `publishAdjacencyContext` - - Values to publish on the internal network slab state.
|
|
1307
1237
|
|
|
1308
|
-
Returns:
|
|
1238
|
+
Returns: Nothing.
|
|
1309
1239
|
|
|
1310
|
-
###
|
|
1240
|
+
### setTerminalOutgoingStartOffset
|
|
1311
1241
|
|
|
1312
1242
|
```ts
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
internalNet: NetworkSlabProps,
|
|
1316
|
-
reindexNodes: (network: default) => void,
|
|
1243
|
+
setTerminalOutgoingStartOffset(
|
|
1244
|
+
context: { nodeCount: number; outgoingStartIndices: Uint32Array<ArrayBufferLike>; terminalRunningOffset: number; },
|
|
1317
1245
|
): void
|
|
1318
1246
|
```
|
|
1319
1247
|
|
|
1320
|
-
|
|
1248
|
+
Set terminal outgoing start offset at the tail slot.
|
|
1321
1249
|
|
|
1322
1250
|
Parameters:
|
|
1323
|
-
- `
|
|
1324
|
-
- `internalNet` - - Internal slab runtime shape.
|
|
1325
|
-
- `reindexNodes` - - Callback used to reindex nodes when needed.
|
|
1251
|
+
- `context` - - Terminal offset context.
|
|
1326
1252
|
|
|
1327
1253
|
Returns: Nothing.
|
|
1328
1254
|
|
|
1329
|
-
|
|
1255
|
+
## architecture/network/slab/network.slab.fast-path.helpers.utils.ts
|
|
1256
|
+
|
|
1257
|
+
Internal fast slab activation helpers extracted from network.slab.utils.ts.
|
|
1258
|
+
|
|
1259
|
+
### _activateThroughLegacyPath
|
|
1330
1260
|
|
|
1331
1261
|
```ts
|
|
1332
|
-
|
|
1262
|
+
_activateThroughLegacyPath(
|
|
1333
1263
|
network: default,
|
|
1334
|
-
|
|
1335
|
-
):
|
|
1264
|
+
input: number[],
|
|
1265
|
+
): number[]
|
|
1336
1266
|
```
|
|
1337
1267
|
|
|
1338
|
-
|
|
1268
|
+
Executes legacy network activation fallback.
|
|
1339
1269
|
|
|
1340
1270
|
Parameters:
|
|
1341
1271
|
- `network` - - Target network.
|
|
1342
|
-
- `
|
|
1272
|
+
- `input` - - Activation input.
|
|
1343
1273
|
|
|
1344
|
-
Returns:
|
|
1274
|
+
Returns: Legacy activation output.
|
|
1345
1275
|
|
|
1346
|
-
###
|
|
1276
|
+
### _canUseFastSlab
|
|
1347
1277
|
|
|
1348
1278
|
```ts
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
): void
|
|
1279
|
+
_canUseFastSlab(
|
|
1280
|
+
training: boolean,
|
|
1281
|
+
): boolean
|
|
1353
1282
|
```
|
|
1354
1283
|
|
|
1355
|
-
|
|
1284
|
+
Predicate gating usage of high-performance slab forward pass.
|
|
1356
1285
|
|
|
1357
1286
|
Parameters:
|
|
1358
|
-
- `
|
|
1359
|
-
- `nodeCount` - - Node count.
|
|
1287
|
+
- `training` - - Whether caller is in training mode.
|
|
1360
1288
|
|
|
1361
|
-
Returns:
|
|
1289
|
+
Returns: True if fast path can be safely used.
|
|
1362
1290
|
|
|
1363
|
-
###
|
|
1291
|
+
### _collectFastSlabOutput
|
|
1364
1292
|
|
|
1365
1293
|
```ts
|
|
1366
|
-
|
|
1294
|
+
_collectFastSlabOutput(
|
|
1367
1295
|
network: default,
|
|
1368
|
-
input: number[],
|
|
1369
1296
|
activationBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1370
|
-
|
|
1297
|
+
nodeCount: number,
|
|
1298
|
+
): number[]
|
|
1371
1299
|
```
|
|
1372
1300
|
|
|
1373
|
-
|
|
1301
|
+
Collects output activations into detached number array.
|
|
1374
1302
|
|
|
1375
1303
|
Parameters:
|
|
1376
1304
|
- `network` - - Target network.
|
|
1377
|
-
- `input` - - Activation input.
|
|
1378
1305
|
- `activationBuffer` - - Activation buffer.
|
|
1306
|
+
- `nodeCount` - - Node count.
|
|
1379
1307
|
|
|
1380
|
-
Returns:
|
|
1308
|
+
Returns: Output activation array.
|
|
1381
1309
|
|
|
1382
|
-
###
|
|
1310
|
+
### _createFastActivationBuffer
|
|
1383
1311
|
|
|
1384
1312
|
```ts
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
activationBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1390
|
-
stateBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1391
|
-
): void
|
|
1313
|
+
_createFastActivationBuffer(
|
|
1314
|
+
useFloat32Activation: boolean,
|
|
1315
|
+
nodeCount: number,
|
|
1316
|
+
): Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>
|
|
1392
1317
|
```
|
|
1393
1318
|
|
|
1394
|
-
|
|
1319
|
+
Creates typed fast activation/state buffer.
|
|
1395
1320
|
|
|
1396
1321
|
Parameters:
|
|
1397
|
-
- `
|
|
1398
|
-
- `
|
|
1399
|
-
- `topoOrder` - - Topological node order.
|
|
1400
|
-
- `activationBuffer` - - Activation buffer.
|
|
1401
|
-
- `stateBuffer` - - State buffer.
|
|
1322
|
+
- `useFloat32Activation` - - True when 32-bit buffer is required.
|
|
1323
|
+
- `nodeCount` - - Node count.
|
|
1402
1324
|
|
|
1403
|
-
Returns:
|
|
1325
|
+
Returns: New typed buffer.
|
|
1404
1326
|
|
|
1405
|
-
###
|
|
1327
|
+
### _ensureFastSlabBuffers
|
|
1406
1328
|
|
|
1407
1329
|
```ts
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
activationBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1330
|
+
_ensureFastSlabBuffers(
|
|
1331
|
+
internalNet: NetworkSlabProps,
|
|
1411
1332
|
nodeCount: number,
|
|
1412
|
-
):
|
|
1333
|
+
): void
|
|
1413
1334
|
```
|
|
1414
1335
|
|
|
1415
|
-
|
|
1336
|
+
Ensures fast activation/state buffers are allocated and shape-compatible.
|
|
1416
1337
|
|
|
1417
1338
|
Parameters:
|
|
1418
|
-
- `
|
|
1419
|
-
- `activationBuffer` - - Activation buffer.
|
|
1339
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
1420
1340
|
- `nodeCount` - - Node count.
|
|
1421
1341
|
|
|
1422
|
-
Returns:
|
|
1342
|
+
Returns: Nothing.
|
|
1423
1343
|
|
|
1424
1344
|
### _hasFastSlabPrerequisites
|
|
1425
1345
|
|
|
@@ -1436,35 +1356,26 @@ Parameters:
|
|
|
1436
1356
|
|
|
1437
1357
|
Returns: True when all required slabs/adjacency arrays exist.
|
|
1438
1358
|
|
|
1439
|
-
###
|
|
1440
|
-
|
|
1441
|
-
```ts
|
|
1442
|
-
_activateThroughLegacyPath(
|
|
1443
|
-
network: default,
|
|
1444
|
-
input: number[],
|
|
1445
|
-
): number[]
|
|
1446
|
-
```
|
|
1447
|
-
|
|
1448
|
-
Executes legacy network activation fallback.
|
|
1449
|
-
|
|
1450
|
-
Parameters:
|
|
1451
|
-
- `network` - - Target network.
|
|
1452
|
-
- `input` - - Activation input.
|
|
1453
|
-
|
|
1454
|
-
Returns: Legacy activation output.
|
|
1455
|
-
|
|
1456
|
-
### _recomputeTopologyOrder
|
|
1359
|
+
### _maybeActivateNonInputNode
|
|
1457
1360
|
|
|
1458
1361
|
```ts
|
|
1459
|
-
|
|
1362
|
+
_maybeActivateNonInputNode(
|
|
1460
1363
|
network: default,
|
|
1364
|
+
node: FastSlabNodeRuntime,
|
|
1365
|
+
nodeIndex: number,
|
|
1366
|
+
stateBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1367
|
+
activationBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1461
1368
|
): void
|
|
1462
1369
|
```
|
|
1463
1370
|
|
|
1464
|
-
|
|
1371
|
+
Activates one non-input node when required.
|
|
1465
1372
|
|
|
1466
1373
|
Parameters:
|
|
1467
1374
|
- `network` - - Target network.
|
|
1375
|
+
- `node` - - Current node.
|
|
1376
|
+
- `nodeIndex` - - Node index.
|
|
1377
|
+
- `stateBuffer` - - State buffer.
|
|
1378
|
+
- `activationBuffer` - - Activation buffer.
|
|
1468
1379
|
|
|
1469
1380
|
Returns: Nothing.
|
|
1470
1381
|
|
|
@@ -1487,60 +1398,45 @@ Parameters:
|
|
|
1487
1398
|
|
|
1488
1399
|
Returns: True when replacement is needed.
|
|
1489
1400
|
|
|
1490
|
-
###
|
|
1491
|
-
|
|
1492
|
-
```ts
|
|
1493
|
-
_createFastActivationBuffer(
|
|
1494
|
-
useFloat32Activation: boolean,
|
|
1495
|
-
nodeCount: number,
|
|
1496
|
-
): Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>
|
|
1497
|
-
```
|
|
1498
|
-
|
|
1499
|
-
Creates typed fast activation/state buffer.
|
|
1500
|
-
|
|
1501
|
-
Parameters:
|
|
1502
|
-
- `useFloat32Activation` - - True when 32-bit buffer is required.
|
|
1503
|
-
- `nodeCount` - - Node count.
|
|
1504
|
-
|
|
1505
|
-
Returns: New typed buffer.
|
|
1506
|
-
|
|
1507
|
-
### _writeInputNodeRuntime
|
|
1401
|
+
### _prepareFastSlabRuntime
|
|
1508
1402
|
|
|
1509
1403
|
```ts
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1404
|
+
_prepareFastSlabRuntime(
|
|
1405
|
+
network: default,
|
|
1406
|
+
internalNet: NetworkSlabProps,
|
|
1407
|
+
reindexNodes: (network: default) => void,
|
|
1513
1408
|
): void
|
|
1514
1409
|
```
|
|
1515
1410
|
|
|
1516
|
-
|
|
1411
|
+
Prepares topology and indices for fast slab pass.
|
|
1517
1412
|
|
|
1518
1413
|
Parameters:
|
|
1519
|
-
- `
|
|
1520
|
-
- `
|
|
1414
|
+
- `network` - - Target network.
|
|
1415
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
1416
|
+
- `reindexNodes` - - Callback used to reindex nodes when needed.
|
|
1521
1417
|
|
|
1522
1418
|
Returns: Nothing.
|
|
1523
1419
|
|
|
1524
|
-
###
|
|
1420
|
+
### _propagateFastSlabActivations
|
|
1525
1421
|
|
|
1526
1422
|
```ts
|
|
1527
|
-
|
|
1423
|
+
_propagateFastSlabActivations(
|
|
1528
1424
|
network: default,
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
stateBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1425
|
+
internalNet: NetworkSlabProps,
|
|
1426
|
+
topoOrder: FastSlabNodeRuntime[],
|
|
1532
1427
|
activationBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1428
|
+
stateBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1533
1429
|
): void
|
|
1534
1430
|
```
|
|
1535
1431
|
|
|
1536
|
-
|
|
1432
|
+
Propagates activations through topology using slab arrays.
|
|
1537
1433
|
|
|
1538
1434
|
Parameters:
|
|
1539
1435
|
- `network` - - Target network.
|
|
1540
|
-
- `
|
|
1541
|
-
- `
|
|
1542
|
-
- `stateBuffer` - - State buffer.
|
|
1436
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
1437
|
+
- `topoOrder` - - Topological node order.
|
|
1543
1438
|
- `activationBuffer` - - Activation buffer.
|
|
1439
|
+
- `stateBuffer` - - State buffer.
|
|
1544
1440
|
|
|
1545
1441
|
Returns: Nothing.
|
|
1546
1442
|
|
|
@@ -1573,6 +1469,38 @@ Parameters:
|
|
|
1573
1469
|
|
|
1574
1470
|
Returns: Nothing.
|
|
1575
1471
|
|
|
1472
|
+
### _recomputeTopologyOrder
|
|
1473
|
+
|
|
1474
|
+
```ts
|
|
1475
|
+
_recomputeTopologyOrder(
|
|
1476
|
+
network: default,
|
|
1477
|
+
): void
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
Recomputes topological order on demand.
|
|
1481
|
+
|
|
1482
|
+
Parameters:
|
|
1483
|
+
- `network` - - Target network.
|
|
1484
|
+
|
|
1485
|
+
Returns: Nothing.
|
|
1486
|
+
|
|
1487
|
+
### _resolveFastTopoOrder
|
|
1488
|
+
|
|
1489
|
+
```ts
|
|
1490
|
+
_resolveFastTopoOrder(
|
|
1491
|
+
network: default,
|
|
1492
|
+
internalNet: NetworkSlabProps,
|
|
1493
|
+
): FastSlabNodeRuntime[]
|
|
1494
|
+
```
|
|
1495
|
+
|
|
1496
|
+
Resolves topological iteration order for fast slab pass.
|
|
1497
|
+
|
|
1498
|
+
Parameters:
|
|
1499
|
+
- `network` - - Target network.
|
|
1500
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
1501
|
+
|
|
1502
|
+
Returns: Topological node order.
|
|
1503
|
+
|
|
1576
1504
|
### _resolveWeightedConnectionValue
|
|
1577
1505
|
|
|
1578
1506
|
```ts
|
|
@@ -1591,3 +1519,75 @@ Parameters:
|
|
|
1591
1519
|
- `connectionIndex` - - Connection index.
|
|
1592
1520
|
|
|
1593
1521
|
Returns: Effective weighted value.
|
|
1522
|
+
|
|
1523
|
+
### _seedFastInputLayer
|
|
1524
|
+
|
|
1525
|
+
```ts
|
|
1526
|
+
_seedFastInputLayer(
|
|
1527
|
+
network: default,
|
|
1528
|
+
input: number[],
|
|
1529
|
+
activationBuffer: Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike>,
|
|
1530
|
+
): void
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
Seeds input-layer activations for fast slab pass.
|
|
1534
|
+
|
|
1535
|
+
Parameters:
|
|
1536
|
+
- `network` - - Target network.
|
|
1537
|
+
- `input` - - Activation input.
|
|
1538
|
+
- `activationBuffer` - - Activation buffer.
|
|
1539
|
+
|
|
1540
|
+
Returns: Nothing.
|
|
1541
|
+
|
|
1542
|
+
### _tryFastSlabFallbackForGating
|
|
1543
|
+
|
|
1544
|
+
```ts
|
|
1545
|
+
_tryFastSlabFallbackForGating(
|
|
1546
|
+
network: default,
|
|
1547
|
+
input: number[],
|
|
1548
|
+
): number[] | null
|
|
1549
|
+
```
|
|
1550
|
+
|
|
1551
|
+
Falls back to legacy activation when gating is present.
|
|
1552
|
+
|
|
1553
|
+
Parameters:
|
|
1554
|
+
- `network` - - Target network.
|
|
1555
|
+
- `input` - - Activation input.
|
|
1556
|
+
|
|
1557
|
+
Returns: Legacy output or null when fast path may continue.
|
|
1558
|
+
|
|
1559
|
+
### _tryFastSlabFallbackForMissingPrerequisites
|
|
1560
|
+
|
|
1561
|
+
```ts
|
|
1562
|
+
_tryFastSlabFallbackForMissingPrerequisites(
|
|
1563
|
+
network: default,
|
|
1564
|
+
internalNet: NetworkSlabProps,
|
|
1565
|
+
input: number[],
|
|
1566
|
+
): number[] | null
|
|
1567
|
+
```
|
|
1568
|
+
|
|
1569
|
+
Falls back to legacy activation when slab prerequisites are missing.
|
|
1570
|
+
|
|
1571
|
+
Parameters:
|
|
1572
|
+
- `network` - - Target network.
|
|
1573
|
+
- `internalNet` - - Internal slab runtime shape.
|
|
1574
|
+
- `input` - - Activation input.
|
|
1575
|
+
|
|
1576
|
+
Returns: Legacy output or null when fast path may continue.
|
|
1577
|
+
|
|
1578
|
+
### _writeInputNodeRuntime
|
|
1579
|
+
|
|
1580
|
+
```ts
|
|
1581
|
+
_writeInputNodeRuntime(
|
|
1582
|
+
node: default,
|
|
1583
|
+
inputValue: number,
|
|
1584
|
+
): void
|
|
1585
|
+
```
|
|
1586
|
+
|
|
1587
|
+
Writes runtime activation/state for one input node.
|
|
1588
|
+
|
|
1589
|
+
Parameters:
|
|
1590
|
+
- `node` - - Input node.
|
|
1591
|
+
- `inputValue` - - Input activation value.
|
|
1592
|
+
|
|
1593
|
+
Returns: Nothing.
|