@reicek/neataptic-ts 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
  3. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  4. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  5. package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
  6. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  7. package/package.json +19 -13
  8. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  9. package/plans/README.md +24 -0
  10. package/plans/Roadmap.md +62 -40
  11. package/plans/analyze-trace-solid-split.plans.md +66 -0
  12. package/plans/architecture-solid-split.plans.md +9 -15
  13. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  14. package/plans/generate-docs-solid-split.plans.md +87 -0
  15. package/plans/methods-docs.plans.md +25 -1
  16. package/plans/methods-solid-split.plans.md +14 -14
  17. package/plans/neat-docs.plans.md +9 -1
  18. package/plans/neat-test-surface-repair.plans.md +1 -1
  19. package/plans/render-docs-html-solid-split.plans.md +68 -0
  20. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  21. package/plans/utils-docs.plans.md +6 -1
  22. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  23. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  24. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  25. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  26. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  27. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  28. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  29. package/scripts/assets/theme.css +80 -23
  30. package/scripts/copy-examples.ts +239 -0
  31. package/scripts/export-onnx.ts +223 -0
  32. package/scripts/generate-bench-tables.ts +378 -37
  33. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  34. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  35. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  36. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  37. package/scripts/generate-docs/generate-docs.ts +63 -0
  38. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  39. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  40. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  41. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  42. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  43. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  44. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  45. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  46. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  47. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  48. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  50. package/scripts/mermaid-cli.mjs +102 -22
  51. package/scripts/mermaid-cli.ts +736 -0
  52. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  53. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  54. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  55. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  56. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  57. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  58. package/scripts/render-docs-html.ts +23 -587
  59. package/scripts/run-docs.ts +238 -0
  60. package/scripts/write-dist-docs-pkg.ts +40 -0
  61. package/src/README.md +75 -75
  62. package/src/architecture/connection/README.md +5 -5
  63. package/src/architecture/layer/README.md +508 -508
  64. package/src/architecture/network/README.md +1458 -1458
  65. package/src/architecture/network/activate/README.md +694 -694
  66. package/src/architecture/network/bootstrap/README.md +77 -77
  67. package/src/architecture/network/connect/README.md +74 -74
  68. package/src/architecture/network/deterministic/README.md +135 -135
  69. package/src/architecture/network/evolve/README.md +364 -364
  70. package/src/architecture/network/gating/README.md +130 -130
  71. package/src/architecture/network/genetic/README.md +399 -399
  72. package/src/architecture/network/mutate/README.md +897 -897
  73. package/src/architecture/network/onnx/README.md +720 -720
  74. package/src/architecture/network/onnx/export/README.md +728 -728
  75. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  76. package/src/architecture/network/onnx/import/README.md +618 -618
  77. package/src/architecture/network/onnx/schema/README.md +32 -32
  78. package/src/architecture/network/prune/README.md +245 -245
  79. package/src/architecture/network/remove/README.md +135 -135
  80. package/src/architecture/network/runtime/README.md +106 -106
  81. package/src/architecture/network/serialize/README.md +542 -542
  82. package/src/architecture/network/slab/README.md +608 -608
  83. package/src/architecture/network/standalone/README.md +212 -212
  84. package/src/architecture/network/stats/README.md +84 -84
  85. package/src/architecture/network/topology/README.md +465 -465
  86. package/src/architecture/network/training/README.md +200 -200
  87. package/src/architecture/node/README.md +5 -5
  88. package/src/architecture/nodePool/README.md +14 -14
  89. package/src/methods/README.md +99 -99
  90. package/src/methods/activation/README.md +189 -189
  91. package/src/methods/cost/README.md +131 -131
  92. package/src/methods/rate/README.md +86 -86
  93. package/src/multithreading/README.md +77 -77
  94. package/src/multithreading/workers/browser/README.md +8 -8
  95. package/src/multithreading/workers/node/README.md +8 -8
  96. package/src/neat/README.md +148 -148
  97. package/src/neat/adaptive/README.md +120 -120
  98. package/src/neat/adaptive/acceptance/README.md +40 -40
  99. package/src/neat/adaptive/complexity/README.md +137 -137
  100. package/src/neat/adaptive/core/README.md +197 -197
  101. package/src/neat/adaptive/lineage/README.md +90 -90
  102. package/src/neat/adaptive/mutation/README.md +284 -284
  103. package/src/neat/compat/README.md +43 -43
  104. package/src/neat/compat/core/README.md +90 -90
  105. package/src/neat/diversity/README.md +35 -35
  106. package/src/neat/diversity/core/README.md +88 -88
  107. package/src/neat/evaluate/README.md +85 -85
  108. package/src/neat/evaluate/auto-distance/README.md +75 -75
  109. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  110. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  111. package/src/neat/evaluate/fitness/README.md +23 -23
  112. package/src/neat/evaluate/novelty/README.md +120 -120
  113. package/src/neat/evaluate/objectives/README.md +17 -17
  114. package/src/neat/evaluate/shared/README.md +94 -94
  115. package/src/neat/evolve/README.md +96 -96
  116. package/src/neat/evolve/adaptive/README.md +60 -60
  117. package/src/neat/evolve/objectives/README.md +63 -63
  118. package/src/neat/evolve/offspring/README.md +56 -56
  119. package/src/neat/evolve/population/README.md +171 -171
  120. package/src/neat/evolve/runtime/README.md +79 -79
  121. package/src/neat/evolve/speciation/README.md +74 -74
  122. package/src/neat/evolve/warnings/README.md +10 -10
  123. package/src/neat/export/README.md +114 -114
  124. package/src/neat/helpers/README.md +50 -50
  125. package/src/neat/init/README.md +9 -9
  126. package/src/neat/lineage/core/README.md +101 -101
  127. package/src/neat/multiobjective/category/README.md +74 -74
  128. package/src/neat/multiobjective/crowding/README.md +272 -272
  129. package/src/neat/multiobjective/dominance/README.md +171 -171
  130. package/src/neat/multiobjective/fronts/README.md +68 -68
  131. package/src/neat/multiobjective/metrics/README.md +43 -43
  132. package/src/neat/multiobjective/objectives/README.md +31 -31
  133. package/src/neat/multiobjective/shared/README.md +27 -27
  134. package/src/neat/mutation/README.md +97 -97
  135. package/src/neat/mutation/add-conn/README.md +115 -115
  136. package/src/neat/mutation/add-node/README.md +126 -126
  137. package/src/neat/mutation/flow/README.md +149 -149
  138. package/src/neat/mutation/repair/README.md +185 -185
  139. package/src/neat/mutation/select/README.md +117 -117
  140. package/src/neat/mutation/shared/README.md +32 -32
  141. package/src/neat/objectives/README.md +25 -25
  142. package/src/neat/objectives/core/README.md +67 -67
  143. package/src/neat/pruning/README.md +40 -40
  144. package/src/neat/pruning/core/README.md +171 -171
  145. package/src/neat/pruning/facade/README.md +32 -32
  146. package/src/neat/rng/README.md +104 -104
  147. package/src/neat/rng/core/README.md +137 -137
  148. package/src/neat/rng/facade/README.md +50 -50
  149. package/src/neat/selection/README.md +111 -111
  150. package/src/neat/selection/core/README.md +227 -227
  151. package/src/neat/selection/facade/README.md +61 -61
  152. package/src/neat/shared/README.md +163 -163
  153. package/src/neat/speciation/README.md +31 -31
  154. package/src/neat/speciation/threshold/README.md +35 -35
  155. package/src/neat/species/README.md +25 -25
  156. package/src/neat/species/core/README.md +20 -20
  157. package/src/neat/species/core/shared/README.md +18 -18
  158. package/src/neat/species/history/context/README.md +22 -22
  159. package/src/neat/telemetry/accessors/README.md +58 -58
  160. package/src/neat/telemetry/exports/README.md +233 -233
  161. package/src/neat/telemetry/facade/README.md +252 -252
  162. package/src/neat/telemetry/facade/archive/README.md +57 -57
  163. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  164. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  165. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  166. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  167. package/src/neat/telemetry/facade/species/README.md +27 -27
  168. package/src/neat/telemetry/metrics/README.md +696 -696
  169. package/src/neat/telemetry/recorder/README.md +57 -57
  170. package/src/neat/telemetry/types/README.md +32 -32
  171. package/src/neat/topology-intent/README.md +75 -75
  172. package/src/utils/README.md +193 -193
  173. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  174. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  175. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  176. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  177. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  178. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  179. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  180. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  181. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  182. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  183. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  184. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  185. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  186. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  187. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  189. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  190. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  191. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  192. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  193. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  194. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  195. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  196. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  197. package/test/examples/flappy_bird/environment/README.md +22 -22
  198. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  199. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  200. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  201. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  202. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  203. package/test/examples/flappy_bird/trainer/README.md +325 -325
  204. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  205. package/scripts/analyze-trace.ts +0 -590
  206. package/scripts/copy-examples.mjs +0 -114
  207. package/scripts/export-onnx.mjs +0 -86
  208. package/scripts/generate-bench-tables.mjs +0 -182
  209. package/scripts/generate-docs.ts +0 -2900
  210. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -64,89 +64,77 @@ const outputName = tryEmitConvLayer({
64
64
 
65
65
  ## architecture/network/onnx/export/layers/network.onnx.export-dense.utils.ts
66
66
 
67
- ### emitDenseLayer
67
+ ### appendDenseBiasInitializer
68
68
 
69
69
  ```ts
70
- emitDenseLayer(
71
- params: DenseLayerParams,
72
- ): string
70
+ appendDenseBiasInitializer(
71
+ layerContext: DenseLayerContext,
72
+ biasTensorName: string,
73
+ biasVector: number[],
74
+ ): void
73
75
  ```
74
76
 
75
- Emit the compact dense export path for a layer whose neurons all share the
76
- same activation.
77
-
78
- This is the cheapest ONNX shape the exporter can produce for a standard MLP
79
- layer: one Gemm node for the affine transform and one activation node for the
80
- whole layer. The same helper also preserves the library's legacy node-ordering
81
- compatibility mode when older snapshots need deterministic graph ordering.
77
+ Append dense bias initializer.
82
78
 
83
79
  Parameters:
84
- - `params` - Dense emission parameters.
85
-
86
- Returns: Output tensor name.
87
-
88
- Example:
80
+ - `layerContext` - Dense layer context.
81
+ - `biasTensorName` - Bias tensor name.
82
+ - `biasVector` - Bias vector values.
89
83
 
90
- ```ts
91
- const outputName = emitDenseLayer({
92
- model,
93
- layerIndex: 2,
94
- previousOutputName: 'Layer_1',
95
- previousLayerNodes,
96
- currentLayerNodes,
97
- options: {},
98
- legacyNodeOrdering: false,
99
- });
100
- ```
84
+ Returns: Nothing.
101
85
 
102
- ### emitPerNeuronLayer
86
+ ### appendDenseNodes
103
87
 
104
88
  ```ts
105
- emitPerNeuronLayer(
106
- params: PerNeuronLayerParams,
107
- ): string
89
+ appendDenseNodes(
90
+ model: OnnxModel,
91
+ orderedNodes: DenseOrderedNodePayload[],
92
+ ): void
108
93
  ```
109
94
 
110
- Emit the fallback dense-family representation for a layer whose target
111
- neurons use different activations.
112
-
113
- Instead of pretending the layer is homogeneous, this path exports one tiny
114
- Gemm-plus-activation subgraph per neuron and then concatenates the results.
115
- The graph is larger, but it preserves mixed activation behavior that a single
116
- layer-wide activation node cannot express.
95
+ Append ordered dense nodes to the model graph.
117
96
 
118
97
  Parameters:
119
- - `params` - Per-neuron emission parameters.
98
+ - `model` - Target model.
99
+ - `orderedNodes` - Ordered dense nodes.
120
100
 
121
- Returns: Output tensor name.
101
+ Returns: Nothing.
122
102
 
123
- Example:
103
+ ### appendDenseWeightInitializer
124
104
 
125
105
  ```ts
126
- const outputName = emitPerNeuronLayer({
127
- model,
128
- layerIndex: 2,
129
- previousOutputName: 'Layer_1',
130
- previousLayerNodes,
131
- currentLayerNodes,
132
- options: { allowMixedActivations: true },
133
- });
106
+ appendDenseWeightInitializer(
107
+ layerContext: DenseLayerContext,
108
+ weightTensorName: string,
109
+ weightMatrixValues: number[],
110
+ ): void
134
111
  ```
135
112
 
136
- ### emitDenseInitializers
113
+ Append dense weight initializer.
114
+
115
+ Parameters:
116
+ - `layerContext` - Dense layer context.
117
+ - `weightTensorName` - Weight tensor name.
118
+ - `weightMatrixValues` - Weight values.
119
+
120
+ Returns: Nothing.
121
+
122
+ ### buildSingleNeuronWeightRow
137
123
 
138
124
  ```ts
139
- emitDenseInitializers(
140
- layerContext: DenseLayerContext,
141
- ): DenseTensorNames
125
+ buildSingleNeuronWeightRow(
126
+ targetNodeInternal: NodeInternals,
127
+ previousLayerNodes: default[],
128
+ ): number[]
142
129
  ```
143
130
 
144
- Emit dense initializers and return tensor names.
131
+ Build one neuron's incoming weight row against previous layer.
145
132
 
146
133
  Parameters:
147
- - `layerContext` - Dense layer context.
134
+ - `targetNodeInternal` - Target node internals.
135
+ - `previousLayerNodes` - Previous layer nodes.
148
136
 
149
- Returns: Tensor names.
137
+ Returns: Weight row values.
150
138
 
151
139
  ### collectDenseInitializerValues
152
140
 
@@ -163,6 +151,31 @@ Parameters:
163
151
 
164
152
  Returns: Dense initializer values.
165
153
 
154
+ ### createActivationNode
155
+
156
+ ```ts
157
+ createActivationNode(
158
+ denseActivationContext: DenseActivationContext,
159
+ ): DenseActivationNodePayload
160
+ ```
161
+
162
+ Create dense activation node definition.
163
+
164
+ Parameters:
165
+ - `denseActivationContext` - Dense activation context.
166
+
167
+ Returns: ONNX activation node payload.
168
+
169
+ ### createDefaultGemmAttributes
170
+
171
+ ```ts
172
+ createDefaultGemmAttributes(): { name: string; type: string; f?: number | undefined; i?: number | undefined; }[]
173
+ ```
174
+
175
+ Build default Gemm attributes for ONNX export.
176
+
177
+ Returns: Default Gemm attribute list.
178
+
166
179
  ### createDenseTensorNames
167
180
 
168
181
  ```ts
@@ -178,43 +191,50 @@ Parameters:
178
191
 
179
192
  Returns: Dense tensor names.
180
193
 
181
- ### appendDenseWeightInitializer
194
+ ### createGemmNode
182
195
 
183
196
  ```ts
184
- appendDenseWeightInitializer(
185
- layerContext: DenseLayerContext,
186
- weightTensorName: string,
187
- weightMatrixValues: number[],
188
- ): void
197
+ createGemmNode(
198
+ denseActivationContext: DenseActivationContext,
199
+ ): DenseGemmNodePayload
189
200
  ```
190
201
 
191
- Append dense weight initializer.
202
+ Create dense Gemm node definition.
192
203
 
193
204
  Parameters:
194
- - `layerContext` - Dense layer context.
195
- - `weightTensorName` - Weight tensor name.
196
- - `weightMatrixValues` - Weight values.
205
+ - `denseActivationContext` - Dense activation context.
197
206
 
198
- Returns: Nothing.
207
+ Returns: ONNX Gemm node payload.
199
208
 
200
- ### appendDenseBiasInitializer
209
+ ### createSharedActivationNodePayload
201
210
 
202
211
  ```ts
203
- appendDenseBiasInitializer(
204
- layerContext: DenseLayerContext,
205
- biasTensorName: string,
206
- biasVector: number[],
207
- ): void
212
+ createSharedActivationNodePayload(
213
+ params: SharedActivationNodeBuildParams,
214
+ ): DenseActivationNodePayload
208
215
  ```
209
216
 
210
- Append dense bias initializer.
217
+ Build a shared activation node payload.
211
218
 
212
219
  Parameters:
213
- - `layerContext` - Dense layer context.
214
- - `biasTensorName` - Bias tensor name.
215
- - `biasVector` - Bias vector values.
220
+ - `params` - Shared activation build parameters.
216
221
 
217
- Returns: Nothing.
222
+ Returns: Activation node payload.
223
+
224
+ ### createSharedGemmNodePayload
225
+
226
+ ```ts
227
+ createSharedGemmNodePayload(
228
+ params: SharedGemmNodeBuildParams,
229
+ ): DenseGemmNodePayload
230
+ ```
231
+
232
+ Build a shared Gemm node payload.
233
+
234
+ Parameters:
235
+ - `params` - Shared Gemm build parameters.
236
+
237
+ Returns: Gemm node payload.
218
238
 
219
239
  ### emitDenseActivationSubgraph
220
240
 
@@ -233,71 +253,104 @@ Parameters:
233
253
 
234
254
  Returns: Nothing.
235
255
 
236
- ### resolveDenseNodeOrder
256
+ ### emitDenseInitializers
237
257
 
238
258
  ```ts
239
- resolveDenseNodeOrder(
240
- gemmNode: DenseGemmNodePayload,
241
- activationNode: DenseActivationNodePayload,
242
- legacyNodeOrdering: boolean,
243
- ): DenseOrderedNodePayload[]
259
+ emitDenseInitializers(
260
+ layerContext: DenseLayerContext,
261
+ ): DenseTensorNames
244
262
  ```
245
263
 
246
- Resolve dense node order for legacy and current exports.
264
+ Emit dense initializers and return tensor names.
247
265
 
248
266
  Parameters:
249
- - `gemmNode` - Gemm node.
250
- - `activationNode` - Activation node.
251
- - `legacyNodeOrdering` - Whether legacy ordering is required.
267
+ - `layerContext` - Dense layer context.
252
268
 
253
- Returns: Ordered node list.
269
+ Returns: Tensor names.
254
270
 
255
- ### appendDenseNodes
271
+ ### emitDenseLayer
256
272
 
257
273
  ```ts
258
- appendDenseNodes(
259
- model: OnnxModel,
260
- orderedNodes: DenseOrderedNodePayload[],
261
- ): void
274
+ emitDenseLayer(
275
+ params: DenseLayerParams,
276
+ ): string
262
277
  ```
263
278
 
264
- Append ordered dense nodes to the model graph.
279
+ Emit the compact dense export path for a layer whose neurons all share the
280
+ same activation.
281
+
282
+ This is the cheapest ONNX shape the exporter can produce for a standard MLP
283
+ layer: one Gemm node for the affine transform and one activation node for the
284
+ whole layer. The same helper also preserves the library's legacy node-ordering
285
+ compatibility mode when older snapshots need deterministic graph ordering.
265
286
 
266
287
  Parameters:
267
- - `model` - Target model.
268
- - `orderedNodes` - Ordered dense nodes.
288
+ - `params` - Dense emission parameters.
269
289
 
270
- Returns: Nothing.
290
+ Returns: Output tensor name.
271
291
 
272
- ### createGemmNode
292
+ Example:
273
293
 
274
294
  ```ts
275
- createGemmNode(
276
- denseActivationContext: DenseActivationContext,
277
- ): DenseGemmNodePayload
295
+ const outputName = emitDenseLayer({
296
+ model,
297
+ layerIndex: 2,
298
+ previousOutputName: 'Layer_1',
299
+ previousLayerNodes,
300
+ currentLayerNodes,
301
+ options: {},
302
+ legacyNodeOrdering: false,
303
+ });
278
304
  ```
279
305
 
280
- Create dense Gemm node definition.
306
+ ### emitOptionalLayerOutput
307
+
308
+ ```ts
309
+ emitOptionalLayerOutput(
310
+ params: OptionalLayerOutputParams,
311
+ ): string
312
+ ```
313
+
314
+ Emit optional pooling and flatten output fold.
281
315
 
282
316
  Parameters:
283
- - `denseActivationContext` - Dense activation context.
317
+ - `params` - Optional output parameters.
284
318
 
285
- Returns: ONNX Gemm node payload.
319
+ Returns: Output tensor name.
286
320
 
287
- ### createActivationNode
321
+ ### emitPerNeuronLayer
288
322
 
289
323
  ```ts
290
- createActivationNode(
291
- denseActivationContext: DenseActivationContext,
292
- ): DenseActivationNodePayload
324
+ emitPerNeuronLayer(
325
+ params: PerNeuronLayerParams,
326
+ ): string
293
327
  ```
294
328
 
295
- Create dense activation node definition.
329
+ Emit the fallback dense-family representation for a layer whose target
330
+ neurons use different activations.
331
+
332
+ Instead of pretending the layer is homogeneous, this path exports one tiny
333
+ Gemm-plus-activation subgraph per neuron and then concatenates the results.
334
+ The graph is larger, but it preserves mixed activation behavior that a single
335
+ layer-wide activation node cannot express.
296
336
 
297
337
  Parameters:
298
- - `denseActivationContext` - Dense activation context.
338
+ - `params` - Per-neuron emission parameters.
299
339
 
300
- Returns: ONNX activation node payload.
340
+ Returns: Output tensor name.
341
+
342
+ Example:
343
+
344
+ ```ts
345
+ const outputName = emitPerNeuronLayer({
346
+ model,
347
+ layerIndex: 2,
348
+ previousOutputName: 'Layer_1',
349
+ previousLayerNodes,
350
+ currentLayerNodes,
351
+ options: { allowMixedActivations: true },
352
+ });
353
+ ```
301
354
 
302
355
  ### emitPerNeuronSubgraph
303
356
 
@@ -314,22 +367,24 @@ Parameters:
314
367
 
315
368
  Returns: Per-neuron activation output name.
316
369
 
317
- ### buildSingleNeuronWeightRow
370
+ ### resolveDenseNodeOrder
318
371
 
319
372
  ```ts
320
- buildSingleNeuronWeightRow(
321
- targetNodeInternal: NodeInternals,
322
- previousLayerNodes: default[],
323
- ): number[]
373
+ resolveDenseNodeOrder(
374
+ gemmNode: DenseGemmNodePayload,
375
+ activationNode: DenseActivationNodePayload,
376
+ legacyNodeOrdering: boolean,
377
+ ): DenseOrderedNodePayload[]
324
378
  ```
325
379
 
326
- Build one neuron's incoming weight row against previous layer.
380
+ Resolve dense node order for legacy and current exports.
327
381
 
328
382
  Parameters:
329
- - `targetNodeInternal` - Target node internals.
330
- - `previousLayerNodes` - Previous layer nodes.
383
+ - `gemmNode` - Gemm node.
384
+ - `activationNode` - Activation node.
385
+ - `legacyNodeOrdering` - Whether legacy ordering is required.
331
386
 
332
- Returns: Weight row values.
387
+ Returns: Ordered node list.
333
388
 
334
389
  ### resolveSingleNeuronInboundWeight
335
390
 
@@ -348,130 +403,55 @@ Parameters:
348
403
 
349
404
  Returns: Inbound weight or zero when missing.
350
405
 
351
- ### createSharedGemmNodePayload
352
-
353
- ```ts
354
- createSharedGemmNodePayload(
355
- params: SharedGemmNodeBuildParams,
356
- ): DenseGemmNodePayload
357
- ```
358
-
359
- Build a shared Gemm node payload.
360
-
361
- Parameters:
362
- - `params` - Shared Gemm build parameters.
363
-
364
- Returns: Gemm node payload.
365
-
366
- ### createSharedActivationNodePayload
367
-
368
- ```ts
369
- createSharedActivationNodePayload(
370
- params: SharedActivationNodeBuildParams,
371
- ): DenseActivationNodePayload
372
- ```
373
-
374
- Build a shared activation node payload.
375
-
376
- Parameters:
377
- - `params` - Shared activation build parameters.
378
-
379
- Returns: Activation node payload.
380
-
381
- ### createDefaultGemmAttributes
382
-
383
- ```ts
384
- createDefaultGemmAttributes(): { name: string; type: string; f?: number | undefined; i?: number | undefined; }[]
385
- ```
386
-
387
- Build default Gemm attributes for ONNX export.
388
-
389
- Returns: Default Gemm attribute list.
390
-
391
- ### emitOptionalLayerOutput
392
-
393
- ```ts
394
- emitOptionalLayerOutput(
395
- params: OptionalLayerOutputParams,
396
- ): string
397
- ```
398
-
399
- Emit optional pooling and flatten output fold.
400
-
401
- Parameters:
402
- - `params` - Optional output parameters.
403
-
404
- Returns: Output tensor name.
405
-
406
406
  ## architecture/network/onnx/export/layers/network.onnx.export-recurrent.utils.ts
407
407
 
408
- ### emitRecurrentLayer
408
+ ### buildDefaultGemmAttributes
409
409
 
410
410
  ```ts
411
- emitRecurrentLayer(
412
- params: RecurrentLayerEmissionParams,
413
- ): string
411
+ buildDefaultGemmAttributes(): { name: string; type: string; f?: number | undefined; i?: number | undefined; }[]
414
412
  ```
415
413
 
416
- Emit the constrained recurrent single-step export path for one hidden layer.
417
-
418
- This boundary models recurrence with two parallel Gemm branches:
419
- one for the feed-forward input and one for the previous hidden state. The
420
- recurrent branch uses a diagonal matrix derived from self-connections only,
421
- which keeps the exported shape simple and matches the importer's current
422
- reconstruction contract.
423
-
424
- Hidden-state inputs are named `hidden_prev` for the first recurrent layer and
425
- `hidden_prev_l{n}` for later recurrent layers. Mixed activations are not
426
- supported on this path because the single activation node is applied after
427
- the input and recurrent branches are summed.
428
-
429
- Parameters:
430
- - `params` - Recurrent emission parameters.
431
-
432
- Returns: Output tensor name.
433
-
434
- Example:
414
+ Build the shared attribute list for ONNX Gemm node payloads.
435
415
 
436
- ```ts
437
- const outputName = emitRecurrentLayer({
438
- model,
439
- layerIndex: 1,
440
- previousOutputName: 'input',
441
- previousLayerNodes,
442
- currentLayerNodes,
443
- });
444
- ```
416
+ Returns: Gemm attribute payload list.
445
417
 
446
- ### buildRecurrentLayerEmissionContext
418
+ ### buildInputBranchGemmEmissionContext
447
419
 
448
420
  ```ts
449
- buildRecurrentLayerEmissionContext(
450
- params: RecurrentLayerEmissionParams,
451
- ): RecurrentLayerEmissionContext
421
+ buildInputBranchGemmEmissionContext(
422
+ context: RecurrentLayerEmissionContext,
423
+ initializerNames: RecurrentInitializerNames,
424
+ graphNames: RecurrentGraphNames,
425
+ ): RecurrentGemmEmissionContext
452
426
  ```
453
427
 
454
- Build derived recurrent-layer context from input params.
428
+ Build Gemm emission context for the feed-forward branch.
455
429
 
456
430
  Parameters:
457
- - `params` - User-provided recurrent layer params.
431
+ - `context` - Recurrent layer execution context.
432
+ - `initializerNames` - Recurrent initializer names.
433
+ - `graphNames` - Recurrent graph names.
458
434
 
459
- Returns: Derived context with cached dimensions and layer slot.
435
+ Returns: Gemm emission context.
460
436
 
461
- ### buildRecurrentInitializerNames
437
+ ### buildRecurrentBranchGemmEmissionContext
462
438
 
463
439
  ```ts
464
- buildRecurrentInitializerNames(
440
+ buildRecurrentBranchGemmEmissionContext(
465
441
  context: RecurrentLayerEmissionContext,
466
- ): RecurrentInitializerNames
442
+ initializerNames: RecurrentInitializerNames,
443
+ graphNames: RecurrentGraphNames,
444
+ ): RecurrentGemmEmissionContext
467
445
  ```
468
446
 
469
- Build deterministic tensor names for recurrent initializer emission.
447
+ Build Gemm emission context for the recurrent hidden-state branch.
470
448
 
471
449
  Parameters:
472
450
  - `context` - Recurrent layer execution context.
451
+ - `initializerNames` - Recurrent initializer names.
452
+ - `graphNames` - Recurrent graph names.
473
453
 
474
- Returns: Tensor-name group for initializer emission.
454
+ Returns: Gemm emission context.
475
455
 
476
456
  ### buildRecurrentGraphNames
477
457
 
@@ -488,88 +468,82 @@ Parameters:
488
468
 
489
469
  Returns: Graph-name group for branch and activation nodes.
490
470
 
491
- ### collectRecurrentInitializerValues
471
+ ### buildRecurrentInitializerNames
492
472
 
493
473
  ```ts
494
- collectRecurrentInitializerValues(
474
+ buildRecurrentInitializerNames(
495
475
  context: RecurrentLayerEmissionContext,
496
- ): RecurrentInitializerValues
476
+ ): RecurrentInitializerNames
497
477
  ```
498
478
 
499
- Collect recurrent initializer vectors for one layer.
479
+ Build deterministic tensor names for recurrent initializer emission.
500
480
 
501
481
  Parameters:
502
482
  - `context` - Recurrent layer execution context.
503
483
 
504
- Returns: Dense and recurrent initializer vectors.
484
+ Returns: Tensor-name group for initializer emission.
505
485
 
506
- ### emitRecurrentInitializers
486
+ ### buildRecurrentLayerEmissionContext
507
487
 
508
488
  ```ts
509
- emitRecurrentInitializers(
510
- context: RecurrentInitializerEmissionContext,
511
- ): void
489
+ buildRecurrentLayerEmissionContext(
490
+ params: RecurrentLayerEmissionParams,
491
+ ): RecurrentLayerEmissionContext
512
492
  ```
513
493
 
514
- Emit dense and recurrent initializer tensors.
494
+ Build derived recurrent-layer context from input params.
515
495
 
516
496
  Parameters:
517
- - `context` - Initializer emission context.
497
+ - `params` - User-provided recurrent layer params.
518
498
 
519
- Returns: Nothing.
499
+ Returns: Derived context with cached dimensions and layer slot.
520
500
 
521
- ### buildInputBranchGemmEmissionContext
501
+ ### collectRecurrentInitializerValues
522
502
 
523
503
  ```ts
524
- buildInputBranchGemmEmissionContext(
504
+ collectRecurrentInitializerValues(
525
505
  context: RecurrentLayerEmissionContext,
526
- initializerNames: RecurrentInitializerNames,
527
- graphNames: RecurrentGraphNames,
528
- ): RecurrentGemmEmissionContext
506
+ ): RecurrentInitializerValues
529
507
  ```
530
508
 
531
- Build Gemm emission context for the feed-forward branch.
509
+ Collect recurrent initializer vectors for one layer.
532
510
 
533
511
  Parameters:
534
512
  - `context` - Recurrent layer execution context.
535
- - `initializerNames` - Recurrent initializer names.
536
- - `graphNames` - Recurrent graph names.
537
513
 
538
- Returns: Gemm emission context.
514
+ Returns: Dense and recurrent initializer vectors.
539
515
 
540
- ### buildRecurrentBranchGemmEmissionContext
516
+ ### emitRecurrentActivationNode
541
517
 
542
518
  ```ts
543
- buildRecurrentBranchGemmEmissionContext(
544
- context: RecurrentLayerEmissionContext,
545
- initializerNames: RecurrentInitializerNames,
546
- graphNames: RecurrentGraphNames,
547
- ): RecurrentGemmEmissionContext
519
+ emitRecurrentActivationNode(
520
+ context: RecurrentActivationEmissionContext,
521
+ ): void
548
522
  ```
549
523
 
550
- Build Gemm emission context for the recurrent hidden-state branch.
524
+ Emit activation node for recurrent branch sum output.
551
525
 
552
526
  Parameters:
553
- - `context` - Recurrent layer execution context.
554
- - `initializerNames` - Recurrent initializer names.
555
- - `graphNames` - Recurrent graph names.
527
+ - `context` - Activation emission context.
556
528
 
557
- Returns: Gemm emission context.
529
+ Returns: Nothing.
558
530
 
559
- ### resolvePreviousHiddenInputName
531
+ ### emitRecurrentAddNode
560
532
 
561
533
  ```ts
562
- resolvePreviousHiddenInputName(
563
- layerIndex: number,
564
- ): string
534
+ emitRecurrentAddNode(
535
+ model: OnnxModel,
536
+ graphNames: RecurrentGraphNames,
537
+ ): void
565
538
  ```
566
539
 
567
- Resolve recurrent branch hidden-state input for one layer.
540
+ Emit Add node that fuses feed-forward and recurrent branch outputs.
568
541
 
569
542
  Parameters:
570
- - `layerIndex` - Current recurrent layer index.
543
+ - `model` - Target ONNX model.
544
+ - `graphNames` - Deterministic graph names for this layer.
571
545
 
572
- Returns: Hidden-state tensor input name.
546
+ Returns: Nothing.
573
547
 
574
548
  ### emitRecurrentGemmNode
575
549
 
@@ -586,53 +560,59 @@ Parameters:
586
560
 
587
561
  Returns: Nothing.
588
562
 
589
- ### emitRecurrentAddNode
563
+ ### emitRecurrentInitializers
590
564
 
591
565
  ```ts
592
- emitRecurrentAddNode(
593
- model: OnnxModel,
594
- graphNames: RecurrentGraphNames,
566
+ emitRecurrentInitializers(
567
+ context: RecurrentInitializerEmissionContext,
595
568
  ): void
596
569
  ```
597
570
 
598
- Emit Add node that fuses feed-forward and recurrent branch outputs.
571
+ Emit dense and recurrent initializer tensors.
599
572
 
600
573
  Parameters:
601
- - `model` - Target ONNX model.
602
- - `graphNames` - Deterministic graph names for this layer.
574
+ - `context` - Initializer emission context.
603
575
 
604
576
  Returns: Nothing.
605
577
 
606
- ### emitRecurrentActivationNode
578
+ ### emitRecurrentLayer
607
579
 
608
580
  ```ts
609
- emitRecurrentActivationNode(
610
- context: RecurrentActivationEmissionContext,
611
- ): void
581
+ emitRecurrentLayer(
582
+ params: RecurrentLayerEmissionParams,
583
+ ): string
612
584
  ```
613
585
 
614
- Emit activation node for recurrent branch sum output.
586
+ Emit the constrained recurrent single-step export path for one hidden layer.
587
+
588
+ This boundary models recurrence with two parallel Gemm branches:
589
+ one for the feed-forward input and one for the previous hidden state. The
590
+ recurrent branch uses a diagonal matrix derived from self-connections only,
591
+ which keeps the exported shape simple and matches the importer's current
592
+ reconstruction contract.
593
+
594
+ Hidden-state inputs are named `hidden_prev` for the first recurrent layer and
595
+ `hidden_prev_l{n}` for later recurrent layers. Mixed activations are not
596
+ supported on this path because the single activation node is applied after
597
+ the input and recurrent branches are summed.
615
598
 
616
599
  Parameters:
617
- - `context` - Activation emission context.
600
+ - `params` - Recurrent emission parameters.
618
601
 
619
- Returns: Nothing.
602
+ Returns: Output tensor name.
620
603
 
621
- ### resolveRecurrentActivationType
604
+ Example:
622
605
 
623
606
  ```ts
624
- resolveRecurrentActivationType(
625
- currentLayerNodes: default[],
626
- ): string
607
+ const outputName = emitRecurrentLayer({
608
+ model,
609
+ layerIndex: 1,
610
+ previousOutputName: 'input',
611
+ previousLayerNodes,
612
+ currentLayerNodes,
613
+ });
627
614
  ```
628
615
 
629
- Resolve ONNX activation type from first node in recurrent layer.
630
-
631
- Parameters:
632
- - `currentLayerNodes` - Current recurrent layer nodes.
633
-
634
- Returns: ONNX activation op type.
635
-
636
616
  ### readNodeInternals
637
617
 
638
618
  ```ts
@@ -648,15 +628,35 @@ Parameters:
648
628
 
649
629
  Returns: Node internals used by ONNX emission helpers.
650
630
 
651
- ### buildDefaultGemmAttributes
631
+ ### resolvePreviousHiddenInputName
652
632
 
653
633
  ```ts
654
- buildDefaultGemmAttributes(): { name: string; type: string; f?: number | undefined; i?: number | undefined; }[]
634
+ resolvePreviousHiddenInputName(
635
+ layerIndex: number,
636
+ ): string
655
637
  ```
656
638
 
657
- Build the shared attribute list for ONNX Gemm node payloads.
639
+ Resolve recurrent branch hidden-state input for one layer.
658
640
 
659
- Returns: Gemm attribute payload list.
641
+ Parameters:
642
+ - `layerIndex` - Current recurrent layer index.
643
+
644
+ Returns: Hidden-state tensor input name.
645
+
646
+ ### resolveRecurrentActivationType
647
+
648
+ ```ts
649
+ resolveRecurrentActivationType(
650
+ currentLayerNodes: default[],
651
+ ): string
652
+ ```
653
+
654
+ Resolve ONNX activation type from first node in recurrent layer.
655
+
656
+ Parameters:
657
+ - `currentLayerNodes` - Current recurrent layer nodes.
658
+
659
+ Returns: ONNX activation op type.
660
660
 
661
661
  ## architecture/network/onnx/export/layers/network.onnx.export-layer-graph.utils.ts
662
662
 
@@ -706,6 +706,74 @@ const outputName = emitLayerGraph({
706
706
 
707
707
  ## architecture/network/onnx/export/layers/network.onnx.export-layer-common.utils.ts
708
708
 
709
+ ### appendIndexedMetadata
710
+
711
+ ```ts
712
+ appendIndexedMetadata(
713
+ model: OnnxModel,
714
+ key: string,
715
+ layerIndex: number,
716
+ ): void
717
+ ```
718
+
719
+ Append an integer index to JSON-array metadata key.
720
+
721
+ Parameters:
722
+ - `model` - Target model.
723
+ - `key` - Metadata key.
724
+ - `layerIndex` - Layer index to append.
725
+
726
+ Returns: Nothing.
727
+
728
+ ### appendMetadataSpec
729
+
730
+ ```ts
731
+ appendMetadataSpec(
732
+ model: OnnxModel,
733
+ key: string,
734
+ spec: Conv2DMapping | Pool2DMapping,
735
+ ): void
736
+ ```
737
+
738
+ Append a JSON object to JSON-array metadata key.
739
+
740
+ Parameters:
741
+ - `model` - Target model.
742
+ - `key` - Metadata key.
743
+ - `spec` - Metadata object.
744
+
745
+ Returns: Nothing.
746
+
747
+ ### appendPoolingMetadata
748
+
749
+ ```ts
750
+ appendPoolingMetadata(
751
+ context: PoolingEmissionContext,
752
+ ): void
753
+ ```
754
+
755
+ Append pooling metadata for one emitted pooling layer.
756
+
757
+ Parameters:
758
+ - `context` - Pooling emission context.
759
+
760
+ Returns: Nothing.
761
+
762
+ ### asNodeInternals
763
+
764
+ ```ts
765
+ asNodeInternals(
766
+ node: default,
767
+ ): NodeInternals
768
+ ```
769
+
770
+ Normalize a public node instance into ONNX export internals.
771
+
772
+ Parameters:
773
+ - `node` - Source node.
774
+
775
+ Returns: Internal runtime-facing node representation.
776
+
709
777
  ### buildDenseWeightsAndBiases
710
778
 
711
779
  ```ts
@@ -753,58 +821,39 @@ Parameters:
753
821
 
754
822
  Returns: Flattened row-major recurrent matrix.
755
823
 
756
- ### emitOptionalPoolingAndFlatten
757
-
758
- ```ts
759
- emitOptionalPoolingAndFlatten(
760
- params: OptionalPoolingAndFlattenParams,
761
- ): string
762
- ```
763
-
764
- Emit optional pooling and flatten nodes after a layer output.
765
-
766
- Parameters:
767
- - `params` - Pooling parameters.
768
-
769
- Returns: Final output tensor name after optional pooling/flatten.
770
-
771
- ### appendIndexedMetadata
824
+ ### buildIndexedMetadataProperty
772
825
 
773
826
  ```ts
774
- appendIndexedMetadata(
775
- model: OnnxModel,
827
+ buildIndexedMetadataProperty(
776
828
  key: string,
777
829
  layerIndex: number,
778
- ): void
830
+ ): OnnxMetadataProperty
779
831
  ```
780
832
 
781
- Append an integer index to JSON-array metadata key.
833
+ Build a new index-array metadata property.
782
834
 
783
835
  Parameters:
784
- - `model` - Target model.
785
836
  - `key` - Metadata key.
786
- - `layerIndex` - Layer index to append.
837
+ - `layerIndex` - Layer index.
787
838
 
788
- Returns: Nothing.
839
+ Returns: Metadata property.
789
840
 
790
- ### appendMetadataSpec
841
+ ### buildSpecMetadataProperty
791
842
 
792
843
  ```ts
793
- appendMetadataSpec(
794
- model: OnnxModel,
844
+ buildSpecMetadataProperty(
795
845
  key: string,
796
846
  spec: Conv2DMapping | Pool2DMapping,
797
- ): void
847
+ ): OnnxMetadataProperty
798
848
  ```
799
849
 
800
- Append a JSON object to JSON-array metadata key.
850
+ Build a new spec-array metadata property.
801
851
 
802
852
  Parameters:
803
- - `model` - Target model.
804
853
  - `key` - Metadata key.
805
- - `spec` - Metadata object.
854
+ - `spec` - Mapping spec.
806
855
 
807
- Returns: Nothing.
856
+ Returns: Metadata property.
808
857
 
809
858
  ### collectDenseRows
810
859
 
@@ -821,21 +870,6 @@ Parameters:
821
870
 
822
871
  Returns: Dense rows containing per-target weights and bias.
823
872
 
824
- ### foldDenseRowsToInitializers
825
-
826
- ```ts
827
- foldDenseRowsToInitializers(
828
- denseRows: DenseWeightRow[],
829
- ): DenseWeightBuildResult
830
- ```
831
-
832
- Fold dense rows into flattened ONNX initializer arrays.
833
-
834
- Parameters:
835
- - `denseRows` - Dense rows.
836
-
837
- Returns: Flattened dense initializer result.
838
-
839
873
  ### collectDenseRowWeights
840
874
 
841
875
  ```ts
@@ -851,37 +885,35 @@ Parameters:
851
885
 
852
886
  Returns: Row weights in source-node order.
853
887
 
854
- ### resolveInboundWeight
888
+ ### collectPoolingAttributes
855
889
 
856
890
  ```ts
857
- resolveInboundWeight(
858
- targetNodeInternal: NodeInternals,
859
- sourceNode: default,
860
- ): number
891
+ collectPoolingAttributes(
892
+ poolSpec: Pool2DMapping,
893
+ ): PoolingAttributes
861
894
  ```
862
895
 
863
- Resolve source-to-target inbound connection weight.
896
+ Collect ONNX pooling attributes from one pooling spec.
864
897
 
865
898
  Parameters:
866
- - `targetNodeInternal` - Target node internals.
867
- - `sourceNode` - Source node.
899
+ - `poolSpec` - Pooling spec.
868
900
 
869
- Returns: Inbound weight or zero for disconnected edges.
901
+ Returns: Pooling attributes for ONNX node payload.
870
902
 
871
- ### asNodeInternals
903
+ ### collectRecurrentRow
872
904
 
873
905
  ```ts
874
- asNodeInternals(
875
- node: default,
876
- ): NodeInternals
906
+ collectRecurrentRow(
907
+ context: RecurrentRowCollectionContext,
908
+ ): number[]
877
909
  ```
878
910
 
879
- Normalize a public node instance into ONNX export internals.
911
+ Collect one recurrent matrix row.
880
912
 
881
913
  Parameters:
882
- - `node` - Source node.
914
+ - `context` - Row collection context.
883
915
 
884
- Returns: Internal runtime-facing node representation.
916
+ Returns: Recurrent row values.
885
917
 
886
918
  ### collectRecurrentRows
887
919
 
@@ -898,52 +930,35 @@ Parameters:
898
930
 
899
931
  Returns: Recurrent row collection.
900
932
 
901
- ### collectRecurrentRow
902
-
903
- ```ts
904
- collectRecurrentRow(
905
- context: RecurrentRowCollectionContext,
906
- ): number[]
907
- ```
908
-
909
- Collect one recurrent matrix row.
910
-
911
- Parameters:
912
- - `context` - Row collection context.
913
-
914
- Returns: Recurrent row values.
915
-
916
- ### resolveDiagonalRecurrentWeight
933
+ ### emitOptionalFlattenAfterPooling
917
934
 
918
935
  ```ts
919
- resolveDiagonalRecurrentWeight(
920
- context: RecurrentRowCollectionContext,
921
- columnIndex: number,
922
- ): number
936
+ emitOptionalFlattenAfterPooling(
937
+ context: FlattenAfterPoolingContext,
938
+ ): string
923
939
  ```
924
940
 
925
- Resolve recurrent weight value for one matrix coordinate.
941
+ Conditionally emit flatten node after pooling.
926
942
 
927
943
  Parameters:
928
- - `context` - Row collection context.
929
- - `columnIndex` - Column index in row.
944
+ - `context` - Flatten emission context.
930
945
 
931
- Returns: Recurrent weight for diagonal entries, otherwise zero.
946
+ Returns: Output tensor name after optional flatten.
932
947
 
933
- ### toPoolingEmissionContext
948
+ ### emitOptionalPoolingAndFlatten
934
949
 
935
950
  ```ts
936
- toPoolingEmissionContext(
951
+ emitOptionalPoolingAndFlatten(
937
952
  params: OptionalPoolingAndFlattenParams,
938
- ): PoolingEmissionContext
953
+ ): string
939
954
  ```
940
955
 
941
- Resolve pooling emission context from optional pooling parameters.
956
+ Emit optional pooling and flatten nodes after a layer output.
942
957
 
943
958
  Parameters:
944
- - `params` - Optional pooling and flatten parameters.
959
+ - `params` - Pooling parameters.
945
960
 
946
- Returns: Pooling emission context.
961
+ Returns: Final output tensor name after optional pooling/flatten.
947
962
 
948
963
  ### emitPoolingNode
949
964
 
@@ -960,51 +975,6 @@ Parameters:
960
975
 
961
976
  Returns: Pooling output tensor name.
962
977
 
963
- ### collectPoolingAttributes
964
-
965
- ```ts
966
- collectPoolingAttributes(
967
- poolSpec: Pool2DMapping,
968
- ): PoolingAttributes
969
- ```
970
-
971
- Collect ONNX pooling attributes from one pooling spec.
972
-
973
- Parameters:
974
- - `poolSpec` - Pooling spec.
975
-
976
- Returns: Pooling attributes for ONNX node payload.
977
-
978
- ### emitOptionalFlattenAfterPooling
979
-
980
- ```ts
981
- emitOptionalFlattenAfterPooling(
982
- context: FlattenAfterPoolingContext,
983
- ): string
984
- ```
985
-
986
- Conditionally emit flatten node after pooling.
987
-
988
- Parameters:
989
- - `context` - Flatten emission context.
990
-
991
- Returns: Output tensor name after optional flatten.
992
-
993
- ### appendPoolingMetadata
994
-
995
- ```ts
996
- appendPoolingMetadata(
997
- context: PoolingEmissionContext,
998
- ): void
999
- ```
1000
-
1001
- Append pooling metadata for one emitted pooling layer.
1002
-
1003
- Parameters:
1004
- - `context` - Pooling emission context.
1005
-
1006
- Returns: Nothing.
1007
-
1008
978
  ### ensureMetadataRegistry
1009
979
 
1010
980
  ```ts
@@ -1037,39 +1007,69 @@ Parameters:
1037
1007
 
1038
1008
  Returns: Matching metadata property if present.
1039
1009
 
1040
- ### buildIndexedMetadataProperty
1010
+ ### foldDenseRowsToInitializers
1041
1011
 
1042
1012
  ```ts
1043
- buildIndexedMetadataProperty(
1044
- key: string,
1045
- layerIndex: number,
1046
- ): OnnxMetadataProperty
1013
+ foldDenseRowsToInitializers(
1014
+ denseRows: DenseWeightRow[],
1015
+ ): DenseWeightBuildResult
1047
1016
  ```
1048
1017
 
1049
- Build a new index-array metadata property.
1018
+ Fold dense rows into flattened ONNX initializer arrays.
1050
1019
 
1051
1020
  Parameters:
1052
- - `key` - Metadata key.
1053
- - `layerIndex` - Layer index.
1021
+ - `denseRows` - Dense rows.
1054
1022
 
1055
- Returns: Metadata property.
1023
+ Returns: Flattened dense initializer result.
1056
1024
 
1057
- ### buildSpecMetadataProperty
1025
+ ### parseMetadataArray
1058
1026
 
1059
1027
  ```ts
1060
- buildSpecMetadataProperty(
1061
- key: string,
1062
- spec: Conv2DMapping | Pool2DMapping,
1063
- ): OnnxMetadataProperty
1028
+ parseMetadataArray(
1029
+ metadataValue: string,
1030
+ ): ItemType[] | undefined
1064
1031
  ```
1065
1032
 
1066
- Build a new spec-array metadata property.
1033
+ Parse a metadata JSON array value safely.
1067
1034
 
1068
1035
  Parameters:
1069
- - `key` - Metadata key.
1070
- - `spec` - Mapping spec.
1036
+ - `metadataValue` - Metadata JSON string.
1071
1037
 
1072
- Returns: Metadata property.
1038
+ Returns: Parsed array when valid, otherwise undefined.
1039
+
1040
+ ### resolveDiagonalRecurrentWeight
1041
+
1042
+ ```ts
1043
+ resolveDiagonalRecurrentWeight(
1044
+ context: RecurrentRowCollectionContext,
1045
+ columnIndex: number,
1046
+ ): number
1047
+ ```
1048
+
1049
+ Resolve recurrent weight value for one matrix coordinate.
1050
+
1051
+ Parameters:
1052
+ - `context` - Row collection context.
1053
+ - `columnIndex` - Column index in row.
1054
+
1055
+ Returns: Recurrent weight for diagonal entries, otherwise zero.
1056
+
1057
+ ### resolveInboundWeight
1058
+
1059
+ ```ts
1060
+ resolveInboundWeight(
1061
+ targetNodeInternal: NodeInternals,
1062
+ sourceNode: default,
1063
+ ): number
1064
+ ```
1065
+
1066
+ Resolve source-to-target inbound connection weight.
1067
+
1068
+ Parameters:
1069
+ - `targetNodeInternal` - Target node internals.
1070
+ - `sourceNode` - Source node.
1071
+
1072
+ Returns: Inbound weight or zero for disconnected edges.
1073
1073
 
1074
1074
  ### serializeIndexedMetadataValue
1075
1075
 
@@ -1105,17 +1105,17 @@ Parameters:
1105
1105
 
1106
1106
  Returns: Serialized JSON value.
1107
1107
 
1108
- ### parseMetadataArray
1108
+ ### toPoolingEmissionContext
1109
1109
 
1110
1110
  ```ts
1111
- parseMetadataArray(
1112
- metadataValue: string,
1113
- ): ItemType[] | undefined
1111
+ toPoolingEmissionContext(
1112
+ params: OptionalPoolingAndFlattenParams,
1113
+ ): PoolingEmissionContext
1114
1114
  ```
1115
1115
 
1116
- Parse a metadata JSON array value safely.
1116
+ Resolve pooling emission context from optional pooling parameters.
1117
1117
 
1118
1118
  Parameters:
1119
- - `metadataValue` - Metadata JSON string.
1119
+ - `params` - Optional pooling and flatten parameters.
1120
1120
 
1121
- Returns: Parsed array when valid, otherwise undefined.
1121
+ Returns: Pooling emission context.