@reicek/neataptic-ts 0.1.26 → 0.1.27
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/agents/boundary-mapper.agent.md +13 -8
- package/.github/agents/docs-scout.agent.md +14 -9
- package/.github/agents/plan-scout.agent.md +11 -6
- package/.github/agents/solid-split.agent.md +33 -17
- package/.github/copilot-instructions.md +100 -88
- package/.github/skills/educational-docs/SKILL.md +90 -40
- package/.github/skills/educational-docs/assets/mermaid-diagram-playbook.md +141 -141
- package/.github/skills/educational-docs/assets/visual-style-guide.md +1 -1
- package/.github/skills/plan-alignment/SKILL.md +1 -1
- package/.github/skills/solid-split/SKILL.md +54 -35
- package/.github/skills/solid-split/assets/docs-checklist.md +1 -1
- package/.github/skills/solid-split/assets/split-plan-template.md +41 -12
- package/.github/skills/solid-split/assets/split-workflow-checklist.md +4 -1
- package/.github/skills/test-fix-workflow/SKILL.md +12 -7
- package/.github/skills/trace-analyzer-extension/SKILL.md +1 -1
- 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 +1 -1
- package/.github/skills/trace-audit-reporting/assets/performance-report-template.md +1 -1
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
- package/.github/skills/tracker-handoff/SKILL.md +53 -5
- package/package.json +1 -1
- package/plans/Flappy_Bird_Folder_Documentation_Pass.logs.md +42 -0
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +22 -104
- package/plans/README.md +6 -2
- package/plans/Roadmap.md +35 -31
- package/plans/analyze-trace-solid-split.logs.md +35 -0
- package/plans/analyze-trace-solid-split.plans.md +21 -52
- package/plans/architecture-solid-split.logs.md +44 -0
- package/plans/architecture-solid-split.plans.md +20 -653
- package/plans/asciiMaze-typescript-repair.logs.md +35 -0
- package/plans/asciiMaze-typescript-repair.plans.md +30 -36
- package/plans/generate-docs-solid-split.logs.md +36 -0
- package/plans/generate-docs-solid-split.plans.md +21 -73
- package/plans/methods-docs.logs.md +37 -0
- package/plans/methods-docs.plans.md +22 -183
- package/plans/methods-solid-split.logs.md +41 -0
- package/plans/methods-solid-split.plans.md +23 -65
- package/plans/neat-docs.logs.md +38 -0
- package/plans/neat-docs.plans.md +21 -63
- package/plans/neat-test-surface-repair.logs.md +38 -0
- package/plans/neat-test-surface-repair.plans.md +24 -24
- package/plans/readme-first-section-pass.logs.md +63 -0
- package/plans/readme-first-section-pass.plans.md +42 -0
- package/plans/render-docs-html-solid-split.logs.md +36 -0
- package/plans/render-docs-html-solid-split.plans.md +20 -54
- package/plans/src-no-explicit-any-cleanup.logs.md +39 -0
- package/plans/src-no-explicit-any-cleanup.plans.md +23 -161
- package/plans/utils-docs.logs.md +37 -0
- package/plans/utils-docs.plans.md +20 -35
- package/src/README.md +88 -22
- package/src/architecture/README.md +94 -17
- package/src/architecture/activationArrayPool/README.md +53 -0
- package/src/architecture/activationArrayPool/activationArrayPool.ts +53 -0
- package/src/architecture/layer/README.md +94 -5
- package/src/architecture/layer/layer.ts +94 -5
- package/src/architecture/network/README.md +85 -14
- package/src/architecture/network/activate/README.md +301 -213
- package/src/architecture/network/activate/docs.order.json +9 -0
- package/src/architecture/network/activate/network.activate.utils.ts +90 -0
- package/src/architecture/network/connect/README.md +80 -3
- package/src/architecture/network/connect/docs.order.json +9 -0
- package/src/architecture/network/connect/network.connect.utils.ts +79 -0
- package/src/architecture/network/deterministic/README.md +96 -12
- package/src/architecture/network/deterministic/docs.order.json +10 -0
- package/src/architecture/network/deterministic/network.deterministic.utils.ts +90 -0
- package/src/architecture/network/evolve/README.md +286 -228
- package/src/architecture/network/evolve/docs.order.json +11 -0
- package/src/architecture/network/evolve/network.evolve.utils.ts +59 -0
- package/src/architecture/network/gating/README.md +58 -16
- package/src/architecture/network/gating/docs.order.json +9 -0
- package/src/architecture/network/gating/network.gating.utils.ts +43 -0
- package/src/architecture/network/genetic/README.md +75 -36
- package/src/architecture/network/genetic/docs.order.json +10 -0
- package/src/architecture/network/genetic/network.genetic.utils.ts +53 -17
- package/src/architecture/network/network.ts +91 -46
- package/src/architecture/network/standalone/README.md +309 -285
- package/src/architecture/network/standalone/docs.order.json +13 -0
- package/src/architecture/network/standalone/network.standalone.utils.ts +51 -28
- package/src/architecture/network.ts +94 -17
- package/src/architecture/nodePool/README.md +53 -0
- package/src/architecture/nodePool/nodePool.ts +53 -0
- package/src/methods/README.md +80 -34
- package/src/methods/methods.ts +80 -34
- package/src/methods/mutation/README.md +39 -93
- package/src/methods/mutation/mutation.ts +58 -0
- package/src/multithreading/README.md +114 -14
- package/src/multithreading/docs.order.json +5 -0
- package/src/multithreading/multi.ts +103 -7
- package/src/multithreading/types.ts +6 -1
- package/src/multithreading/workers/README.md +72 -2
- package/src/multithreading/workers/browser/README.md +39 -0
- package/src/multithreading/workers/browser/testworker.ts +40 -0
- package/src/multithreading/workers/node/README.md +50 -11
- package/src/multithreading/workers/node/docs.order.json +4 -0
- package/src/multithreading/workers/node/testworker.ts +43 -3
- package/src/multithreading/workers/workers.ts +36 -1
- package/src/neat/README.md +230 -152
- package/src/neat/adaptive/core/README.md +99 -42
- package/src/neat/adaptive/core/adaptive.core.ts +71 -14
- package/src/neat/adaptive/core/docs.order.json +8 -0
- package/src/neat/docs.order.json +9 -0
- package/src/neat/lineage/README.md +118 -16
- package/src/neat/lineage/lineage.ts +115 -13
- package/src/neat/neat.defaults.constants.ts +91 -13
- package/src/neat.ts +86 -20
- package/src/utils/README.md +71 -21
- package/src/utils/memory.ts +69 -19
- package/test/examples/asciiMaze/browser-entry/README.md +81 -8
- package/test/examples/asciiMaze/browser-entry/browser-entry.ts +81 -8
- package/test/examples/asciiMaze/dashboardManager/README.md +68 -4
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +68 -4
- package/test/examples/asciiMaze/evolutionEngine/README.md +1259 -1174
- package/test/examples/asciiMaze/evolutionEngine/docs.order.json +10 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +87 -0
- package/test/examples/asciiMaze/mazeMovement/README.md +81 -4
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +81 -4
- package/test/examples/flappy_bird/browser-entry/README.md +64 -21
- package/test/examples/flappy_bird/browser-entry/browser-entry.ts +64 -21
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +98 -10
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +98 -10
- package/test/examples/flappy_bird/simulation-shared/README.md +88 -4
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.types.ts +88 -4
|
@@ -1,146 +1,57 @@
|
|
|
1
1
|
# architecture/network/standalone
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## architecture/network/standalone/network.standalone.utils.types.ts
|
|
6
|
-
|
|
7
|
-
### ACTIVATION_PRECISION_F32
|
|
8
|
-
|
|
9
|
-
Precision token selecting Float32 activation/state buffers.
|
|
10
|
-
|
|
11
|
-
### ARROW_TOKEN
|
|
12
|
-
|
|
13
|
-
Arrow token used during function-source normalization.
|
|
14
|
-
|
|
15
|
-
### BUILTIN_ACTIVATION_SNIPPETS
|
|
16
|
-
|
|
17
|
-
Built-in activation snippets emitted as named JavaScript function declarations.
|
|
18
|
-
|
|
19
|
-
Values are intentionally compact so emitted standalone source remains deterministic and small.
|
|
20
|
-
|
|
21
|
-
### COVERAGE_CALL_REGEX
|
|
22
|
-
|
|
23
|
-
Regex stripping Istanbul function invocations from source snippets.
|
|
24
|
-
|
|
25
|
-
### COVERAGE_COUNTER_REGEX
|
|
26
|
-
|
|
27
|
-
Regex stripping Istanbul counters from stringified functions.
|
|
28
|
-
|
|
29
|
-
### COVERAGE_REPLACEMENT
|
|
30
|
-
|
|
31
|
-
Empty replacement used while stripping coverage artifacts.
|
|
32
|
-
|
|
33
|
-
### EMPTY_TOKEN_REGEX
|
|
34
|
-
|
|
35
|
-
Regex removing empty punctuation-only token lines.
|
|
36
|
-
|
|
37
|
-
### FALLBACK_IDENTITY_BODY
|
|
38
|
-
|
|
39
|
-
Identity-function fallback body for invalid custom squash sources.
|
|
40
|
-
|
|
41
|
-
### FLOAT32_ARRAY_TYPE
|
|
42
|
-
|
|
43
|
-
Typed-array constructor names used in generated source.
|
|
44
|
-
|
|
45
|
-
### FLOAT64_ARRAY_TYPE
|
|
46
|
-
|
|
47
|
-
Typed-array constructor names used in generated source.
|
|
48
|
-
|
|
49
|
-
### FUNCTION_PREFIX
|
|
50
|
-
|
|
51
|
-
Prefix token used when normalizing function sources.
|
|
52
|
-
|
|
53
|
-
### INPUT_LOOP_LINE
|
|
54
|
-
|
|
55
|
-
Generated source line for copying external inputs into activation buffer.
|
|
56
|
-
|
|
57
|
-
### INVALID_INPUT_SIZE_ERROR_MIDDLE
|
|
58
|
-
|
|
59
|
-
Input-size validation message fragments for generated activate guards.
|
|
60
|
-
|
|
61
|
-
### INVALID_INPUT_SIZE_ERROR_PREFIX
|
|
62
|
-
|
|
63
|
-
Input-size validation message fragments for generated activate guards.
|
|
64
|
-
|
|
65
|
-
### ISTANBUL_IGNORE_BLOCK_REGEX
|
|
66
|
-
|
|
67
|
-
Regex stripping Istanbul ignore blocks from stringified functions.
|
|
68
|
-
|
|
69
|
-
### MASK_MULTIPLIER_IDENTITY
|
|
70
|
-
|
|
71
|
-
Multiplicative identity used to omit redundant mask expressions.
|
|
72
|
-
|
|
73
|
-
### NO_OUTPUT_NODES_ERROR
|
|
74
|
-
|
|
75
|
-
Error message when attempting standalone generation without outputs.
|
|
76
|
-
|
|
77
|
-
### OUTPUT_NODE_TYPE
|
|
78
|
-
|
|
79
|
-
Output node discriminator used for standalone precondition checks.
|
|
80
|
-
|
|
81
|
-
### REPEATED_SEMICOLON_REGEX
|
|
82
|
-
|
|
83
|
-
Regex collapsing repeated semicolons.
|
|
84
|
-
|
|
85
|
-
### SINGLE_TERM_FALLBACK
|
|
86
|
-
|
|
87
|
-
Fallback literal used when a node has no incoming terms.
|
|
3
|
+
Standalone code-generation boundary for turning a live `Network` into a
|
|
4
|
+
self-contained inference function.
|
|
88
5
|
|
|
89
|
-
|
|
6
|
+
This chapter exists for the moment when the graph has finished evolving or
|
|
7
|
+
training and the next question is no longer "how do I mutate it?" but "how
|
|
8
|
+
do I ship or inspect its forward pass without the whole runtime?" The
|
|
9
|
+
standalone generator answers by snapshotting node state, connection order,
|
|
10
|
+
gating terms, and activation functions into a plain JavaScript source string
|
|
11
|
+
that can be persisted, reviewed, or evaluated elsewhere.
|
|
90
12
|
|
|
91
|
-
|
|
13
|
+
The folder is intentionally split like a miniature compiler pipeline.
|
|
14
|
+
`setup` validates the network and seeds stable indexes, `graph` and `loop`
|
|
15
|
+
collect the execution lines, `activation` and `coverage` normalize emitted
|
|
16
|
+
function bodies, and `finalize` folds everything into the finished source
|
|
17
|
+
string. That keeps the README focused on the transformation stages instead
|
|
18
|
+
of a flat shelf of string helpers.
|
|
92
19
|
|
|
93
|
-
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart LR
|
|
22
|
+
Runtime[Runtime Network] --> Snapshot[Seed stable indexes and state]
|
|
23
|
+
Snapshot --> Emit[Emit computation lines]
|
|
24
|
+
Emit --> Assemble[Assemble source string]
|
|
25
|
+
Assemble --> ActivateFn[Standalone activator]
|
|
26
|
+
```
|
|
94
27
|
|
|
95
|
-
|
|
28
|
+
The important constraint is scope. The generated artifact is for forward
|
|
29
|
+
inference only. It keeps fixed weights, gating, and simple recurrent
|
|
30
|
+
self-connections, but it intentionally omits training-time randomness,
|
|
31
|
+
backpropagation, and any runtime machinery that requires the full library
|
|
32
|
+
around it.
|
|
96
33
|
|
|
97
|
-
|
|
34
|
+
Example: emit a portable source string and persist it with the rest of a
|
|
35
|
+
model package.
|
|
98
36
|
|
|
99
37
|
```ts
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
derivate: boolean | undefined,
|
|
103
|
-
): number
|
|
38
|
+
const source = network.standalone();
|
|
39
|
+
console.log(source.slice(0, 120));
|
|
104
40
|
```
|
|
105
41
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
### STRAY_COMMA_CLOSE_REGEX
|
|
109
|
-
|
|
110
|
-
Regex normalizing stray commas near closing parentheses.
|
|
111
|
-
|
|
112
|
-
### STRAY_COMMA_OPEN_REGEX
|
|
42
|
+
Example: evaluate the emitted source in a sandbox and compare inference
|
|
43
|
+
results against the original runtime.
|
|
113
44
|
|
|
114
|
-
|
|
45
|
+
```ts
|
|
46
|
+
const source = network.standalone();
|
|
47
|
+
const activate = new Function(`return ${source}`)() as (
|
|
48
|
+
input: number[],
|
|
49
|
+
) => number[];
|
|
50
|
+
const outputValues = activate([0.2, 0.8]);
|
|
51
|
+
```
|
|
115
52
|
|
|
116
53
|
## architecture/network/standalone/network.standalone.utils.ts
|
|
117
54
|
|
|
118
|
-
Standalone forward pass code generator.
|
|
119
|
-
|
|
120
|
-
Purpose:
|
|
121
|
-
Transforms a dynamic Network instance (object graph with Nodes / Connections / gating metadata)
|
|
122
|
-
into a self-contained JavaScript function string that, when evaluated, returns an `activate(input)`
|
|
123
|
-
function capable of performing forward propagation without the original library runtime.
|
|
124
|
-
|
|
125
|
-
Why generate code?
|
|
126
|
-
- Deployment: Embed a compact, dependency‑free inference function in environments where bundling
|
|
127
|
-
the full evolutionary framework is unnecessary (e.g. model cards, edge scripts, CI sanity checks).
|
|
128
|
-
- Performance: Remove dynamic indirection (property lookups, virtual dispatch) by specializing
|
|
129
|
-
the computation graph into straight‑line code and simple loops; JS engines can optimize this.
|
|
130
|
-
- Readability: Emitted source is human-readable so users can inspect weighted sums and activations.
|
|
131
|
-
|
|
132
|
-
Features Supported:
|
|
133
|
-
- Standard feed‑forward connections with optional gating (multiplicative modulation).
|
|
134
|
-
- Single self-connection per node (handled as recurrent term S[i] * weight before activation).
|
|
135
|
-
- Arbitrary activation functions: built‑in ones are emitted via canonical snippets; custom user
|
|
136
|
-
functions are stringified and sanitized via stripCoverage(). Arrow or anonymous functions are
|
|
137
|
-
normalized into named `function <name>(...)` forms for clarity and stable ordering.
|
|
138
|
-
|
|
139
|
-
Not Supported / Simplifications:
|
|
140
|
-
- No dynamic dropout, noise injection, or stochastic depth—those would require runtime randomness.
|
|
141
|
-
- Assumes all node indices are stable and sequential (enforced prior to generation).
|
|
142
|
-
- Gradient / backprop logic intentionally omitted (forward inference only).
|
|
143
|
-
|
|
144
55
|
### generateStandalone
|
|
145
56
|
|
|
146
57
|
```ts
|
|
@@ -167,129 +78,68 @@ Parameters:
|
|
|
167
78
|
|
|
168
79
|
Returns: Source string (ES5-compatible) – safe to eval in sandbox to obtain activate function.
|
|
169
80
|
|
|
170
|
-
## architecture/network/standalone/network.standalone.utils.
|
|
171
|
-
|
|
172
|
-
### appendActivationLine
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
appendActivationLine(
|
|
176
|
-
generationContext: StandaloneGenerationContext,
|
|
177
|
-
nodeTraversalIndex: number,
|
|
178
|
-
activationFunctionIndex: number,
|
|
179
|
-
maskValue: number,
|
|
180
|
-
): void
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Append generated activation assignment line for one node.
|
|
184
|
-
|
|
185
|
-
Parameters:
|
|
186
|
-
- `generationContext` - Mutable generation context.
|
|
187
|
-
- `nodeTraversalIndex` - Node index.
|
|
188
|
-
- `activationFunctionIndex` - Function table index.
|
|
189
|
-
- `maskValue` - Multiplicative mask.
|
|
190
|
-
|
|
191
|
-
Returns: Void.
|
|
192
|
-
|
|
193
|
-
### appendAllNodeComputationLines
|
|
194
|
-
|
|
195
|
-
```ts
|
|
196
|
-
appendAllNodeComputationLines(
|
|
197
|
-
generationContext: StandaloneGenerationContext,
|
|
198
|
-
): void
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Append compute lines for all non-input nodes.
|
|
202
|
-
|
|
203
|
-
Parameters:
|
|
204
|
-
- `generationContext` - Mutable generation context.
|
|
205
|
-
|
|
206
|
-
Returns: Void.
|
|
81
|
+
## architecture/network/standalone/network.standalone.utils.setup.ts
|
|
207
82
|
|
|
208
|
-
###
|
|
83
|
+
### asStandaloneProps
|
|
209
84
|
|
|
210
85
|
```ts
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
):
|
|
86
|
+
asStandaloneProps(
|
|
87
|
+
net: default,
|
|
88
|
+
): NetworkStandaloneProps
|
|
214
89
|
```
|
|
215
90
|
|
|
216
|
-
|
|
91
|
+
Cast a network instance to the internal standalone generation view.
|
|
217
92
|
|
|
218
93
|
Parameters:
|
|
219
|
-
- `
|
|
94
|
+
- `net` - Network instance to cast.
|
|
220
95
|
|
|
221
|
-
Returns:
|
|
96
|
+
Returns: Internal network properties used by the standalone generator.
|
|
222
97
|
|
|
223
|
-
###
|
|
98
|
+
### createGenerationContext
|
|
224
99
|
|
|
225
100
|
```ts
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
): void
|
|
101
|
+
createGenerationContext(
|
|
102
|
+
standaloneProps: NetworkStandaloneProps,
|
|
103
|
+
): StandaloneGenerationContext
|
|
230
104
|
```
|
|
231
105
|
|
|
232
|
-
|
|
106
|
+
Create a fresh generation context used across orchestration steps.
|
|
233
107
|
|
|
234
108
|
Parameters:
|
|
235
|
-
- `
|
|
236
|
-
- `outputIndexes` - Output node indexes.
|
|
109
|
+
- `standaloneProps` - Internal standalone network view.
|
|
237
110
|
|
|
238
|
-
Returns:
|
|
111
|
+
Returns: Initialized generation context.
|
|
239
112
|
|
|
240
|
-
###
|
|
113
|
+
### ensureOutputNodesExist
|
|
241
114
|
|
|
242
115
|
```ts
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
nodeTraversalIndex: number,
|
|
116
|
+
ensureOutputNodesExist(
|
|
117
|
+
standaloneProps: NetworkStandaloneProps,
|
|
246
118
|
): void
|
|
247
119
|
```
|
|
248
120
|
|
|
249
|
-
|
|
121
|
+
Validate that the network has at least one output node.
|
|
250
122
|
|
|
251
123
|
Parameters:
|
|
252
|
-
- `
|
|
253
|
-
- `nodeTraversalIndex` - Node index currently being emitted.
|
|
124
|
+
- `standaloneProps` - Internal standalone network view.
|
|
254
125
|
|
|
255
126
|
Returns: Void.
|
|
256
127
|
|
|
257
|
-
###
|
|
128
|
+
### seedNodeIndexesAndState
|
|
258
129
|
|
|
259
130
|
```ts
|
|
260
|
-
|
|
131
|
+
seedNodeIndexesAndState(
|
|
261
132
|
generationContext: StandaloneGenerationContext,
|
|
262
|
-
nodeTraversalIndex: number,
|
|
263
|
-
sumExpression: string,
|
|
264
|
-
biasValue: number,
|
|
265
133
|
): void
|
|
266
134
|
```
|
|
267
135
|
|
|
268
|
-
|
|
136
|
+
Seed index, activation, and state arrays from network nodes.
|
|
269
137
|
|
|
270
138
|
Parameters:
|
|
271
139
|
- `generationContext` - Mutable generation context.
|
|
272
|
-
- `nodeTraversalIndex` - Node index.
|
|
273
|
-
- `sumExpression` - Generated sum expression.
|
|
274
|
-
- `biasValue` - Node bias.
|
|
275
140
|
|
|
276
141
|
Returns: Void.
|
|
277
142
|
|
|
278
|
-
### buildMaskSuffix
|
|
279
|
-
|
|
280
|
-
```ts
|
|
281
|
-
buildMaskSuffix(
|
|
282
|
-
maskValue: number,
|
|
283
|
-
): string
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
Build optional activation mask suffix for generated assignment line.
|
|
287
|
-
|
|
288
|
-
Parameters:
|
|
289
|
-
- `maskValue` - Multiplicative mask value.
|
|
290
|
-
|
|
291
|
-
Returns: Empty suffix for identity, otherwise multiplicative fragment.
|
|
292
|
-
|
|
293
143
|
## architecture/network/standalone/network.standalone.utils.graph.ts
|
|
294
144
|
|
|
295
145
|
### appendGateMultiplier
|
|
@@ -435,146 +285,128 @@ Parameters:
|
|
|
435
285
|
|
|
436
286
|
Returns: Combined term collection.
|
|
437
287
|
|
|
438
|
-
## architecture/network/standalone/network.standalone.utils.
|
|
288
|
+
## architecture/network/standalone/network.standalone.utils.loop.ts
|
|
439
289
|
|
|
440
|
-
###
|
|
290
|
+
### appendActivationLine
|
|
441
291
|
|
|
442
292
|
```ts
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
293
|
+
appendActivationLine(
|
|
294
|
+
generationContext: StandaloneGenerationContext,
|
|
295
|
+
nodeTraversalIndex: number,
|
|
296
|
+
activationFunctionIndex: number,
|
|
297
|
+
maskValue: number,
|
|
298
|
+
): void
|
|
446
299
|
```
|
|
447
300
|
|
|
448
|
-
|
|
301
|
+
Append generated activation assignment line for one node.
|
|
449
302
|
|
|
450
303
|
Parameters:
|
|
451
|
-
- `
|
|
304
|
+
- `generationContext` - Mutable generation context.
|
|
305
|
+
- `nodeTraversalIndex` - Node index.
|
|
306
|
+
- `activationFunctionIndex` - Function table index.
|
|
307
|
+
- `maskValue` - Multiplicative mask.
|
|
452
308
|
|
|
453
|
-
Returns:
|
|
309
|
+
Returns: Void.
|
|
454
310
|
|
|
455
|
-
###
|
|
311
|
+
### appendAllNodeComputationLines
|
|
456
312
|
|
|
457
313
|
```ts
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
):
|
|
314
|
+
appendAllNodeComputationLines(
|
|
315
|
+
generationContext: StandaloneGenerationContext,
|
|
316
|
+
): void
|
|
461
317
|
```
|
|
462
318
|
|
|
463
|
-
|
|
319
|
+
Append compute lines for all non-input nodes.
|
|
464
320
|
|
|
465
321
|
Parameters:
|
|
466
|
-
- `
|
|
322
|
+
- `generationContext` - Mutable generation context.
|
|
467
323
|
|
|
468
|
-
Returns:
|
|
324
|
+
Returns: Void.
|
|
469
325
|
|
|
470
|
-
###
|
|
326
|
+
### appendInputSeedLine
|
|
471
327
|
|
|
472
328
|
```ts
|
|
473
|
-
|
|
474
|
-
|
|
329
|
+
appendInputSeedLine(
|
|
330
|
+
generationContext: StandaloneGenerationContext,
|
|
475
331
|
): void
|
|
476
332
|
```
|
|
477
333
|
|
|
478
|
-
|
|
334
|
+
Append the generated input-copy loop to the standalone body.
|
|
479
335
|
|
|
480
336
|
Parameters:
|
|
481
|
-
- `
|
|
337
|
+
- `generationContext` - Mutable generation context.
|
|
482
338
|
|
|
483
339
|
Returns: Void.
|
|
484
340
|
|
|
485
|
-
###
|
|
341
|
+
### appendOutputReturnLine
|
|
486
342
|
|
|
487
343
|
```ts
|
|
488
|
-
|
|
344
|
+
appendOutputReturnLine(
|
|
489
345
|
generationContext: StandaloneGenerationContext,
|
|
346
|
+
outputIndexes: number[],
|
|
490
347
|
): void
|
|
491
348
|
```
|
|
492
349
|
|
|
493
|
-
|
|
350
|
+
Append generated return line for output activations.
|
|
494
351
|
|
|
495
352
|
Parameters:
|
|
496
353
|
- `generationContext` - Mutable generation context.
|
|
354
|
+
- `outputIndexes` - Output node indexes.
|
|
497
355
|
|
|
498
356
|
Returns: Void.
|
|
499
357
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
### stripCoverage
|
|
503
|
-
|
|
504
|
-
```ts
|
|
505
|
-
stripCoverage(
|
|
506
|
-
code: string,
|
|
507
|
-
): string
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
Remove instrumentation artifacts and formatting detritus from function sources.
|
|
511
|
-
|
|
512
|
-
Parameters:
|
|
513
|
-
- `code` - Source text potentially containing coverage wrappers.
|
|
514
|
-
|
|
515
|
-
Returns: Cleaned source text suitable for deterministic standalone emission.
|
|
516
|
-
|
|
517
|
-
## architecture/network/standalone/network.standalone.utils.finalize.ts
|
|
518
|
-
|
|
519
|
-
### assembleStandaloneSource
|
|
358
|
+
### appendSingleNodeComputationLines
|
|
520
359
|
|
|
521
360
|
```ts
|
|
522
|
-
|
|
361
|
+
appendSingleNodeComputationLines(
|
|
523
362
|
generationContext: StandaloneGenerationContext,
|
|
524
|
-
|
|
363
|
+
nodeTraversalIndex: number,
|
|
364
|
+
): void
|
|
525
365
|
```
|
|
526
366
|
|
|
527
|
-
|
|
367
|
+
Append state and activation lines for one node.
|
|
528
368
|
|
|
529
369
|
Parameters:
|
|
530
370
|
- `generationContext` - Mutable generation context.
|
|
371
|
+
- `nodeTraversalIndex` - Node index currently being emitted.
|
|
531
372
|
|
|
532
|
-
Returns:
|
|
373
|
+
Returns: Void.
|
|
533
374
|
|
|
534
|
-
###
|
|
375
|
+
### appendStateLine
|
|
535
376
|
|
|
536
377
|
```ts
|
|
537
|
-
|
|
378
|
+
appendStateLine(
|
|
538
379
|
generationContext: StandaloneGenerationContext,
|
|
539
|
-
|
|
380
|
+
nodeTraversalIndex: number,
|
|
381
|
+
sumExpression: string,
|
|
382
|
+
biasValue: number,
|
|
383
|
+
): void
|
|
540
384
|
```
|
|
541
385
|
|
|
542
|
-
|
|
386
|
+
Append generated state assignment line for one node.
|
|
543
387
|
|
|
544
388
|
Parameters:
|
|
545
389
|
- `generationContext` - Mutable generation context.
|
|
390
|
+
- `nodeTraversalIndex` - Node index.
|
|
391
|
+
- `sumExpression` - Generated sum expression.
|
|
392
|
+
- `biasValue` - Node bias.
|
|
546
393
|
|
|
547
|
-
Returns:
|
|
548
|
-
|
|
549
|
-
### buildInputGuardLine
|
|
550
|
-
|
|
551
|
-
```ts
|
|
552
|
-
buildInputGuardLine(
|
|
553
|
-
expectedInputSize: number,
|
|
554
|
-
): string
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
Build generated input length guard line.
|
|
558
|
-
|
|
559
|
-
Parameters:
|
|
560
|
-
- `expectedInputSize` - Required input vector size.
|
|
561
|
-
|
|
562
|
-
Returns: Guard statement line including trailing newline.
|
|
394
|
+
Returns: Void.
|
|
563
395
|
|
|
564
|
-
###
|
|
396
|
+
### buildMaskSuffix
|
|
565
397
|
|
|
566
398
|
```ts
|
|
567
|
-
|
|
568
|
-
|
|
399
|
+
buildMaskSuffix(
|
|
400
|
+
maskValue: number,
|
|
569
401
|
): string
|
|
570
402
|
```
|
|
571
403
|
|
|
572
|
-
|
|
404
|
+
Build optional activation mask suffix for generated assignment line.
|
|
573
405
|
|
|
574
406
|
Parameters:
|
|
575
|
-
- `
|
|
407
|
+
- `maskValue` - Multiplicative mask value.
|
|
576
408
|
|
|
577
|
-
Returns:
|
|
409
|
+
Returns: Empty suffix for identity, otherwise multiplicative fragment.
|
|
578
410
|
|
|
579
411
|
## architecture/network/standalone/network.standalone.utils.activation.ts
|
|
580
412
|
|
|
@@ -753,3 +585,195 @@ Parameters:
|
|
|
753
585
|
- `nodeTraversalIndex` - Node index for anonymous-name fallback.
|
|
754
586
|
|
|
755
587
|
Returns: Activation function identifier.
|
|
588
|
+
|
|
589
|
+
## architecture/network/standalone/network.standalone.utils.coverage.ts
|
|
590
|
+
|
|
591
|
+
### stripCoverage
|
|
592
|
+
|
|
593
|
+
```ts
|
|
594
|
+
stripCoverage(
|
|
595
|
+
code: string,
|
|
596
|
+
): string
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
Remove instrumentation artifacts and formatting detritus from function sources.
|
|
600
|
+
|
|
601
|
+
Parameters:
|
|
602
|
+
- `code` - Source text potentially containing coverage wrappers.
|
|
603
|
+
|
|
604
|
+
Returns: Cleaned source text suitable for deterministic standalone emission.
|
|
605
|
+
|
|
606
|
+
## architecture/network/standalone/network.standalone.utils.finalize.ts
|
|
607
|
+
|
|
608
|
+
### assembleStandaloneSource
|
|
609
|
+
|
|
610
|
+
```ts
|
|
611
|
+
assembleStandaloneSource(
|
|
612
|
+
generationContext: StandaloneGenerationContext,
|
|
613
|
+
): string
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
Assemble the final standalone IIFE source string.
|
|
617
|
+
|
|
618
|
+
Parameters:
|
|
619
|
+
- `generationContext` - Mutable generation context.
|
|
620
|
+
|
|
621
|
+
Returns: Final generated source string.
|
|
622
|
+
|
|
623
|
+
### buildActivationArrayLiteral
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
buildActivationArrayLiteral(
|
|
627
|
+
generationContext: StandaloneGenerationContext,
|
|
628
|
+
): string
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Build deterministic activation function array literal by function index ordering.
|
|
632
|
+
|
|
633
|
+
Parameters:
|
|
634
|
+
- `generationContext` - Mutable generation context.
|
|
635
|
+
|
|
636
|
+
Returns: Comma-separated activation function names.
|
|
637
|
+
|
|
638
|
+
### buildInputGuardLine
|
|
639
|
+
|
|
640
|
+
```ts
|
|
641
|
+
buildInputGuardLine(
|
|
642
|
+
expectedInputSize: number,
|
|
643
|
+
): string
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
Build generated input length guard line.
|
|
647
|
+
|
|
648
|
+
Parameters:
|
|
649
|
+
- `expectedInputSize` - Required input vector size.
|
|
650
|
+
|
|
651
|
+
Returns: Guard statement line including trailing newline.
|
|
652
|
+
|
|
653
|
+
### resolveActivationArrayType
|
|
654
|
+
|
|
655
|
+
```ts
|
|
656
|
+
resolveActivationArrayType(
|
|
657
|
+
generationContext: StandaloneGenerationContext,
|
|
658
|
+
): string
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
Resolve typed-array constructor name based on configured activation precision.
|
|
662
|
+
|
|
663
|
+
Parameters:
|
|
664
|
+
- `generationContext` - Mutable generation context.
|
|
665
|
+
|
|
666
|
+
Returns: Constructor name used in generated source.
|
|
667
|
+
|
|
668
|
+
## architecture/network/standalone/network.standalone.utils.types.ts
|
|
669
|
+
|
|
670
|
+
Output node discriminator used for standalone precondition checks.
|
|
671
|
+
|
|
672
|
+
### ACTIVATION_PRECISION_F32
|
|
673
|
+
|
|
674
|
+
Precision token selecting Float32 activation/state buffers.
|
|
675
|
+
|
|
676
|
+
### ARROW_TOKEN
|
|
677
|
+
|
|
678
|
+
Arrow token used during function-source normalization.
|
|
679
|
+
|
|
680
|
+
### BUILTIN_ACTIVATION_SNIPPETS
|
|
681
|
+
|
|
682
|
+
Built-in activation snippets emitted as named JavaScript function declarations.
|
|
683
|
+
|
|
684
|
+
Values are intentionally compact so emitted standalone source remains deterministic and small.
|
|
685
|
+
|
|
686
|
+
### COVERAGE_CALL_REGEX
|
|
687
|
+
|
|
688
|
+
Regex stripping Istanbul function invocations from source snippets.
|
|
689
|
+
|
|
690
|
+
### COVERAGE_COUNTER_REGEX
|
|
691
|
+
|
|
692
|
+
Regex stripping Istanbul counters from stringified functions.
|
|
693
|
+
|
|
694
|
+
### COVERAGE_REPLACEMENT
|
|
695
|
+
|
|
696
|
+
Empty replacement used while stripping coverage artifacts.
|
|
697
|
+
|
|
698
|
+
### EMPTY_TOKEN_REGEX
|
|
699
|
+
|
|
700
|
+
Regex removing empty punctuation-only token lines.
|
|
701
|
+
|
|
702
|
+
### FALLBACK_IDENTITY_BODY
|
|
703
|
+
|
|
704
|
+
Identity-function fallback body for invalid custom squash sources.
|
|
705
|
+
|
|
706
|
+
### FLOAT32_ARRAY_TYPE
|
|
707
|
+
|
|
708
|
+
Typed-array constructor names used in generated source.
|
|
709
|
+
|
|
710
|
+
### FLOAT64_ARRAY_TYPE
|
|
711
|
+
|
|
712
|
+
Typed-array constructor names used in generated source.
|
|
713
|
+
|
|
714
|
+
### FUNCTION_PREFIX
|
|
715
|
+
|
|
716
|
+
Prefix token used when normalizing function sources.
|
|
717
|
+
|
|
718
|
+
### INPUT_LOOP_LINE
|
|
719
|
+
|
|
720
|
+
Generated source line for copying external inputs into activation buffer.
|
|
721
|
+
|
|
722
|
+
### INVALID_INPUT_SIZE_ERROR_MIDDLE
|
|
723
|
+
|
|
724
|
+
Input-size validation message fragments for generated activate guards.
|
|
725
|
+
|
|
726
|
+
### INVALID_INPUT_SIZE_ERROR_PREFIX
|
|
727
|
+
|
|
728
|
+
Input-size validation message fragments for generated activate guards.
|
|
729
|
+
|
|
730
|
+
### ISTANBUL_IGNORE_BLOCK_REGEX
|
|
731
|
+
|
|
732
|
+
Regex stripping Istanbul ignore blocks from stringified functions.
|
|
733
|
+
|
|
734
|
+
### MASK_MULTIPLIER_IDENTITY
|
|
735
|
+
|
|
736
|
+
Multiplicative identity used to omit redundant mask expressions.
|
|
737
|
+
|
|
738
|
+
### NO_OUTPUT_NODES_ERROR
|
|
739
|
+
|
|
740
|
+
Error message when attempting standalone generation without outputs.
|
|
741
|
+
|
|
742
|
+
### OUTPUT_NODE_TYPE
|
|
743
|
+
|
|
744
|
+
Output node discriminator used for standalone precondition checks.
|
|
745
|
+
|
|
746
|
+
### REPEATED_SEMICOLON_REGEX
|
|
747
|
+
|
|
748
|
+
Regex collapsing repeated semicolons.
|
|
749
|
+
|
|
750
|
+
### SINGLE_TERM_FALLBACK
|
|
751
|
+
|
|
752
|
+
Fallback literal used when a node has no incoming terms.
|
|
753
|
+
|
|
754
|
+
### SOLITARY_SEMICOLON_REGEX
|
|
755
|
+
|
|
756
|
+
Regex removing solitary semicolon lines created by instrumentation.
|
|
757
|
+
|
|
758
|
+
### SOURCE_MAP_REGEX
|
|
759
|
+
|
|
760
|
+
Regex stripping sourceMappingURL comments from generated snippets.
|
|
761
|
+
|
|
762
|
+
### StandaloneSquashFunction
|
|
763
|
+
|
|
764
|
+
```ts
|
|
765
|
+
StandaloneSquashFunction(
|
|
766
|
+
inputValue: number,
|
|
767
|
+
derivate: boolean | undefined,
|
|
768
|
+
): number
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
Activation function shape used by standalone source generation helpers.
|
|
772
|
+
|
|
773
|
+
### STRAY_COMMA_CLOSE_REGEX
|
|
774
|
+
|
|
775
|
+
Regex normalizing stray commas near closing parentheses.
|
|
776
|
+
|
|
777
|
+
### STRAY_COMMA_OPEN_REGEX
|
|
778
|
+
|
|
779
|
+
Regex normalizing stray commas near opening parentheses.
|