@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
|
@@ -58,15 +58,17 @@ const runtimeFactories: OnnxRuntimeFactories = {
|
|
|
58
58
|
};
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
###
|
|
61
|
+
### OnnxPerceptronBuildContext
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
OnnxRuntimePerceptronFactory(
|
|
65
|
-
sizes: number[],
|
|
66
|
-
): default
|
|
67
|
-
```
|
|
63
|
+
Build context for mapping ONNX layer sizes into a Neataptic MLP factory call.
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
### OnnxPerceptronSizeValidationContext
|
|
66
|
+
|
|
67
|
+
Validation context for perceptron size-list checks during ONNX import.
|
|
68
|
+
|
|
69
|
+
### OnnxRuntimeFactories
|
|
70
|
+
|
|
71
|
+
Runtime factories consumed during ONNX import network reconstruction.
|
|
70
72
|
|
|
71
73
|
### OnnxRuntimeLayerFactory
|
|
72
74
|
|
|
@@ -82,29 +84,47 @@ Runtime layer-constructor signature used for recurrent layer reconstruction.
|
|
|
82
84
|
|
|
83
85
|
Runtime layer module shape consumed by ONNX import orchestration.
|
|
84
86
|
|
|
85
|
-
###
|
|
87
|
+
### OnnxRuntimePerceptronFactory
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
```ts
|
|
90
|
+
OnnxRuntimePerceptronFactory(
|
|
91
|
+
sizes: number[],
|
|
92
|
+
): default
|
|
93
|
+
```
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
Runtime perceptron factory signature used by ONNX import orchestration.
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
## architecture/network/onnx/import/network.onnx.runtime-load.utils.ts
|
|
92
98
|
|
|
93
|
-
###
|
|
99
|
+
### buildPerceptronNetwork
|
|
94
100
|
|
|
95
|
-
|
|
101
|
+
```ts
|
|
102
|
+
buildPerceptronNetwork(
|
|
103
|
+
buildContext: OnnxPerceptronBuildContext,
|
|
104
|
+
): default
|
|
105
|
+
```
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
Build a perceptron network from size-extraction context.
|
|
98
108
|
|
|
99
|
-
|
|
109
|
+
Parameters:
|
|
110
|
+
- `buildContext` - Perceptron build context.
|
|
111
|
+
|
|
112
|
+
Returns: Reconstructed network instance.
|
|
113
|
+
|
|
114
|
+
### createPerceptronBuildContext
|
|
100
115
|
|
|
101
116
|
```ts
|
|
102
|
-
|
|
117
|
+
createPerceptronBuildContext(
|
|
118
|
+
sizes: number[],
|
|
119
|
+
): OnnxPerceptronBuildContext
|
|
103
120
|
```
|
|
104
121
|
|
|
105
|
-
|
|
122
|
+
Build perceptron-network construction context.
|
|
106
123
|
|
|
107
|
-
|
|
124
|
+
Parameters:
|
|
125
|
+
- `sizes` - Layer-size payload.
|
|
126
|
+
|
|
127
|
+
Returns: Build context.
|
|
108
128
|
|
|
109
129
|
### createPerceptronFactory
|
|
110
130
|
|
|
@@ -116,6 +136,21 @@ Create an ONNX import network factory from modern static constructors.
|
|
|
116
136
|
|
|
117
137
|
Returns: Perceptron-compatible factory function.
|
|
118
138
|
|
|
139
|
+
### createPerceptronSizeValidationContext
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
createPerceptronSizeValidationContext(
|
|
143
|
+
sizes: number[],
|
|
144
|
+
): OnnxPerceptronSizeValidationContext
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Build perceptron-size validation context.
|
|
148
|
+
|
|
149
|
+
Parameters:
|
|
150
|
+
- `sizes` - Layer-size payload.
|
|
151
|
+
|
|
152
|
+
Returns: Validation context.
|
|
153
|
+
|
|
119
154
|
### createRuntimeLayerModule
|
|
120
155
|
|
|
121
156
|
```ts
|
|
@@ -160,6 +195,16 @@ Parameters:
|
|
|
160
195
|
|
|
161
196
|
Returns: Runtime layer module.
|
|
162
197
|
|
|
198
|
+
### loadRuntimeFactories
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
loadRuntimeFactories(): OnnxRuntimeFactories
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Resolve runtime factories used by ONNX import orchestration.
|
|
205
|
+
|
|
206
|
+
Returns: Perceptron factory and layer module object.
|
|
207
|
+
|
|
163
208
|
### resolveLayerFactory
|
|
164
209
|
|
|
165
210
|
```ts
|
|
@@ -175,21 +220,6 @@ Parameters:
|
|
|
175
220
|
|
|
176
221
|
Returns: Matching layer factory.
|
|
177
222
|
|
|
178
|
-
### createPerceptronSizeValidationContext
|
|
179
|
-
|
|
180
|
-
```ts
|
|
181
|
-
createPerceptronSizeValidationContext(
|
|
182
|
-
sizes: number[],
|
|
183
|
-
): OnnxPerceptronSizeValidationContext
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Build perceptron-size validation context.
|
|
187
|
-
|
|
188
|
-
Parameters:
|
|
189
|
-
- `sizes` - Layer-size payload.
|
|
190
|
-
|
|
191
|
-
Returns: Validation context.
|
|
192
|
-
|
|
193
223
|
### validatePerceptronSizes
|
|
194
224
|
|
|
195
225
|
```ts
|
|
@@ -205,36 +235,6 @@ Parameters:
|
|
|
205
235
|
|
|
206
236
|
Returns: Nothing. Throws on invalid size-list.
|
|
207
237
|
|
|
208
|
-
### createPerceptronBuildContext
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
createPerceptronBuildContext(
|
|
212
|
-
sizes: number[],
|
|
213
|
-
): OnnxPerceptronBuildContext
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Build perceptron-network construction context.
|
|
217
|
-
|
|
218
|
-
Parameters:
|
|
219
|
-
- `sizes` - Layer-size payload.
|
|
220
|
-
|
|
221
|
-
Returns: Build context.
|
|
222
|
-
|
|
223
|
-
### buildPerceptronNetwork
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
buildPerceptronNetwork(
|
|
227
|
-
buildContext: OnnxPerceptronBuildContext,
|
|
228
|
-
): default
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Build a perceptron network from size-extraction context.
|
|
232
|
-
|
|
233
|
-
Parameters:
|
|
234
|
-
- `buildContext` - Perceptron build context.
|
|
235
|
-
|
|
236
|
-
Returns: Reconstructed network instance.
|
|
237
|
-
|
|
238
238
|
## architecture/network/onnx/import/network.onnx.import-weights.types.ts
|
|
239
239
|
|
|
240
240
|
Import-owned types for ONNX weight restoration and Conv reconstruction.
|
|
@@ -262,742 +262,742 @@ const assignmentContext: OnnxImportWeightAssignmentContext = {
|
|
|
262
262
|
};
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
-
###
|
|
265
|
+
### OnnxImportAggregatedLayerAssignmentContext
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
Context for assigning aggregated dense tensors for one layer.
|
|
268
268
|
|
|
269
|
-
###
|
|
269
|
+
### OnnxImportAggregatedNeuronAssignmentContext
|
|
270
270
|
|
|
271
|
-
Context for
|
|
271
|
+
Context for assigning one aggregated dense target neuron row.
|
|
272
272
|
|
|
273
|
-
###
|
|
273
|
+
### OnnxImportConvCoordinateAssignmentContext
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
Context for applying Conv weights and bias at one output coordinate.
|
|
276
276
|
|
|
277
|
-
###
|
|
277
|
+
### OnnxImportConvKernelAssignmentContext
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
Context for assigning one concrete Conv kernel connection weight.
|
|
280
280
|
|
|
281
|
-
###
|
|
281
|
+
### OnnxImportConvLayerContext
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
Context for reconstructing one Conv layer's imported connectivity.
|
|
284
284
|
|
|
285
|
-
###
|
|
285
|
+
### OnnxImportConvLayerContextBuildParams
|
|
286
286
|
|
|
287
|
-
Build params for one
|
|
287
|
+
Build params for creating one Conv reconstruction layer context.
|
|
288
288
|
|
|
289
|
-
###
|
|
289
|
+
### OnnxImportConvMetadata
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
Parsed Conv metadata payload used for optional reconstruction pass.
|
|
292
292
|
|
|
293
|
-
###
|
|
293
|
+
### OnnxImportConvNodeSlices
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
Layer node slices used while applying Conv reconstruction assignments.
|
|
296
296
|
|
|
297
|
-
###
|
|
297
|
+
### OnnxImportConvOutputCoordinate
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
Coordinate for one Conv output neuron traversal position.
|
|
300
300
|
|
|
301
|
-
###
|
|
301
|
+
### OnnxImportConvTensorContext
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
Resolved Conv initializer tensors and dimensions for one layer.
|
|
304
304
|
|
|
305
|
-
###
|
|
305
|
+
### OnnxImportHiddenSizeDerivationContext
|
|
306
306
|
|
|
307
|
-
Context for
|
|
307
|
+
Context for deriving hidden layer sizes from initializer tensors and metadata.
|
|
308
308
|
|
|
309
|
-
###
|
|
309
|
+
### OnnxImportInboundConnectionMap
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
Inbound connection lookup map keyed by source node for one target neuron.
|
|
312
312
|
|
|
313
|
-
###
|
|
313
|
+
### OnnxImportLayerNodePair
|
|
314
314
|
|
|
315
|
-
|
|
315
|
+
Node slices for one sequential imported layer assignment pass.
|
|
316
316
|
|
|
317
|
-
###
|
|
317
|
+
### OnnxImportLayerNodePairBuildParams
|
|
318
318
|
|
|
319
|
-
Build params for
|
|
319
|
+
Build params for one sequential layer node-pair slice operation.
|
|
320
320
|
|
|
321
|
-
###
|
|
321
|
+
### OnnxImportLayerTensorNames
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
Weight tensor names for one imported layer index.
|
|
324
324
|
|
|
325
|
-
###
|
|
325
|
+
### OnnxImportLayerWeightBucket
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
Bucketed ONNX dense/per-neuron tensors for one exported layer index.
|
|
328
328
|
|
|
329
|
-
###
|
|
329
|
+
### OnnxImportPerNeuronAssignmentContext
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
Context for assigning one per-neuron imported target node.
|
|
332
332
|
|
|
333
|
-
###
|
|
333
|
+
### OnnxImportPerNeuronLayerAssignmentContext
|
|
334
334
|
|
|
335
|
-
Context for
|
|
335
|
+
Context for assigning per-neuron tensors for one layer.
|
|
336
336
|
|
|
337
|
-
###
|
|
337
|
+
### OnnxImportWeightAssignmentBuildParams
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
Build params for creating shared ONNX import weight-assignment context.
|
|
340
340
|
|
|
341
|
-
###
|
|
341
|
+
### OnnxImportWeightAssignmentContext
|
|
342
342
|
|
|
343
|
-
|
|
343
|
+
Shared weight-assignment context built once per ONNX import.
|
|
344
344
|
|
|
345
345
|
## architecture/network/onnx/import/network.onnx.import-weights.utils.ts
|
|
346
346
|
|
|
347
|
-
###
|
|
347
|
+
### applyAggregatedLayerWeights
|
|
348
348
|
|
|
349
349
|
```ts
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
): number[]
|
|
350
|
+
applyAggregatedLayerWeights(
|
|
351
|
+
aggregatedContext: OnnxImportAggregatedLayerAssignmentContext,
|
|
352
|
+
): void
|
|
354
353
|
```
|
|
355
354
|
|
|
356
|
-
|
|
355
|
+
Apply aggregated dense tensor assignments for one layer.
|
|
357
356
|
|
|
358
357
|
Parameters:
|
|
359
|
-
- `
|
|
360
|
-
- `metadataProps` - Optional ONNX metadata properties.
|
|
358
|
+
- `aggregatedContext` - Aggregated assignment context.
|
|
361
359
|
|
|
362
|
-
Returns:
|
|
360
|
+
Returns: Nothing.
|
|
363
361
|
|
|
364
|
-
###
|
|
362
|
+
### applyAggregatedNeuronAssignment
|
|
365
363
|
|
|
366
364
|
```ts
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
onnx: OnnxModel,
|
|
370
|
-
hiddenLayerSizes: number[],
|
|
371
|
-
metadataProps: OnnxMetadataProperty[] | undefined,
|
|
365
|
+
applyAggregatedNeuronAssignment(
|
|
366
|
+
neuronContext: OnnxImportAggregatedNeuronAssignmentContext,
|
|
372
367
|
): void
|
|
373
368
|
```
|
|
374
369
|
|
|
375
|
-
|
|
370
|
+
Apply aggregated dense row weights and bias for one target neuron.
|
|
376
371
|
|
|
377
372
|
Parameters:
|
|
378
|
-
- `
|
|
379
|
-
- `onnx` - Source ONNX model.
|
|
380
|
-
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
381
|
-
- `metadataProps` - Optional ONNX metadata properties.
|
|
373
|
+
- `neuronContext` - Aggregated neuron assignment context.
|
|
382
374
|
|
|
383
375
|
Returns: Nothing.
|
|
384
376
|
|
|
385
|
-
###
|
|
377
|
+
### applyConvCoordinateAssignment
|
|
386
378
|
|
|
387
379
|
```ts
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
):
|
|
380
|
+
applyConvCoordinateAssignment(
|
|
381
|
+
coordinateContext: OnnxImportConvCoordinateAssignmentContext,
|
|
382
|
+
): void
|
|
391
383
|
```
|
|
392
384
|
|
|
393
|
-
|
|
385
|
+
Apply Conv bias and kernel weights for one output coordinate.
|
|
394
386
|
|
|
395
387
|
Parameters:
|
|
396
|
-
- `
|
|
388
|
+
- `coordinateContext` - Conv coordinate assignment context.
|
|
397
389
|
|
|
398
|
-
Returns:
|
|
390
|
+
Returns: Nothing.
|
|
399
391
|
|
|
400
|
-
###
|
|
392
|
+
### applyConvLayerReconstruction
|
|
401
393
|
|
|
402
394
|
```ts
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
):
|
|
395
|
+
applyConvLayerReconstruction(
|
|
396
|
+
layerContext: OnnxImportConvLayerContext,
|
|
397
|
+
): void
|
|
406
398
|
```
|
|
407
399
|
|
|
408
|
-
|
|
400
|
+
Apply Conv reconstruction for one validated Conv layer context.
|
|
409
401
|
|
|
410
402
|
Parameters:
|
|
411
|
-
- `
|
|
403
|
+
- `layerContext` - Conv layer context.
|
|
412
404
|
|
|
413
|
-
Returns:
|
|
405
|
+
Returns: Nothing.
|
|
414
406
|
|
|
415
|
-
###
|
|
407
|
+
### applyDenseWeightAssignments
|
|
416
408
|
|
|
417
409
|
```ts
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
):
|
|
410
|
+
applyDenseWeightAssignments(
|
|
411
|
+
assignmentContext: OnnxImportWeightAssignmentContext,
|
|
412
|
+
): void
|
|
421
413
|
```
|
|
422
414
|
|
|
423
|
-
|
|
415
|
+
Apply dense/per-neuron assignments for all sorted layer indices.
|
|
424
416
|
|
|
425
417
|
Parameters:
|
|
426
|
-
- `
|
|
418
|
+
- `assignmentContext` - Shared assignment context.
|
|
427
419
|
|
|
428
|
-
Returns:
|
|
420
|
+
Returns: Nothing.
|
|
429
421
|
|
|
430
|
-
###
|
|
422
|
+
### applyOptionalConvReconstruction
|
|
431
423
|
|
|
432
424
|
```ts
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
): number[]
|
|
425
|
+
applyOptionalConvReconstruction(
|
|
426
|
+
assignmentContext: OnnxImportWeightAssignmentContext,
|
|
427
|
+
): void
|
|
437
428
|
```
|
|
438
429
|
|
|
439
|
-
|
|
430
|
+
Apply optional Conv2D reconstruction pass from metadata payloads.
|
|
440
431
|
|
|
441
432
|
Parameters:
|
|
442
|
-
- `
|
|
443
|
-
- `sortedLayerIndices` - Ascending layer indices.
|
|
433
|
+
- `assignmentContext` - Shared assignment context.
|
|
444
434
|
|
|
445
|
-
Returns:
|
|
435
|
+
Returns: Nothing.
|
|
446
436
|
|
|
447
|
-
###
|
|
437
|
+
### applyPerNeuronAssignment
|
|
448
438
|
|
|
449
439
|
```ts
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
): number
|
|
440
|
+
applyPerNeuronAssignment(
|
|
441
|
+
perNeuronAssignmentContext: OnnxImportPerNeuronAssignmentContext,
|
|
442
|
+
): void
|
|
454
443
|
```
|
|
455
444
|
|
|
456
|
-
|
|
445
|
+
Apply one per-neuron weight vector and bias assignment.
|
|
457
446
|
|
|
458
447
|
Parameters:
|
|
459
|
-
- `
|
|
460
|
-
- `layerIndex` - Export layer index.
|
|
448
|
+
- `perNeuronAssignmentContext` - Per-neuron assignment context.
|
|
461
449
|
|
|
462
|
-
Returns:
|
|
450
|
+
Returns: Nothing.
|
|
463
451
|
|
|
464
|
-
###
|
|
452
|
+
### applyPerNeuronLayerWeights
|
|
465
453
|
|
|
466
454
|
```ts
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
):
|
|
455
|
+
applyPerNeuronLayerWeights(
|
|
456
|
+
perNeuronContext: OnnxImportPerNeuronLayerAssignmentContext,
|
|
457
|
+
): void
|
|
470
458
|
```
|
|
471
459
|
|
|
472
|
-
|
|
460
|
+
Apply per-neuron tensor assignments for one layer.
|
|
473
461
|
|
|
474
462
|
Parameters:
|
|
475
|
-
- `
|
|
463
|
+
- `perNeuronContext` - Per-neuron layer assignment context.
|
|
476
464
|
|
|
477
|
-
Returns:
|
|
465
|
+
Returns: Nothing.
|
|
478
466
|
|
|
479
|
-
###
|
|
467
|
+
### assignConvKernelWeight
|
|
480
468
|
|
|
481
469
|
```ts
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
):
|
|
470
|
+
assignConvKernelWeight(
|
|
471
|
+
kernelAssignmentContext: OnnxImportConvKernelAssignmentContext,
|
|
472
|
+
): void
|
|
485
473
|
```
|
|
486
474
|
|
|
487
|
-
|
|
475
|
+
Assign one Conv kernel weight to the matching inbound neuron connection.
|
|
488
476
|
|
|
489
477
|
Parameters:
|
|
490
|
-
- `
|
|
478
|
+
- `kernelAssignmentContext` - Conv kernel assignment context.
|
|
491
479
|
|
|
492
|
-
Returns:
|
|
480
|
+
Returns: Nothing.
|
|
493
481
|
|
|
494
|
-
###
|
|
482
|
+
### assignLayerWeights
|
|
495
483
|
|
|
496
484
|
```ts
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
485
|
+
assignLayerWeights(
|
|
486
|
+
initializerMap: Record<string, OnnxTensor>,
|
|
487
|
+
nodePair: OnnxImportLayerNodePair,
|
|
488
|
+
): void
|
|
500
489
|
```
|
|
501
490
|
|
|
502
|
-
|
|
491
|
+
Assign one layer's weights using aggregated or per-neuron tensors.
|
|
503
492
|
|
|
504
493
|
Parameters:
|
|
505
|
-
- `
|
|
494
|
+
- `initializerMap` - ONNX initializer map.
|
|
495
|
+
- `nodePair` - Current/previous node slices.
|
|
506
496
|
|
|
507
|
-
Returns:
|
|
497
|
+
Returns: Nothing.
|
|
508
498
|
|
|
509
|
-
###
|
|
499
|
+
### assignWeightsAndBiases
|
|
510
500
|
|
|
511
501
|
```ts
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
502
|
+
assignWeightsAndBiases(
|
|
503
|
+
network: default,
|
|
504
|
+
onnx: OnnxModel,
|
|
505
|
+
hiddenLayerSizes: number[],
|
|
506
|
+
metadataProps: OnnxMetadataProperty[] | undefined,
|
|
507
|
+
): void
|
|
515
508
|
```
|
|
516
509
|
|
|
517
|
-
|
|
510
|
+
Assign weights and biases from ONNX initializers to a newly created network.
|
|
518
511
|
|
|
519
512
|
Parameters:
|
|
520
|
-
- `
|
|
513
|
+
- `network` - Target network to mutate.
|
|
514
|
+
- `onnx` - Source ONNX model.
|
|
515
|
+
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
516
|
+
- `metadataProps` - Optional ONNX metadata properties.
|
|
521
517
|
|
|
522
|
-
Returns:
|
|
518
|
+
Returns: Nothing.
|
|
523
519
|
|
|
524
|
-
###
|
|
520
|
+
### buildConvLayerContext
|
|
525
521
|
|
|
526
522
|
```ts
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
):
|
|
523
|
+
buildConvLayerContext(
|
|
524
|
+
params: OnnxImportConvLayerContextBuildParams,
|
|
525
|
+
): OnnxImportConvLayerContext | null
|
|
530
526
|
```
|
|
531
527
|
|
|
532
|
-
|
|
528
|
+
Build one Conv layer reconstruction context.
|
|
533
529
|
|
|
534
530
|
Parameters:
|
|
535
|
-
- `
|
|
531
|
+
- `params` - Conv context input params.
|
|
536
532
|
|
|
537
|
-
Returns:
|
|
533
|
+
Returns: Conv layer context when valid.
|
|
538
534
|
|
|
539
|
-
###
|
|
535
|
+
### buildConvNeuronLinearIndex
|
|
540
536
|
|
|
541
537
|
```ts
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
):
|
|
538
|
+
buildConvNeuronLinearIndex(
|
|
539
|
+
coordinate: OnnxImportConvOutputCoordinate,
|
|
540
|
+
convSpec: Conv2DMapping,
|
|
541
|
+
): number
|
|
546
542
|
```
|
|
547
543
|
|
|
548
|
-
|
|
544
|
+
Build flattened linear index for one Conv output coordinate.
|
|
549
545
|
|
|
550
546
|
Parameters:
|
|
551
|
-
- `
|
|
552
|
-
- `
|
|
547
|
+
- `coordinate` - Conv output coordinate.
|
|
548
|
+
- `convSpec` - Conv mapping spec.
|
|
553
549
|
|
|
554
|
-
Returns:
|
|
550
|
+
Returns: Linear neuron index.
|
|
555
551
|
|
|
556
|
-
###
|
|
552
|
+
### buildConvNodeSlices
|
|
557
553
|
|
|
558
554
|
```ts
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
):
|
|
555
|
+
buildConvNodeSlices(
|
|
556
|
+
layerContext: OnnxImportConvLayerContext,
|
|
557
|
+
): OnnxImportConvNodeSlices
|
|
562
558
|
```
|
|
563
559
|
|
|
564
|
-
|
|
560
|
+
Build Conv current/previous node slices for one layer context.
|
|
565
561
|
|
|
566
562
|
Parameters:
|
|
567
|
-
- `
|
|
563
|
+
- `layerContext` - Conv layer context.
|
|
568
564
|
|
|
569
|
-
Returns:
|
|
565
|
+
Returns: Node slice payload.
|
|
570
566
|
|
|
571
|
-
###
|
|
567
|
+
### buildConvTensorContext
|
|
572
568
|
|
|
573
569
|
```ts
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
): OnnxImportLayerNodePair
|
|
570
|
+
buildConvTensorContext(
|
|
571
|
+
layerContext: OnnxImportConvLayerContext,
|
|
572
|
+
): OnnxImportConvTensorContext | null
|
|
578
573
|
```
|
|
579
574
|
|
|
580
|
-
Build
|
|
575
|
+
Build validated Conv tensor context for one layer.
|
|
581
576
|
|
|
582
577
|
Parameters:
|
|
583
|
-
- `
|
|
584
|
-
- `params` - Sequential traversal params.
|
|
578
|
+
- `layerContext` - Conv layer context.
|
|
585
579
|
|
|
586
|
-
Returns:
|
|
580
|
+
Returns: Conv tensor context when valid.
|
|
587
581
|
|
|
588
|
-
###
|
|
582
|
+
### buildHiddenLayerSizesFromBuckets
|
|
589
583
|
|
|
590
584
|
```ts
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
):
|
|
585
|
+
buildHiddenLayerSizesFromBuckets(
|
|
586
|
+
layerWeightBuckets: Record<string, OnnxImportLayerWeightBucket>,
|
|
587
|
+
sortedLayerIndices: number[],
|
|
588
|
+
): number[]
|
|
595
589
|
```
|
|
596
590
|
|
|
597
|
-
|
|
591
|
+
Build hidden-layer sizes from weight buckets while excluding output layer.
|
|
598
592
|
|
|
599
593
|
Parameters:
|
|
600
|
-
- `
|
|
601
|
-
- `
|
|
594
|
+
- `layerWeightBuckets` - Layer-weight buckets.
|
|
595
|
+
- `sortedLayerIndices` - Ascending layer indices.
|
|
602
596
|
|
|
603
|
-
Returns:
|
|
597
|
+
Returns: Hidden-layer sizes.
|
|
604
598
|
|
|
605
|
-
###
|
|
599
|
+
### buildInboundConnectionMap
|
|
606
600
|
|
|
607
601
|
```ts
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
): default[]
|
|
602
|
+
buildInboundConnectionMap(
|
|
603
|
+
neuronInternal: NodeInternals,
|
|
604
|
+
): OnnxImportInboundConnectionMap
|
|
612
605
|
```
|
|
613
606
|
|
|
614
|
-
|
|
607
|
+
Build inbound connection lookup map for one neuron.
|
|
615
608
|
|
|
616
609
|
Parameters:
|
|
617
|
-
- `
|
|
618
|
-
- `params` - Sequential traversal params.
|
|
610
|
+
- `neuronInternal` - Neuron internals.
|
|
619
611
|
|
|
620
|
-
Returns:
|
|
612
|
+
Returns: Inbound connection map keyed by source node.
|
|
621
613
|
|
|
622
|
-
###
|
|
614
|
+
### buildInitializerMap
|
|
623
615
|
|
|
624
616
|
```ts
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
): number
|
|
617
|
+
buildInitializerMap(
|
|
618
|
+
initializers: OnnxTensor[],
|
|
619
|
+
): Record<string, OnnxTensor>
|
|
629
620
|
```
|
|
630
621
|
|
|
631
|
-
|
|
622
|
+
Build ONNX initializer map keyed by tensor name.
|
|
632
623
|
|
|
633
624
|
Parameters:
|
|
634
|
-
- `
|
|
635
|
-
- `exclusiveEndIndex` - Exclusive end index.
|
|
625
|
+
- `initializers` - ONNX initializer list.
|
|
636
626
|
|
|
637
|
-
Returns:
|
|
627
|
+
Returns: Tensor map by name.
|
|
638
628
|
|
|
639
|
-
###
|
|
629
|
+
### buildInputCoordinate
|
|
640
630
|
|
|
641
631
|
```ts
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
): void
|
|
632
|
+
buildInputCoordinate(
|
|
633
|
+
kernelAssignmentContext: OnnxImportConvKernelAssignmentContext,
|
|
634
|
+
): { inputRow: number; inputColumn: number; } | null
|
|
646
635
|
```
|
|
647
636
|
|
|
648
|
-
|
|
637
|
+
Build input-space coordinate for one Conv kernel element.
|
|
649
638
|
|
|
650
639
|
Parameters:
|
|
651
|
-
- `
|
|
652
|
-
- `nodePair` - Current/previous node slices.
|
|
640
|
+
- `kernelAssignmentContext` - Conv kernel assignment context.
|
|
653
641
|
|
|
654
|
-
Returns:
|
|
642
|
+
Returns: Input coordinate when in bounds.
|
|
655
643
|
|
|
656
|
-
###
|
|
644
|
+
### buildInputFeatureLinearIndex
|
|
657
645
|
|
|
658
646
|
```ts
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
647
|
+
buildInputFeatureLinearIndex(
|
|
648
|
+
convSpec: Conv2DMapping,
|
|
649
|
+
inChannelIndex: number,
|
|
650
|
+
inputRow: number,
|
|
651
|
+
inputColumn: number,
|
|
652
|
+
): number
|
|
662
653
|
```
|
|
663
654
|
|
|
664
|
-
|
|
655
|
+
Build linear feature index in input feature space.
|
|
665
656
|
|
|
666
657
|
Parameters:
|
|
667
|
-
- `
|
|
658
|
+
- `convSpec` - Conv mapping spec.
|
|
659
|
+
- `inChannelIndex` - Input channel index.
|
|
660
|
+
- `inputRow` - Input row index.
|
|
661
|
+
- `inputColumn` - Input column index.
|
|
668
662
|
|
|
669
|
-
Returns:
|
|
663
|
+
Returns: Linear input feature index.
|
|
670
664
|
|
|
671
|
-
###
|
|
665
|
+
### buildLayerNodePair
|
|
672
666
|
|
|
673
667
|
```ts
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
668
|
+
buildLayerNodePair(
|
|
669
|
+
assignmentContext: OnnxImportWeightAssignmentContext,
|
|
670
|
+
params: OnnxImportLayerNodePairBuildParams,
|
|
671
|
+
): OnnxImportLayerNodePair
|
|
677
672
|
```
|
|
678
673
|
|
|
679
|
-
Build
|
|
674
|
+
Build current/previous node slices for one sequential import layer pass.
|
|
680
675
|
|
|
681
676
|
Parameters:
|
|
682
|
-
- `
|
|
677
|
+
- `assignmentContext` - Shared assignment context.
|
|
678
|
+
- `params` - Sequential traversal params.
|
|
683
679
|
|
|
684
|
-
Returns: Layer
|
|
680
|
+
Returns: Layer node pair.
|
|
685
681
|
|
|
686
|
-
###
|
|
682
|
+
### buildLayerTensorNames
|
|
687
683
|
|
|
688
684
|
```ts
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
):
|
|
685
|
+
buildLayerTensorNames(
|
|
686
|
+
layerIndex: number,
|
|
687
|
+
): OnnxImportLayerTensorNames
|
|
692
688
|
```
|
|
693
689
|
|
|
694
|
-
|
|
690
|
+
Build dense weight/bias tensor names for one layer index.
|
|
695
691
|
|
|
696
692
|
Parameters:
|
|
697
|
-
- `
|
|
693
|
+
- `layerIndex` - Export layer index.
|
|
698
694
|
|
|
699
|
-
Returns:
|
|
695
|
+
Returns: Layer tensor names.
|
|
700
696
|
|
|
701
|
-
###
|
|
697
|
+
### buildPerNeuronTensorNames
|
|
702
698
|
|
|
703
699
|
```ts
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
700
|
+
buildPerNeuronTensorNames(
|
|
701
|
+
layerIndex: number,
|
|
702
|
+
neuronIndex: number,
|
|
703
|
+
): OnnxImportLayerTensorNames
|
|
707
704
|
```
|
|
708
705
|
|
|
709
|
-
|
|
706
|
+
Build per-neuron tensor names for one layer and neuron index.
|
|
710
707
|
|
|
711
708
|
Parameters:
|
|
712
|
-
- `
|
|
709
|
+
- `layerIndex` - Export layer index.
|
|
710
|
+
- `neuronIndex` - Neuron index in layer.
|
|
713
711
|
|
|
714
|
-
Returns:
|
|
712
|
+
Returns: Per-neuron tensor names.
|
|
715
713
|
|
|
716
|
-
###
|
|
714
|
+
### buildWeightAssignmentContext
|
|
717
715
|
|
|
718
716
|
```ts
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
):
|
|
717
|
+
buildWeightAssignmentContext(
|
|
718
|
+
params: OnnxImportWeightAssignmentBuildParams,
|
|
719
|
+
): OnnxImportWeightAssignmentContext
|
|
722
720
|
```
|
|
723
721
|
|
|
724
|
-
|
|
722
|
+
Build the shared assignment context for import weight restoration.
|
|
725
723
|
|
|
726
724
|
Parameters:
|
|
727
|
-
- `
|
|
725
|
+
- `params` - Assignment context input params.
|
|
728
726
|
|
|
729
|
-
Returns:
|
|
727
|
+
Returns: Shared assignment context.
|
|
730
728
|
|
|
731
|
-
###
|
|
729
|
+
### collectConvKernelCoordinates
|
|
732
730
|
|
|
733
731
|
```ts
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
732
|
+
collectConvKernelCoordinates(
|
|
733
|
+
inChannels: number,
|
|
734
|
+
kernelHeight: number,
|
|
735
|
+
kernelWidth: number,
|
|
736
|
+
): OnnxConvKernelCoordinate[]
|
|
738
737
|
```
|
|
739
738
|
|
|
740
|
-
|
|
739
|
+
Collect all kernel traversal coordinates for one Conv output position.
|
|
741
740
|
|
|
742
741
|
Parameters:
|
|
743
|
-
- `
|
|
744
|
-
- `
|
|
742
|
+
- `inChannels` - Input channel count.
|
|
743
|
+
- `kernelHeight` - Kernel height.
|
|
744
|
+
- `kernelWidth` - Kernel width.
|
|
745
745
|
|
|
746
|
-
Returns:
|
|
746
|
+
Returns: Kernel traversal coordinates.
|
|
747
747
|
|
|
748
|
-
###
|
|
748
|
+
### collectConvOutputCoordinates
|
|
749
749
|
|
|
750
750
|
```ts
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
751
|
+
collectConvOutputCoordinates(
|
|
752
|
+
convSpec: Conv2DMapping,
|
|
753
|
+
outChannels: number,
|
|
754
|
+
): OnnxImportConvOutputCoordinate[]
|
|
754
755
|
```
|
|
755
756
|
|
|
756
|
-
|
|
757
|
+
Collect all output traversal coordinates for one Conv layer.
|
|
757
758
|
|
|
758
759
|
Parameters:
|
|
759
|
-
- `
|
|
760
|
+
- `convSpec` - Conv mapping spec.
|
|
761
|
+
- `outChannels` - Output channel count.
|
|
760
762
|
|
|
761
|
-
Returns:
|
|
763
|
+
Returns: Output traversal coordinates.
|
|
762
764
|
|
|
763
|
-
###
|
|
765
|
+
### collectLayerWeightBuckets
|
|
764
766
|
|
|
765
767
|
```ts
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
):
|
|
768
|
+
collectLayerWeightBuckets(
|
|
769
|
+
initializers: OnnxTensor[],
|
|
770
|
+
): Record<string, OnnxImportLayerWeightBucket>
|
|
769
771
|
```
|
|
770
772
|
|
|
771
|
-
|
|
773
|
+
Collect ONNX weight tensor buckets grouped by export layer index.
|
|
772
774
|
|
|
773
775
|
Parameters:
|
|
774
|
-
- `
|
|
776
|
+
- `initializers` - ONNX initializer tensors.
|
|
775
777
|
|
|
776
|
-
Returns:
|
|
778
|
+
Returns: Layer-weight buckets keyed by export layer index.
|
|
777
779
|
|
|
778
|
-
###
|
|
780
|
+
### collectNodesByType
|
|
779
781
|
|
|
780
782
|
```ts
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
783
|
+
collectNodesByType(
|
|
784
|
+
nodes: default[],
|
|
785
|
+
nodeType: "input" | "output" | "hidden",
|
|
786
|
+
): default[]
|
|
784
787
|
```
|
|
785
788
|
|
|
786
|
-
|
|
789
|
+
Collect nodes by runtime node type discriminator.
|
|
787
790
|
|
|
788
791
|
Parameters:
|
|
789
|
-
- `
|
|
792
|
+
- `nodes` - Network nodes.
|
|
793
|
+
- `nodeType` - Runtime node type.
|
|
790
794
|
|
|
791
|
-
Returns:
|
|
795
|
+
Returns: Filtered nodes.
|
|
792
796
|
|
|
793
|
-
###
|
|
797
|
+
### collectSortedLayerIndices
|
|
794
798
|
|
|
795
799
|
```ts
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
):
|
|
800
|
+
collectSortedLayerIndices(
|
|
801
|
+
layerWeightBuckets: Record<string, OnnxImportLayerWeightBucket>,
|
|
802
|
+
): number[]
|
|
799
803
|
```
|
|
800
804
|
|
|
801
|
-
|
|
805
|
+
Collect sorted layer indices from weight buckets.
|
|
802
806
|
|
|
803
807
|
Parameters:
|
|
804
|
-
- `
|
|
808
|
+
- `layerWeightBuckets` - Layer-weight buckets.
|
|
805
809
|
|
|
806
|
-
Returns:
|
|
810
|
+
Returns: Ascending export layer indices.
|
|
807
811
|
|
|
808
|
-
###
|
|
812
|
+
### collectSortedUniqueLayerIndices
|
|
809
813
|
|
|
810
814
|
```ts
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
):
|
|
815
|
+
collectSortedUniqueLayerIndices(
|
|
816
|
+
initializerMap: Record<string, OnnxTensor>,
|
|
817
|
+
): number[]
|
|
814
818
|
```
|
|
815
819
|
|
|
816
|
-
|
|
820
|
+
Collect unique sorted layer indices from initializer weight tensors.
|
|
817
821
|
|
|
818
822
|
Parameters:
|
|
819
|
-
- `
|
|
823
|
+
- `initializerMap` - Initializer map keyed by tensor name.
|
|
820
824
|
|
|
821
|
-
Returns:
|
|
825
|
+
Returns: Unique sorted layer indices.
|
|
822
826
|
|
|
823
|
-
###
|
|
827
|
+
### deriveHiddenLayerSizes
|
|
824
828
|
|
|
825
829
|
```ts
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
830
|
+
deriveHiddenLayerSizes(
|
|
831
|
+
initializers: OnnxTensor[],
|
|
832
|
+
metadataProps: OnnxMetadataProperty[] | undefined,
|
|
833
|
+
): number[]
|
|
829
834
|
```
|
|
830
835
|
|
|
831
|
-
|
|
836
|
+
Extract hidden layer sizes from ONNX initializers (weight tensors).
|
|
832
837
|
|
|
833
838
|
Parameters:
|
|
834
|
-
- `
|
|
839
|
+
- `initializers` - ONNX initializer tensors.
|
|
840
|
+
- `metadataProps` - Optional ONNX metadata properties.
|
|
835
841
|
|
|
836
|
-
Returns:
|
|
842
|
+
Returns: Hidden layer sizes in order.
|
|
837
843
|
|
|
838
|
-
###
|
|
844
|
+
### hasAggregatedLayerWeights
|
|
839
845
|
|
|
840
846
|
```ts
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
):
|
|
847
|
+
hasAggregatedLayerWeights(
|
|
848
|
+
aggregatedContext: OnnxImportAggregatedLayerAssignmentContext,
|
|
849
|
+
): boolean
|
|
844
850
|
```
|
|
845
851
|
|
|
846
|
-
|
|
852
|
+
Determine whether the layer has aggregated weight tensor data.
|
|
847
853
|
|
|
848
854
|
Parameters:
|
|
849
|
-
- `
|
|
855
|
+
- `aggregatedContext` - Aggregated assignment context.
|
|
850
856
|
|
|
851
|
-
Returns:
|
|
857
|
+
Returns: True when aggregated tensor exists.
|
|
852
858
|
|
|
853
|
-
###
|
|
859
|
+
### parseConvMetadata
|
|
854
860
|
|
|
855
861
|
```ts
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
): OnnxImportConvOutputCoordinate[]
|
|
862
|
+
parseConvMetadata(
|
|
863
|
+
metadataProps: OnnxMetadataProperty[],
|
|
864
|
+
): OnnxImportConvMetadata | null
|
|
860
865
|
```
|
|
861
866
|
|
|
862
|
-
|
|
867
|
+
Parse Conv reconstruction metadata payload.
|
|
863
868
|
|
|
864
869
|
Parameters:
|
|
865
|
-
- `
|
|
866
|
-
- `outChannels` - Output channel count.
|
|
870
|
+
- `metadataProps` - ONNX metadata properties.
|
|
867
871
|
|
|
868
|
-
Returns:
|
|
872
|
+
Returns: Parsed Conv metadata.
|
|
869
873
|
|
|
870
|
-
###
|
|
874
|
+
### parseLayerIndexFromWeightTensor
|
|
871
875
|
|
|
872
876
|
```ts
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
):
|
|
877
|
+
parseLayerIndexFromWeightTensor(
|
|
878
|
+
tensorName: string,
|
|
879
|
+
): number | null
|
|
876
880
|
```
|
|
877
881
|
|
|
878
|
-
|
|
882
|
+
Parse layer index from dense/per-neuron weight tensor name.
|
|
879
883
|
|
|
880
884
|
Parameters:
|
|
881
|
-
- `
|
|
885
|
+
- `tensorName` - Tensor name.
|
|
882
886
|
|
|
883
|
-
Returns:
|
|
887
|
+
Returns: Parsed layer index or null.
|
|
884
888
|
|
|
885
|
-
###
|
|
889
|
+
### parseMetadataLayerSizes
|
|
886
890
|
|
|
887
891
|
```ts
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
): number
|
|
892
|
+
parseMetadataLayerSizes(
|
|
893
|
+
metadataProps: OnnxMetadataProperty[],
|
|
894
|
+
): number[] | null
|
|
892
895
|
```
|
|
893
896
|
|
|
894
|
-
|
|
897
|
+
Parse explicit metadata-driven hidden layer sizes.
|
|
895
898
|
|
|
896
899
|
Parameters:
|
|
897
|
-
- `
|
|
898
|
-
- `convSpec` - Conv mapping spec.
|
|
900
|
+
- `metadataProps` - ONNX metadata properties.
|
|
899
901
|
|
|
900
|
-
Returns:
|
|
902
|
+
Returns: Parsed hidden layer sizes when available.
|
|
901
903
|
|
|
902
|
-
###
|
|
904
|
+
### parseWeightTensorName
|
|
903
905
|
|
|
904
906
|
```ts
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
kernelWidth: number,
|
|
909
|
-
): OnnxConvKernelCoordinate[]
|
|
907
|
+
parseWeightTensorName(
|
|
908
|
+
tensorName: string,
|
|
909
|
+
): { layerIndex: string; neuronIndex: number | null; } | null
|
|
910
910
|
```
|
|
911
911
|
|
|
912
|
-
|
|
912
|
+
Parse layer/neuron components from a weight tensor name.
|
|
913
913
|
|
|
914
914
|
Parameters:
|
|
915
|
-
- `
|
|
916
|
-
- `kernelHeight` - Kernel height.
|
|
917
|
-
- `kernelWidth` - Kernel width.
|
|
915
|
+
- `tensorName` - Tensor name.
|
|
918
916
|
|
|
919
|
-
Returns:
|
|
917
|
+
Returns: Parsed layer+neuron components when matched.
|
|
920
918
|
|
|
921
|
-
###
|
|
919
|
+
### readConvKernelWeight
|
|
922
920
|
|
|
923
921
|
```ts
|
|
924
|
-
|
|
922
|
+
readConvKernelWeight(
|
|
925
923
|
kernelAssignmentContext: OnnxImportConvKernelAssignmentContext,
|
|
926
|
-
):
|
|
924
|
+
): number
|
|
927
925
|
```
|
|
928
926
|
|
|
929
|
-
|
|
927
|
+
Read one Conv kernel weight from flattened ONNX tensor payload.
|
|
930
928
|
|
|
931
929
|
Parameters:
|
|
932
930
|
- `kernelAssignmentContext` - Conv kernel assignment context.
|
|
933
931
|
|
|
934
|
-
Returns:
|
|
932
|
+
Returns: Kernel weight.
|
|
935
933
|
|
|
936
|
-
###
|
|
934
|
+
### resolveCurrentLayerNodes
|
|
937
935
|
|
|
938
936
|
```ts
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
937
|
+
resolveCurrentLayerNodes(
|
|
938
|
+
assignmentContext: OnnxImportWeightAssignmentContext,
|
|
939
|
+
params: { sequentialIndex: number; },
|
|
940
|
+
): default[]
|
|
942
941
|
```
|
|
943
942
|
|
|
944
|
-
|
|
943
|
+
Resolve current layer nodes for one sequential layer assignment pass.
|
|
945
944
|
|
|
946
945
|
Parameters:
|
|
947
|
-
- `
|
|
946
|
+
- `assignmentContext` - Shared assignment context.
|
|
947
|
+
- `params` - Sequential traversal params.
|
|
948
948
|
|
|
949
|
-
Returns:
|
|
949
|
+
Returns: Current layer nodes.
|
|
950
950
|
|
|
951
|
-
###
|
|
951
|
+
### resolveLayerHiddenSize
|
|
952
952
|
|
|
953
953
|
```ts
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
inputRow: number,
|
|
958
|
-
inputColumn: number,
|
|
954
|
+
resolveLayerHiddenSize(
|
|
955
|
+
layerWeightBuckets: Record<string, OnnxImportLayerWeightBucket>,
|
|
956
|
+
layerIndex: number,
|
|
959
957
|
): number
|
|
960
958
|
```
|
|
961
959
|
|
|
962
|
-
|
|
960
|
+
Resolve one hidden-layer size from its weight bucket.
|
|
963
961
|
|
|
964
962
|
Parameters:
|
|
965
|
-
- `
|
|
966
|
-
- `
|
|
967
|
-
- `inputRow` - Input row index.
|
|
968
|
-
- `inputColumn` - Input column index.
|
|
963
|
+
- `layerWeightBuckets` - Layer-weight buckets.
|
|
964
|
+
- `layerIndex` - Export layer index.
|
|
969
965
|
|
|
970
|
-
Returns:
|
|
966
|
+
Returns: Hidden-layer size.
|
|
971
967
|
|
|
972
|
-
###
|
|
968
|
+
### resolvePreviousLayerNodes
|
|
973
969
|
|
|
974
970
|
```ts
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
971
|
+
resolvePreviousLayerNodes(
|
|
972
|
+
assignmentContext: OnnxImportWeightAssignmentContext,
|
|
973
|
+
params: { sequentialIndex: number; },
|
|
974
|
+
): default[]
|
|
978
975
|
```
|
|
979
976
|
|
|
980
|
-
|
|
977
|
+
Resolve previous layer nodes for one sequential layer assignment pass.
|
|
981
978
|
|
|
982
979
|
Parameters:
|
|
983
|
-
- `
|
|
980
|
+
- `assignmentContext` - Shared assignment context.
|
|
981
|
+
- `params` - Sequential traversal params.
|
|
984
982
|
|
|
985
|
-
Returns:
|
|
983
|
+
Returns: Previous layer nodes.
|
|
986
984
|
|
|
987
|
-
###
|
|
985
|
+
### sumHiddenSizesToIndex
|
|
988
986
|
|
|
989
987
|
```ts
|
|
990
|
-
|
|
991
|
-
|
|
988
|
+
sumHiddenSizesToIndex(
|
|
989
|
+
hiddenLayerSizes: number[],
|
|
990
|
+
exclusiveEndIndex: number,
|
|
992
991
|
): number
|
|
993
992
|
```
|
|
994
993
|
|
|
995
|
-
|
|
994
|
+
Sum hidden-layer sizes from index `0` to `exclusiveEndIndex`.
|
|
996
995
|
|
|
997
996
|
Parameters:
|
|
998
|
-
- `
|
|
997
|
+
- `hiddenLayerSizes` - Hidden-layer size list.
|
|
998
|
+
- `exclusiveEndIndex` - Exclusive end index.
|
|
999
999
|
|
|
1000
|
-
Returns:
|
|
1000
|
+
Returns: Prefix sum.
|
|
1001
1001
|
|
|
1002
1002
|
## architecture/network/onnx/import/network.onnx.import-activations.utils.ts
|
|
1003
1003
|
|
|
@@ -1030,21 +1030,21 @@ Keeping them here makes the import chapter explain its own execution state
|
|
|
1030
1030
|
without forcing the root ONNX compatibility barrel to remain the ownership
|
|
1031
1031
|
home for importer-only details.
|
|
1032
1032
|
|
|
1033
|
-
###
|
|
1033
|
+
### NetworkWithOnnxImportPooling
|
|
1034
1034
|
|
|
1035
|
-
|
|
1035
|
+
Network instance augmented with optional imported ONNX pooling metadata.
|
|
1036
1036
|
|
|
1037
1037
|
### OnnxImportArchitectureContext
|
|
1038
1038
|
|
|
1039
1039
|
Shared architecture extraction context with resolved graph dimensions.
|
|
1040
1040
|
|
|
1041
|
-
###
|
|
1041
|
+
### OnnxImportArchitectureResult
|
|
1042
1042
|
|
|
1043
|
-
|
|
1043
|
+
Parsed architecture dimensions extracted from ONNX import graph payloads.
|
|
1044
1044
|
|
|
1045
|
-
###
|
|
1045
|
+
### OnnxImportDimensionRecord
|
|
1046
1046
|
|
|
1047
|
-
|
|
1047
|
+
Loose ONNX shape-dimension record used by legacy import payload access.
|
|
1048
1048
|
|
|
1049
1049
|
### OnnxImportHiddenLayerSpan
|
|
1050
1050
|
|
|
@@ -1054,70 +1054,32 @@ Hidden-layer span payload with one-based layer numbering and global offset.
|
|
|
1054
1054
|
|
|
1055
1055
|
Execution context for assigning one hidden-layer recurrent diagonal tensor.
|
|
1056
1056
|
|
|
1057
|
-
### OnnxImportSelfConnectionUpsertContext
|
|
1058
|
-
|
|
1059
|
-
Context for upserting one hidden node self-connection from recurrent weight.
|
|
1060
|
-
|
|
1061
1057
|
### OnnxImportPoolingMetadata
|
|
1062
1058
|
|
|
1063
1059
|
Parsed pooling metadata payload attached to imported network instances.
|
|
1064
1060
|
|
|
1065
|
-
###
|
|
1066
|
-
|
|
1067
|
-
Network instance augmented with optional imported ONNX pooling metadata.
|
|
1068
|
-
|
|
1069
|
-
## architecture/network/onnx/import/network.onnx.import-orchestrators.utils.ts
|
|
1070
|
-
|
|
1071
|
-
### extractOnnxArchitecture
|
|
1072
|
-
|
|
1073
|
-
```ts
|
|
1074
|
-
extractOnnxArchitecture(
|
|
1075
|
-
onnx: OnnxModel,
|
|
1076
|
-
): OnnxImportArchitectureResult
|
|
1077
|
-
```
|
|
1078
|
-
|
|
1079
|
-
Extract input/output counts and hidden layer sizes from ONNX model.
|
|
1080
|
-
|
|
1081
|
-
Parameters:
|
|
1082
|
-
- `onnx` - Source ONNX model.
|
|
1083
|
-
|
|
1084
|
-
Returns: Parsed architecture dimensions.
|
|
1085
|
-
|
|
1086
|
-
### pruneSingleLayerHiddenPlaceholders
|
|
1061
|
+
### OnnxImportRecurrentRestorationContext
|
|
1087
1062
|
|
|
1088
|
-
|
|
1089
|
-
pruneSingleLayerHiddenPlaceholders(
|
|
1090
|
-
network: default,
|
|
1091
|
-
hiddenLayerSizes: number[],
|
|
1092
|
-
): void
|
|
1093
|
-
```
|
|
1063
|
+
Context for recurrent self-connection restoration from ONNX metadata and tensors.
|
|
1094
1064
|
|
|
1095
|
-
|
|
1065
|
+
### OnnxImportSelfConnectionUpsertContext
|
|
1096
1066
|
|
|
1097
|
-
|
|
1098
|
-
- `network` - Target network.
|
|
1099
|
-
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
1067
|
+
Context for upserting one hidden node self-connection from recurrent weight.
|
|
1100
1068
|
|
|
1101
|
-
|
|
1069
|
+
## architecture/network/onnx/import/network.onnx.import-orchestrators.utils.ts
|
|
1102
1070
|
|
|
1103
|
-
###
|
|
1071
|
+
### applyLayerSelfConnections
|
|
1104
1072
|
|
|
1105
1073
|
```ts
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
onnx: OnnxModel,
|
|
1109
|
-
hiddenLayerSizes: number[],
|
|
1110
|
-
metadata: OnnxMetadataProperty[],
|
|
1074
|
+
applyLayerSelfConnections(
|
|
1075
|
+
layerConnectionContext: OnnxImportLayerConnectionContext,
|
|
1111
1076
|
): void
|
|
1112
1077
|
```
|
|
1113
1078
|
|
|
1114
|
-
|
|
1079
|
+
Apply one hidden layer diagonal recurrent self-weights.
|
|
1115
1080
|
|
|
1116
1081
|
Parameters:
|
|
1117
|
-
- `
|
|
1118
|
-
- `onnx` - Source ONNX model.
|
|
1119
|
-
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
1120
|
-
- `metadata` - Parsed metadata properties.
|
|
1082
|
+
- `layerConnectionContext` - Layer connection context.
|
|
1121
1083
|
|
|
1122
1084
|
Returns: Nothing.
|
|
1123
1085
|
|
|
@@ -1138,56 +1100,20 @@ Parameters:
|
|
|
1138
1100
|
|
|
1139
1101
|
Returns: Nothing.
|
|
1140
1102
|
|
|
1141
|
-
###
|
|
1103
|
+
### attachParsedPoolingMetadata
|
|
1142
1104
|
|
|
1143
1105
|
```ts
|
|
1144
|
-
|
|
1106
|
+
attachParsedPoolingMetadata(
|
|
1145
1107
|
network: default,
|
|
1146
|
-
|
|
1147
|
-
hiddenLayerSizes: number[],
|
|
1148
|
-
layerFactory: OnnxLayerFactory,
|
|
1149
|
-
metadata: OnnxMetadataProperty[],
|
|
1108
|
+
poolingMetadata: OnnxImportPoolingMetadata,
|
|
1150
1109
|
): void
|
|
1151
1110
|
```
|
|
1152
1111
|
|
|
1153
|
-
|
|
1112
|
+
Attach parsed pooling metadata to imported network instance.
|
|
1154
1113
|
|
|
1155
1114
|
Parameters:
|
|
1156
1115
|
- `network` - Target network.
|
|
1157
|
-
- `
|
|
1158
|
-
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
1159
|
-
- `layerFactory` - Dynamic layer module.
|
|
1160
|
-
- `metadata` - ONNX metadata properties.
|
|
1161
|
-
|
|
1162
|
-
Returns: Nothing.
|
|
1163
|
-
|
|
1164
|
-
### parseRecurrentLayerIndices
|
|
1165
|
-
|
|
1166
|
-
```ts
|
|
1167
|
-
parseRecurrentLayerIndices(
|
|
1168
|
-
rawMetadataValue: string,
|
|
1169
|
-
): number[]
|
|
1170
|
-
```
|
|
1171
|
-
|
|
1172
|
-
Parse recurrent layer indices metadata.
|
|
1173
|
-
|
|
1174
|
-
Parameters:
|
|
1175
|
-
- `rawMetadataValue` - Raw metadata JSON string.
|
|
1176
|
-
|
|
1177
|
-
Returns: Normalized recurrent layer indices.
|
|
1178
|
-
|
|
1179
|
-
### applyLayerSelfConnections
|
|
1180
|
-
|
|
1181
|
-
```ts
|
|
1182
|
-
applyLayerSelfConnections(
|
|
1183
|
-
layerConnectionContext: OnnxImportLayerConnectionContext,
|
|
1184
|
-
): void
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
Apply one hidden layer diagonal recurrent self-weights.
|
|
1188
|
-
|
|
1189
|
-
Parameters:
|
|
1190
|
-
- `layerConnectionContext` - Layer connection context.
|
|
1116
|
+
- `poolingMetadata` - Parsed pooling metadata payload.
|
|
1191
1117
|
|
|
1192
1118
|
Returns: Nothing.
|
|
1193
1119
|
|
|
@@ -1199,57 +1125,44 @@ buildArchitectureContext(
|
|
|
1199
1125
|
): OnnxImportArchitectureContext
|
|
1200
1126
|
```
|
|
1201
1127
|
|
|
1202
|
-
Build architecture extraction context from ONNX graph state.
|
|
1203
|
-
|
|
1204
|
-
Parameters:
|
|
1205
|
-
- `onnx` - Source ONNX model.
|
|
1206
|
-
|
|
1207
|
-
Returns: Normalized architecture extraction context.
|
|
1208
|
-
|
|
1209
|
-
### readLastDimensionValue
|
|
1210
|
-
|
|
1211
|
-
```ts
|
|
1212
|
-
readLastDimensionValue(
|
|
1213
|
-
dimensions: { dim_value?: number | undefined; }[],
|
|
1214
|
-
): number
|
|
1215
|
-
```
|
|
1216
|
-
|
|
1217
|
-
Read the terminal ONNX shape dimension value from one shape array.
|
|
1128
|
+
Build architecture extraction context from ONNX graph state.
|
|
1218
1129
|
|
|
1219
1130
|
Parameters:
|
|
1220
|
-
- `
|
|
1131
|
+
- `onnx` - Source ONNX model.
|
|
1221
1132
|
|
|
1222
|
-
Returns:
|
|
1133
|
+
Returns: Normalized architecture extraction context.
|
|
1223
1134
|
|
|
1224
|
-
###
|
|
1135
|
+
### buildHiddenLayerSpans
|
|
1225
1136
|
|
|
1226
1137
|
```ts
|
|
1227
|
-
|
|
1138
|
+
buildHiddenLayerSpans(
|
|
1228
1139
|
hiddenLayerSizes: number[],
|
|
1229
|
-
):
|
|
1140
|
+
): OnnxImportHiddenLayerSpan[]
|
|
1230
1141
|
```
|
|
1231
1142
|
|
|
1232
|
-
|
|
1143
|
+
Build hidden-layer spans with one-based layer numbering and global offsets.
|
|
1233
1144
|
|
|
1234
1145
|
Parameters:
|
|
1235
1146
|
- `hiddenLayerSizes` - Hidden-layer size list.
|
|
1236
1147
|
|
|
1237
|
-
Returns:
|
|
1148
|
+
Returns: Hidden-layer span payload list.
|
|
1238
1149
|
|
|
1239
|
-
###
|
|
1150
|
+
### collectDiagonalRecurrentWeights
|
|
1240
1151
|
|
|
1241
1152
|
```ts
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1153
|
+
collectDiagonalRecurrentWeights(
|
|
1154
|
+
recurrentTensorWeights: number[],
|
|
1155
|
+
hiddenLayerSize: number,
|
|
1156
|
+
): number[]
|
|
1245
1157
|
```
|
|
1246
1158
|
|
|
1247
|
-
Collect
|
|
1159
|
+
Collect diagonal recurrent weights from flattened layer tensor data.
|
|
1248
1160
|
|
|
1249
1161
|
Parameters:
|
|
1250
|
-
- `
|
|
1162
|
+
- `recurrentTensorWeights` - Flattened recurrent tensor weights.
|
|
1163
|
+
- `hiddenLayerSize` - Hidden-layer width.
|
|
1251
1164
|
|
|
1252
|
-
Returns:
|
|
1165
|
+
Returns: Diagonal recurrent self-weights.
|
|
1253
1166
|
|
|
1254
1167
|
### collectNodesByType
|
|
1255
1168
|
|
|
@@ -1268,6 +1181,21 @@ Parameters:
|
|
|
1268
1181
|
|
|
1269
1182
|
Returns: Filtered node list.
|
|
1270
1183
|
|
|
1184
|
+
### collectPerceptronBoundaryNodes
|
|
1185
|
+
|
|
1186
|
+
```ts
|
|
1187
|
+
collectPerceptronBoundaryNodes(
|
|
1188
|
+
nodes: default[],
|
|
1189
|
+
): default[]
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
Collect input and output boundary nodes for perceptron imports.
|
|
1193
|
+
|
|
1194
|
+
Parameters:
|
|
1195
|
+
- `nodes` - Full network node list.
|
|
1196
|
+
|
|
1197
|
+
Returns: Input/output-only node list.
|
|
1198
|
+
|
|
1271
1199
|
### collectRecurrentLayerSpans
|
|
1272
1200
|
|
|
1273
1201
|
```ts
|
|
@@ -1283,20 +1211,20 @@ Parameters:
|
|
|
1283
1211
|
|
|
1284
1212
|
Returns: Hidden-layer spans requiring recurrent restoration.
|
|
1285
1213
|
|
|
1286
|
-
###
|
|
1214
|
+
### extractOnnxArchitecture
|
|
1287
1215
|
|
|
1288
1216
|
```ts
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
):
|
|
1217
|
+
extractOnnxArchitecture(
|
|
1218
|
+
onnx: OnnxModel,
|
|
1219
|
+
): OnnxImportArchitectureResult
|
|
1292
1220
|
```
|
|
1293
1221
|
|
|
1294
|
-
|
|
1222
|
+
Extract input/output counts and hidden layer sizes from ONNX model.
|
|
1295
1223
|
|
|
1296
1224
|
Parameters:
|
|
1297
|
-
- `
|
|
1225
|
+
- `onnx` - Source ONNX model.
|
|
1298
1226
|
|
|
1299
|
-
Returns: Parsed
|
|
1227
|
+
Returns: Parsed architecture dimensions.
|
|
1300
1228
|
|
|
1301
1229
|
### findMetadataProperty
|
|
1302
1230
|
|
|
@@ -1315,20 +1243,35 @@ Parameters:
|
|
|
1315
1243
|
|
|
1316
1244
|
Returns: Matching metadata property when present.
|
|
1317
1245
|
|
|
1318
|
-
###
|
|
1246
|
+
### findRecurrentInitializer
|
|
1319
1247
|
|
|
1320
1248
|
```ts
|
|
1321
|
-
|
|
1249
|
+
findRecurrentInitializer(
|
|
1250
|
+
layerConnectionContext: OnnxImportLayerConnectionContext,
|
|
1251
|
+
): { name: string; float_data: number[]; } | undefined
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
Resolve recurrent initializer tensor for one hidden-layer span.
|
|
1255
|
+
|
|
1256
|
+
Parameters:
|
|
1257
|
+
- `layerConnectionContext` - Layer connection context.
|
|
1258
|
+
|
|
1259
|
+
Returns: Recurrent initializer tensor when available.
|
|
1260
|
+
|
|
1261
|
+
### isSingleLayerPerceptronImport
|
|
1262
|
+
|
|
1263
|
+
```ts
|
|
1264
|
+
isSingleLayerPerceptronImport(
|
|
1322
1265
|
hiddenLayerSizes: number[],
|
|
1323
|
-
):
|
|
1266
|
+
): boolean
|
|
1324
1267
|
```
|
|
1325
1268
|
|
|
1326
|
-
|
|
1269
|
+
Determine whether import shape corresponds to a single-layer perceptron.
|
|
1327
1270
|
|
|
1328
1271
|
Parameters:
|
|
1329
1272
|
- `hiddenLayerSizes` - Hidden-layer size list.
|
|
1330
1273
|
|
|
1331
|
-
Returns:
|
|
1274
|
+
Returns: True when no hidden layers exist.
|
|
1332
1275
|
|
|
1333
1276
|
### normalizeRecurrentLayerIndices
|
|
1334
1277
|
|
|
@@ -1345,105 +1288,174 @@ Parameters:
|
|
|
1345
1288
|
|
|
1346
1289
|
Returns: Recurrent layer indices.
|
|
1347
1290
|
|
|
1348
|
-
###
|
|
1291
|
+
### parsePoolingMetadata
|
|
1349
1292
|
|
|
1350
1293
|
```ts
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
):
|
|
1294
|
+
parsePoolingMetadata(
|
|
1295
|
+
metadata: OnnxMetadataProperty[],
|
|
1296
|
+
): OnnxImportPoolingMetadata | null
|
|
1354
1297
|
```
|
|
1355
1298
|
|
|
1356
|
-
|
|
1299
|
+
Parse pooling metadata payload from ONNX metadata.
|
|
1357
1300
|
|
|
1358
1301
|
Parameters:
|
|
1359
|
-
- `
|
|
1302
|
+
- `metadata` - ONNX metadata entries.
|
|
1360
1303
|
|
|
1361
|
-
Returns:
|
|
1304
|
+
Returns: Parsed pooling metadata payload.
|
|
1362
1305
|
|
|
1363
|
-
###
|
|
1306
|
+
### parseRecurrentLayerIndices
|
|
1364
1307
|
|
|
1365
1308
|
```ts
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
):
|
|
1309
|
+
parseRecurrentLayerIndices(
|
|
1310
|
+
rawMetadataValue: string,
|
|
1311
|
+
): number[]
|
|
1369
1312
|
```
|
|
1370
1313
|
|
|
1371
|
-
|
|
1314
|
+
Parse recurrent layer indices metadata.
|
|
1372
1315
|
|
|
1373
1316
|
Parameters:
|
|
1374
|
-
- `
|
|
1317
|
+
- `rawMetadataValue` - Raw metadata JSON string.
|
|
1375
1318
|
|
|
1376
|
-
Returns:
|
|
1319
|
+
Returns: Normalized recurrent layer indices.
|
|
1377
1320
|
|
|
1378
|
-
###
|
|
1321
|
+
### pruneSingleLayerHiddenPlaceholders
|
|
1379
1322
|
|
|
1380
1323
|
```ts
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
):
|
|
1324
|
+
pruneSingleLayerHiddenPlaceholders(
|
|
1325
|
+
network: default,
|
|
1326
|
+
hiddenLayerSizes: number[],
|
|
1327
|
+
): void
|
|
1385
1328
|
```
|
|
1386
1329
|
|
|
1387
|
-
|
|
1330
|
+
Remove placeholder hidden nodes for single-layer perceptron imports.
|
|
1388
1331
|
|
|
1389
1332
|
Parameters:
|
|
1390
|
-
- `
|
|
1391
|
-
- `
|
|
1333
|
+
- `network` - Target network.
|
|
1334
|
+
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
1392
1335
|
|
|
1393
|
-
Returns:
|
|
1336
|
+
Returns: Nothing.
|
|
1394
1337
|
|
|
1395
|
-
###
|
|
1338
|
+
### readLastDimensionValue
|
|
1396
1339
|
|
|
1397
1340
|
```ts
|
|
1398
|
-
|
|
1399
|
-
|
|
1341
|
+
readLastDimensionValue(
|
|
1342
|
+
dimensions: { dim_value?: number | undefined; }[],
|
|
1343
|
+
): number
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
Read the terminal ONNX shape dimension value from one shape array.
|
|
1347
|
+
|
|
1348
|
+
Parameters:
|
|
1349
|
+
- `dimensions` - ONNX shape dimensions.
|
|
1350
|
+
|
|
1351
|
+
Returns: Terminal `dim_value` payload.
|
|
1352
|
+
|
|
1353
|
+
### reconstructFusedRecurrentLayers
|
|
1354
|
+
|
|
1355
|
+
```ts
|
|
1356
|
+
reconstructFusedRecurrentLayers(
|
|
1357
|
+
network: default,
|
|
1358
|
+
onnx: OnnxModel,
|
|
1359
|
+
hiddenLayerSizes: number[],
|
|
1360
|
+
layerFactory: OnnxLayerFactory,
|
|
1361
|
+
metadata: OnnxMetadataProperty[],
|
|
1400
1362
|
): void
|
|
1401
1363
|
```
|
|
1402
1364
|
|
|
1403
|
-
|
|
1365
|
+
Reconstruct emitted fused LSTM/GRU layers from ONNX metadata and initializers.
|
|
1404
1366
|
|
|
1405
1367
|
Parameters:
|
|
1406
|
-
- `
|
|
1368
|
+
- `network` - Target network.
|
|
1369
|
+
- `onnx` - Source ONNX model.
|
|
1370
|
+
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
1371
|
+
- `layerFactory` - Dynamic layer module.
|
|
1372
|
+
- `metadata` - ONNX metadata properties.
|
|
1407
1373
|
|
|
1408
1374
|
Returns: Nothing.
|
|
1409
1375
|
|
|
1410
|
-
###
|
|
1376
|
+
### resolveRecurrentLayerIndices
|
|
1411
1377
|
|
|
1412
1378
|
```ts
|
|
1413
|
-
|
|
1379
|
+
resolveRecurrentLayerIndices(
|
|
1414
1380
|
metadata: OnnxMetadataProperty[],
|
|
1415
|
-
):
|
|
1381
|
+
): number[]
|
|
1416
1382
|
```
|
|
1417
1383
|
|
|
1418
|
-
|
|
1384
|
+
Resolve recurrent layer indices from ONNX metadata.
|
|
1419
1385
|
|
|
1420
1386
|
Parameters:
|
|
1421
|
-
- `metadata` - ONNX metadata
|
|
1387
|
+
- `metadata` - ONNX metadata payload.
|
|
1422
1388
|
|
|
1423
|
-
Returns: Parsed
|
|
1389
|
+
Returns: Parsed recurrent layer indices.
|
|
1424
1390
|
|
|
1425
|
-
###
|
|
1391
|
+
### restoreRecurrentSelfConnections
|
|
1426
1392
|
|
|
1427
1393
|
```ts
|
|
1428
|
-
|
|
1394
|
+
restoreRecurrentSelfConnections(
|
|
1429
1395
|
network: default,
|
|
1430
|
-
|
|
1396
|
+
onnx: OnnxModel,
|
|
1397
|
+
hiddenLayerSizes: number[],
|
|
1398
|
+
metadata: OnnxMetadataProperty[],
|
|
1431
1399
|
): void
|
|
1432
1400
|
```
|
|
1433
1401
|
|
|
1434
|
-
|
|
1402
|
+
Restore recurrent self-connections from recurrent metadata and R tensors.
|
|
1435
1403
|
|
|
1436
1404
|
Parameters:
|
|
1437
1405
|
- `network` - Target network.
|
|
1438
|
-
- `
|
|
1406
|
+
- `onnx` - Source ONNX model.
|
|
1407
|
+
- `hiddenLayerSizes` - Hidden layer sizes.
|
|
1408
|
+
- `metadata` - Parsed metadata properties.
|
|
1409
|
+
|
|
1410
|
+
Returns: Nothing.
|
|
1411
|
+
|
|
1412
|
+
### sliceLayerHiddenNodes
|
|
1413
|
+
|
|
1414
|
+
```ts
|
|
1415
|
+
sliceLayerHiddenNodes(
|
|
1416
|
+
layerConnectionContext: OnnxImportLayerConnectionContext,
|
|
1417
|
+
): default[]
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
Slice hidden nodes for one hidden-layer span.
|
|
1421
|
+
|
|
1422
|
+
Parameters:
|
|
1423
|
+
- `layerConnectionContext` - Layer connection context.
|
|
1424
|
+
|
|
1425
|
+
Returns: Hidden nodes belonging to the span.
|
|
1426
|
+
|
|
1427
|
+
### upsertSelfConnection
|
|
1428
|
+
|
|
1429
|
+
```ts
|
|
1430
|
+
upsertSelfConnection(
|
|
1431
|
+
selfConnectionContext: OnnxImportSelfConnectionUpsertContext,
|
|
1432
|
+
): void
|
|
1433
|
+
```
|
|
1434
|
+
|
|
1435
|
+
Upsert one node self-connection for recurrent import restoration.
|
|
1436
|
+
|
|
1437
|
+
Parameters:
|
|
1438
|
+
- `selfConnectionContext` - Self-connection upsert context.
|
|
1439
1439
|
|
|
1440
1440
|
Returns: Nothing.
|
|
1441
1441
|
|
|
1442
1442
|
## architecture/network/onnx/import/network.onnx.import-fused-recurrent.types.ts
|
|
1443
1443
|
|
|
1444
|
-
###
|
|
1444
|
+
### OnnxFusedGateApplicationContext
|
|
1445
1445
|
|
|
1446
|
-
|
|
1446
|
+
Gate-weight application context for one reconstructed fused layer.
|
|
1447
|
+
|
|
1448
|
+
### OnnxFusedGateRowAssignmentContext
|
|
1449
|
+
|
|
1450
|
+
Context for assigning one gate-neuron row from flattened ONNX tensors.
|
|
1451
|
+
|
|
1452
|
+
### OnnxFusedLayerNeighborhood
|
|
1453
|
+
|
|
1454
|
+
Hidden-layer neighborhood slices around a reconstructed fused layer.
|
|
1455
|
+
|
|
1456
|
+
### OnnxFusedLayerReconstructionContext
|
|
1457
|
+
|
|
1458
|
+
Execution context for one fused recurrent layer reconstruction.
|
|
1447
1459
|
|
|
1448
1460
|
### OnnxFusedLayerRuntime
|
|
1449
1461
|
|
|
@@ -1453,6 +1465,10 @@ The importer only relies on a narrow runtime contract: access to the
|
|
|
1453
1465
|
reconstructed nodes, an input wiring hook, and an optional output group that
|
|
1454
1466
|
can be reconnected to the next restored layer.
|
|
1455
1467
|
|
|
1468
|
+
### OnnxFusedRecurrentKind
|
|
1469
|
+
|
|
1470
|
+
Supported fused recurrent operator families recognized during ONNX import.
|
|
1471
|
+
|
|
1456
1472
|
### OnnxFusedRecurrentSpec
|
|
1457
1473
|
|
|
1458
1474
|
Fused recurrent family specification used during import reconstruction.
|
|
@@ -1461,10 +1477,6 @@ This tells the importer how to interpret one emitted ONNX recurrent family:
|
|
|
1461
1477
|
how many gates to expect, what order those gates were serialized in, and
|
|
1462
1478
|
which gate owns the self-recurrent diagonal replay.
|
|
1463
1479
|
|
|
1464
|
-
### OnnxFusedLayerNeighborhood
|
|
1465
|
-
|
|
1466
|
-
Hidden-layer neighborhood slices around a reconstructed fused layer.
|
|
1467
|
-
|
|
1468
1480
|
### OnnxFusedTensorPayload
|
|
1469
1481
|
|
|
1470
1482
|
Fused recurrent tensor payload read from ONNX initializers.
|
|
@@ -1473,18 +1485,6 @@ The importer resolves the three recurrent tensor families up front so the
|
|
|
1473
1485
|
reconstruction pass can focus on wiring and row assignment instead of
|
|
1474
1486
|
repeatedly re-looking up initializers.
|
|
1475
1487
|
|
|
1476
|
-
### OnnxFusedLayerReconstructionContext
|
|
1477
|
-
|
|
1478
|
-
Execution context for one fused recurrent layer reconstruction.
|
|
1479
|
-
|
|
1480
|
-
### OnnxFusedGateApplicationContext
|
|
1481
|
-
|
|
1482
|
-
Gate-weight application context for one reconstructed fused layer.
|
|
1483
|
-
|
|
1484
|
-
### OnnxFusedGateRowAssignmentContext
|
|
1485
|
-
|
|
1486
|
-
Context for assigning one gate-neuron row from flattened ONNX tensors.
|
|
1487
|
-
|
|
1488
1488
|
### OnnxIncomingWeightAssignmentContext
|
|
1489
1489
|
|
|
1490
1490
|
Context for assigning dense incoming weights for one gate-neuron row.
|