@reicek/neataptic-ts 0.1.24 → 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 (215) 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/.github/workflows/ci.yml +3 -3
  8. package/.github/workflows/deploy-pages.yml +6 -6
  9. package/.github/workflows/manual_release_pipeline.yml +3 -3
  10. package/.github/workflows/publish.yml +18 -19
  11. package/.github/workflows/release_dispatch.yml +3 -3
  12. package/package.json +26 -20
  13. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  14. package/plans/README.md +24 -0
  15. package/plans/Roadmap.md +62 -40
  16. package/plans/analyze-trace-solid-split.plans.md +66 -0
  17. package/plans/architecture-solid-split.plans.md +9 -15
  18. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  19. package/plans/generate-docs-solid-split.plans.md +87 -0
  20. package/plans/methods-docs.plans.md +25 -1
  21. package/plans/methods-solid-split.plans.md +14 -14
  22. package/plans/neat-docs.plans.md +9 -1
  23. package/plans/neat-test-surface-repair.plans.md +1 -1
  24. package/plans/render-docs-html-solid-split.plans.md +68 -0
  25. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  26. package/plans/utils-docs.plans.md +6 -1
  27. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  28. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  29. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  30. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  31. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  32. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  33. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  34. package/scripts/assets/theme.css +80 -23
  35. package/scripts/copy-examples.ts +239 -0
  36. package/scripts/export-onnx.ts +223 -0
  37. package/scripts/generate-bench-tables.ts +378 -37
  38. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  39. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  40. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  41. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  42. package/scripts/generate-docs/generate-docs.ts +63 -0
  43. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  44. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  45. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  46. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  47. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  48. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  50. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  51. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  52. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  53. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  54. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  55. package/scripts/mermaid-cli.mjs +102 -22
  56. package/scripts/mermaid-cli.ts +736 -0
  57. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  58. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  59. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  60. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  61. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  62. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  63. package/scripts/render-docs-html.ts +23 -587
  64. package/scripts/run-docs.ts +238 -0
  65. package/scripts/write-dist-docs-pkg.ts +40 -0
  66. package/src/README.md +75 -75
  67. package/src/architecture/connection/README.md +5 -5
  68. package/src/architecture/layer/README.md +508 -508
  69. package/src/architecture/network/README.md +1458 -1458
  70. package/src/architecture/network/activate/README.md +694 -694
  71. package/src/architecture/network/bootstrap/README.md +77 -77
  72. package/src/architecture/network/connect/README.md +74 -74
  73. package/src/architecture/network/deterministic/README.md +135 -135
  74. package/src/architecture/network/evolve/README.md +364 -364
  75. package/src/architecture/network/gating/README.md +130 -130
  76. package/src/architecture/network/genetic/README.md +399 -399
  77. package/src/architecture/network/mutate/README.md +897 -897
  78. package/src/architecture/network/onnx/README.md +720 -720
  79. package/src/architecture/network/onnx/export/README.md +728 -728
  80. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  81. package/src/architecture/network/onnx/import/README.md +618 -618
  82. package/src/architecture/network/onnx/schema/README.md +32 -32
  83. package/src/architecture/network/prune/README.md +245 -245
  84. package/src/architecture/network/remove/README.md +135 -135
  85. package/src/architecture/network/runtime/README.md +106 -106
  86. package/src/architecture/network/serialize/README.md +542 -542
  87. package/src/architecture/network/slab/README.md +608 -608
  88. package/src/architecture/network/standalone/README.md +212 -212
  89. package/src/architecture/network/stats/README.md +84 -84
  90. package/src/architecture/network/topology/README.md +465 -465
  91. package/src/architecture/network/training/README.md +200 -200
  92. package/src/architecture/node/README.md +5 -5
  93. package/src/architecture/nodePool/README.md +14 -14
  94. package/src/methods/README.md +99 -99
  95. package/src/methods/activation/README.md +189 -189
  96. package/src/methods/cost/README.md +131 -131
  97. package/src/methods/rate/README.md +86 -86
  98. package/src/multithreading/README.md +77 -77
  99. package/src/multithreading/workers/browser/README.md +8 -8
  100. package/src/multithreading/workers/node/README.md +8 -8
  101. package/src/neat/README.md +148 -148
  102. package/src/neat/adaptive/README.md +120 -120
  103. package/src/neat/adaptive/acceptance/README.md +40 -40
  104. package/src/neat/adaptive/complexity/README.md +137 -137
  105. package/src/neat/adaptive/core/README.md +197 -197
  106. package/src/neat/adaptive/lineage/README.md +90 -90
  107. package/src/neat/adaptive/mutation/README.md +284 -284
  108. package/src/neat/compat/README.md +43 -43
  109. package/src/neat/compat/core/README.md +90 -90
  110. package/src/neat/diversity/README.md +35 -35
  111. package/src/neat/diversity/core/README.md +88 -88
  112. package/src/neat/evaluate/README.md +85 -85
  113. package/src/neat/evaluate/auto-distance/README.md +75 -75
  114. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  115. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  116. package/src/neat/evaluate/fitness/README.md +23 -23
  117. package/src/neat/evaluate/novelty/README.md +120 -120
  118. package/src/neat/evaluate/objectives/README.md +17 -17
  119. package/src/neat/evaluate/shared/README.md +94 -94
  120. package/src/neat/evolve/README.md +96 -96
  121. package/src/neat/evolve/adaptive/README.md +60 -60
  122. package/src/neat/evolve/objectives/README.md +63 -63
  123. package/src/neat/evolve/offspring/README.md +56 -56
  124. package/src/neat/evolve/population/README.md +171 -171
  125. package/src/neat/evolve/runtime/README.md +79 -79
  126. package/src/neat/evolve/speciation/README.md +74 -74
  127. package/src/neat/evolve/warnings/README.md +10 -10
  128. package/src/neat/export/README.md +114 -114
  129. package/src/neat/helpers/README.md +50 -50
  130. package/src/neat/init/README.md +9 -9
  131. package/src/neat/lineage/core/README.md +101 -101
  132. package/src/neat/multiobjective/category/README.md +74 -74
  133. package/src/neat/multiobjective/crowding/README.md +272 -272
  134. package/src/neat/multiobjective/dominance/README.md +171 -171
  135. package/src/neat/multiobjective/fronts/README.md +68 -68
  136. package/src/neat/multiobjective/metrics/README.md +43 -43
  137. package/src/neat/multiobjective/objectives/README.md +31 -31
  138. package/src/neat/multiobjective/shared/README.md +27 -27
  139. package/src/neat/mutation/README.md +97 -97
  140. package/src/neat/mutation/add-conn/README.md +115 -115
  141. package/src/neat/mutation/add-node/README.md +126 -126
  142. package/src/neat/mutation/flow/README.md +149 -149
  143. package/src/neat/mutation/repair/README.md +185 -185
  144. package/src/neat/mutation/select/README.md +117 -117
  145. package/src/neat/mutation/shared/README.md +32 -32
  146. package/src/neat/objectives/README.md +25 -25
  147. package/src/neat/objectives/core/README.md +67 -67
  148. package/src/neat/pruning/README.md +40 -40
  149. package/src/neat/pruning/core/README.md +171 -171
  150. package/src/neat/pruning/facade/README.md +32 -32
  151. package/src/neat/rng/README.md +104 -104
  152. package/src/neat/rng/core/README.md +137 -137
  153. package/src/neat/rng/facade/README.md +50 -50
  154. package/src/neat/selection/README.md +111 -111
  155. package/src/neat/selection/core/README.md +227 -227
  156. package/src/neat/selection/facade/README.md +61 -61
  157. package/src/neat/shared/README.md +163 -163
  158. package/src/neat/speciation/README.md +31 -31
  159. package/src/neat/speciation/threshold/README.md +35 -35
  160. package/src/neat/species/README.md +25 -25
  161. package/src/neat/species/core/README.md +20 -20
  162. package/src/neat/species/core/shared/README.md +18 -18
  163. package/src/neat/species/history/context/README.md +22 -22
  164. package/src/neat/telemetry/accessors/README.md +58 -58
  165. package/src/neat/telemetry/exports/README.md +233 -233
  166. package/src/neat/telemetry/facade/README.md +252 -252
  167. package/src/neat/telemetry/facade/archive/README.md +57 -57
  168. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  169. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  170. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  171. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  172. package/src/neat/telemetry/facade/species/README.md +27 -27
  173. package/src/neat/telemetry/metrics/README.md +696 -696
  174. package/src/neat/telemetry/recorder/README.md +57 -57
  175. package/src/neat/telemetry/types/README.md +32 -32
  176. package/src/neat/topology-intent/README.md +75 -75
  177. package/src/utils/README.md +193 -193
  178. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  179. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  180. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  181. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  182. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  183. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  184. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  185. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  186. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  187. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  188. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  189. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  190. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  191. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  192. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  193. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  194. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  195. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  196. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  197. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  198. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  199. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  200. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  201. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  202. package/test/examples/flappy_bird/environment/README.md +22 -22
  203. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  204. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  205. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  206. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  207. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  208. package/test/examples/flappy_bird/trainer/README.md +325 -325
  209. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  210. package/scripts/analyze-trace.ts +0 -590
  211. package/scripts/copy-examples.mjs +0 -114
  212. package/scripts/export-onnx.mjs +0 -86
  213. package/scripts/generate-bench-tables.mjs +0 -182
  214. package/scripts/generate-docs.ts +0 -2900
  215. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -20,380 +20,380 @@ flowchart LR
20
20
 
21
21
  ## architecture/network/onnx/export/network.onnx.export.types.ts
22
22
 
23
- ### OnnxExportOptions
23
+ ### ActivationSquashFunction
24
24
 
25
- Options controlling ONNX-like export.
25
+ ```ts
26
+ ActivationSquashFunction(
27
+ x: number,
28
+ derivate: boolean | undefined,
29
+ ): number
30
+ ```
26
31
 
27
- These options trade off strictness, portability, and fidelity:
32
+ Activation function signature used by ONNX layer emission helpers.
28
33
 
29
- - **Strict (default-ish)** export tries to keep the graph easy to interpret:
30
- layered topology, homogeneous activations per layer, and fully-connected layers.
34
+ ### ConvInferenceEvaluationContext
31
35
 
32
- - **Relaxed** export (`allowPartialConnectivity` / `allowMixedActivations`) can represent
33
- more networks, but it may generate graphs that are primarily meant for NeatapticTS’s
34
- importer (and may be less friendly to external ONNX tooling).
36
+ Width and shape evaluation context used by Conv inference helpers.
35
37
 
36
- - **Recurrent export** (`allowRecurrent`) is intentionally conservative and currently
37
- focuses on a constrained single-step representation and optional fused heuristics.
38
+ ### ConvInferenceKernelEvaluationContext
38
39
 
39
- Key fields (high-level):
40
- - `includeMetadata`: includes `metadata_props` with architecture hints.
41
- - `opset`: numeric opset version stored in the exported model metadata (default is
42
- resolved by the exporter; commonly 18 in this codebase).
43
- - `legacyNodeOrdering`: keeps older node ordering for backward compatibility.
44
- - `conv2dMappings` / `pool2dMappings`: encode conv/pool semantics for fully-connected
45
- layers via explicit mapping declarations.
40
+ Kernel candidate context for one Conv inference evaluation pass.
46
41
 
47
- ### ExportNodeIndexAssignmentContext
42
+ ### ConvInferenceResult
48
43
 
49
- Context for assigning a stable export index to one node.
44
+ Collected inferred Conv metadata payload.
50
45
 
51
- ### LstmPatternStub
46
+ ### ConvInferenceTraversalContext
52
47
 
53
- Heuristic LSTM pattern stub for metadata output.
48
+ Traversal context for one hidden layer during Conv inference.
54
49
 
55
- ### LstmLayerTraversalContext
50
+ ### ConvKernelConsistencyContext
56
51
 
57
- Traversal context for one hidden layer during LSTM stub collection.
52
+ Context for kernel-coordinate consistency checks at one output position.
58
53
 
59
- ### LstmCandidateContext
54
+ ### ConvLayerPairContext
60
55
 
61
- Candidate context for validating one LSTM-like hidden layer pattern.
56
+ Context for one resolved Conv mapping layer pair.
62
57
 
63
- ### ConvInferenceTraversalContext
58
+ ### ConvOutputCoordinate
64
59
 
65
- Traversal context for one hidden layer during Conv inference.
60
+ Coordinate for one Conv output neuron position.
66
61
 
67
- ### ConvInferenceEvaluationContext
62
+ ### ConvRepresentativeKernelContext
68
63
 
69
- Width and shape evaluation context used by Conv inference helpers.
64
+ Context for representative Conv kernel collection per output channel.
70
65
 
71
- ### ConvInferenceKernelEvaluationContext
66
+ ### ConvSharingValidationContext
72
67
 
73
- Kernel candidate context for one Conv inference evaluation pass.
68
+ Context for validating Conv sharing across all declared mappings.
74
69
 
75
- ### ConvInferenceResult
70
+ ### ConvSharingValidationResult
76
71
 
77
- Collected inferred Conv metadata payload.
72
+ Result of Conv sharing validation across declared mappings.
78
73
 
79
- ### OnnxBuildResolvedOptions
74
+ ### DenseActivationContext
80
75
 
81
- Resolved options used by ONNX model build orchestration.
76
+ Dense activation emission context.
82
77
 
83
- ### OnnxGraphDimensionBuildContext
78
+ ### DenseActivationNodePayload
84
79
 
85
- Context for constructing input/output ONNX graph dimensions.
80
+ Strongly typed activation node payload used by dense export helpers.
86
81
 
87
- ### OnnxGraphDimensions
82
+ ### DenseGemmNodePayload
88
83
 
89
- Output dimensions used by ONNX graph input/output value info payloads.
84
+ Strongly typed Gemm node payload used by dense export helpers.
90
85
 
91
- ### OnnxBaseModelBuildContext
86
+ ### DenseGraphNames
92
87
 
93
- Context for constructing a base ONNX model shell.
88
+ Dense graph tensor names.
94
89
 
95
- ### OnnxModelMetadataContext
90
+ ### DenseInitializerValues
96
91
 
97
- Context for applying optional ONNX model metadata.
92
+ Dense initializer value arrays.
98
93
 
99
- ### OnnxRecurrentCollectionContext
94
+ ### DenseLayerContext
100
95
 
101
- Context for collecting recurrent layer indices during model build.
96
+ Dense layer context enriched with resolved activation function.
102
97
 
103
- ### OnnxRecurrentLayerTraversalContext
98
+ ### DenseLayerParams
104
99
 
105
- Traversal context for one hidden layer during recurrent-input collection.
100
+ Parameters for dense layer emission.
106
101
 
107
- ### OnnxRecurrentInputValueInfoContext
102
+ ### DenseOrderedNodePayload
108
103
 
109
- Context for constructing one recurrent previous-state graph input payload.
104
+ Dense node payload union used by ordered append helpers.
110
105
 
111
- ### OnnxRecurrentLayerProcessingContext
106
+ ### DenseTensorNames
112
107
 
113
- Execution context for processing one hidden recurrent layer.
108
+ Dense initializer tensor names.
114
109
 
115
- ### OnnxLayerEmissionResult
110
+ ### DenseWeightBuildContext
116
111
 
117
- Result of emitting non-input export layers.
112
+ Context for building dense layer initializers from two adjacent layers.
118
113
 
119
- ### OnnxLayerEmissionContext
114
+ ### DenseWeightBuildResult
120
115
 
121
- Context for emitting non-input layers during model build.
116
+ Dense layer initializer fold output.
122
117
 
123
- ### LayerBuildContext
118
+ ### DenseWeightRow
124
119
 
125
- Layer build context used while emitting one ONNX graph layer segment.
120
+ One collected dense row before fold to flattened initializers.
126
121
 
127
- ### LayerTraversalContext
122
+ ### DenseWeightRowCollectionContext
128
123
 
129
- Layer traversal context with adjacent layers and output classification.
124
+ Context for collecting one dense row.
130
125
 
131
- ### LayerActivationContext
126
+ ### DiagonalRecurrentBuildContext
132
127
 
133
- Activation analysis context for one layer.
128
+ Context for building a diagonal recurrent matrix from self-connections.
134
129
 
135
- ### LayerRecurrentDecisionContext
130
+ ### ExportNodeIndexAssignmentContext
136
131
 
137
- Context used to decide recurrent emission branch usage.
132
+ Context for assigning a stable export index to one node.
138
133
 
139
- ### OnnxPostProcessingContext
134
+ ### FlattenAfterPoolingContext
140
135
 
141
- Context for post-processing and export metadata finalization.
136
+ Flatten emission context after optional pooling.
142
137
 
143
- ### RecurrentHeuristicEmissionContext
138
+ ### FusedRecurrentEmissionExecutionContext
144
139
 
145
- Context for heuristic recurrent operator emission traversal.
140
+ Shared execution context for emitting one fused recurrent layer payload.
146
141
 
147
- ### HiddenLayerHeuristicContext
142
+ ### FusedRecurrentGraphNames
148
143
 
149
- Context for one hidden layer during heuristic recurrent emission.
144
+ Context for ONNX fused recurrent node payload names.
150
145
 
151
- ### LstmEmissionContext
146
+ ### FusedRecurrentInitializerNames
152
147
 
153
- Context for heuristic LSTM emission when a layer matches expected shape.
148
+ Context for ONNX fused recurrent initializer names.
154
149
 
155
150
  ### GruEmissionContext
156
151
 
157
152
  Context for heuristic GRU emission when a layer matches expected shape.
158
153
 
159
- ### RecurrentGateRowCollectionContext
154
+ ### HiddenLayerHeuristicContext
160
155
 
161
- Context for collecting one recurrent gate row (one neuron).
156
+ Context for one hidden layer during heuristic recurrent emission.
162
157
 
163
- ### RecurrentGateRow
158
+ ### IndexedMetadataAppendContext
164
159
 
165
- One recurrent gate row payload before flatten fold.
160
+ Append-an-index metadata context for JSON-array metadata keys.
166
161
 
167
- ### RecurrentGateParameterCollectionResult
162
+ ### LayerActivationContext
168
163
 
169
- Flattened recurrent gate parameter vectors for one fused operator.
164
+ Activation analysis context for one layer.
170
165
 
171
- ### RecurrentGateBlockCollectionContext
166
+ ### LayerBuildContext
172
167
 
173
- Context for collecting one gate parameter block.
168
+ Layer build context used while emitting one ONNX graph layer segment.
174
169
 
175
- ### FusedRecurrentInitializerNames
170
+ ### LayerRecurrentDecisionContext
176
171
 
177
- Context for ONNX fused recurrent initializer names.
172
+ Context used to decide recurrent emission branch usage.
178
173
 
179
- ### FusedRecurrentGraphNames
174
+ ### LayerTraversalContext
180
175
 
181
- Context for ONNX fused recurrent node payload names.
176
+ Layer traversal context with adjacent layers and output classification.
182
177
 
183
- ### FusedRecurrentEmissionExecutionContext
178
+ ### LstmCandidateContext
184
179
 
185
- Shared execution context for emitting one fused recurrent layer payload.
180
+ Candidate context for validating one LSTM-like hidden layer pattern.
186
181
 
187
- ### RecurrentLayerEmissionParams
182
+ ### LstmEmissionContext
188
183
 
189
- Parameters for single-step recurrent layer emission.
184
+ Context for heuristic LSTM emission when a layer matches expected shape.
190
185
 
191
- ### RecurrentLayerEmissionContext
186
+ ### LstmLayerTraversalContext
192
187
 
193
- Derived execution context for single-step recurrent layer emission.
188
+ Traversal context for one hidden layer during LSTM stub collection.
194
189
 
195
- ### RecurrentInitializerNames
190
+ ### LstmPatternStub
196
191
 
197
- Initializer tensor names for one single-step recurrent layer.
192
+ Heuristic LSTM pattern stub for metadata output.
198
193
 
199
- ### RecurrentInitializerValues
194
+ ### OnnxBaseModelBuildContext
200
195
 
201
- Collected initializer vectors for one single-step recurrent layer.
196
+ Context for constructing a base ONNX model shell.
202
197
 
203
- ### RecurrentInitializerEmissionContext
198
+ ### OnnxBuildResolvedOptions
204
199
 
205
- Context for pushing recurrent initializers into ONNX graph state.
200
+ Resolved options used by ONNX model build orchestration.
206
201
 
207
- ### RecurrentGemmEmissionContext
202
+ ### OnnxConvEmissionContext
208
203
 
209
- Context for emitting one Gemm node for recurrent single-step export.
204
+ Context used after resolving Conv mapping for one layer.
210
205
 
211
- ### RecurrentGraphNames
206
+ ### OnnxConvEmissionParams
212
207
 
213
- Derived graph names for one recurrent single-step layer payload.
208
+ Parameters accepted by Conv layer emission.
214
209
 
215
- ### RecurrentActivationEmissionContext
210
+ ### OnnxConvParameters
216
211
 
217
- Context for selecting and emitting recurrent activation node payload.
212
+ Flattened Conv parameters for ONNX initializers.
218
213
 
219
- ### ConvSharingValidationResult
214
+ ### OnnxConvTensorNames
220
215
 
221
- Result of Conv sharing validation across declared mappings.
216
+ Tensor names generated for Conv parameters.
222
217
 
223
- ### ConvSharingValidationContext
218
+ ### OnnxExportOptions
224
219
 
225
- Context for validating Conv sharing across all declared mappings.
220
+ Options controlling ONNX-like export.
226
221
 
227
- ### ConvLayerPairContext
222
+ These options trade off strictness, portability, and fidelity:
228
223
 
229
- Context for one resolved Conv mapping layer pair.
224
+ - **Strict (default-ish)** export tries to keep the graph easy to interpret:
225
+ layered topology, homogeneous activations per layer, and fully-connected layers.
230
226
 
231
- ### ConvOutputCoordinate
227
+ - **Relaxed** export (`allowPartialConnectivity` / `allowMixedActivations`) can represent
228
+ more networks, but it may generate graphs that are primarily meant for NeatapticTS’s
229
+ importer (and may be less friendly to external ONNX tooling).
232
230
 
233
- Coordinate for one Conv output neuron position.
231
+ - **Recurrent export** (`allowRecurrent`) is intentionally conservative and currently
232
+ focuses on a constrained single-step representation and optional fused heuristics.
234
233
 
235
- ### ConvRepresentativeKernelContext
234
+ Key fields (high-level):
235
+ - `includeMetadata`: includes `metadata_props` with architecture hints.
236
+ - `opset`: numeric opset version stored in the exported model metadata (default is
237
+ resolved by the exporter; commonly 18 in this codebase).
238
+ - `legacyNodeOrdering`: keeps older node ordering for backward compatibility.
239
+ - `conv2dMappings` / `pool2dMappings`: encode conv/pool semantics for fully-connected
240
+ layers via explicit mapping declarations.
236
241
 
237
- Context for representative Conv kernel collection per output channel.
242
+ ### OnnxGraphDimensionBuildContext
238
243
 
239
- ### ConvKernelConsistencyContext
244
+ Context for constructing input/output ONNX graph dimensions.
240
245
 
241
- Context for kernel-coordinate consistency checks at one output position.
246
+ ### OnnxGraphDimensions
242
247
 
243
- ### WeightToleranceComparisonContext
248
+ Output dimensions used by ONNX graph input/output value info payloads.
244
249
 
245
- Context for comparing two scalar weights with numeric tolerance.
250
+ ### OnnxLayerEmissionContext
246
251
 
247
- ### OnnxConvEmissionParams
252
+ Context for emitting non-input layers during model build.
248
253
 
249
- Parameters accepted by Conv layer emission.
254
+ ### OnnxLayerEmissionResult
250
255
 
251
- ### OnnxConvEmissionContext
256
+ Result of emitting non-input export layers.
252
257
 
253
- Context used after resolving Conv mapping for one layer.
258
+ ### OnnxModelMetadataContext
254
259
 
255
- ### OnnxConvParameters
260
+ Context for applying optional ONNX model metadata.
256
261
 
257
- Flattened Conv parameters for ONNX initializers.
262
+ ### OnnxPostProcessingContext
258
263
 
259
- ### OnnxConvTensorNames
264
+ Context for post-processing and export metadata finalization.
260
265
 
261
- Tensor names generated for Conv parameters.
266
+ ### OnnxRecurrentCollectionContext
262
267
 
263
- ### ActivationSquashFunction
268
+ Context for collecting recurrent layer indices during model build.
264
269
 
265
- ```ts
266
- ActivationSquashFunction(
267
- x: number,
268
- derivate: boolean | undefined,
269
- ): number
270
- ```
270
+ ### OnnxRecurrentInputValueInfoContext
271
271
 
272
- Activation function signature used by ONNX layer emission helpers.
272
+ Context for constructing one recurrent previous-state graph input payload.
273
273
 
274
- ### SharedGemmNodeBuildParams
274
+ ### OnnxRecurrentLayerProcessingContext
275
275
 
276
- Shared parameters for constructing a Gemm node payload.
276
+ Execution context for processing one hidden recurrent layer.
277
277
 
278
- ### SharedActivationNodeBuildParams
278
+ ### OnnxRecurrentLayerTraversalContext
279
279
 
280
- Shared parameters for constructing an activation node payload.
280
+ Traversal context for one hidden layer during recurrent-input collection.
281
281
 
282
282
  ### OptionalLayerOutputParams
283
283
 
284
284
  Shared parameters for optional pooling/flatten output emission.
285
285
 
286
- ### DenseWeightBuildContext
287
-
288
- Context for building dense layer initializers from two adjacent layers.
289
-
290
- ### DenseWeightRow
286
+ ### OptionalPoolingAndFlattenParams
291
287
 
292
- One collected dense row before fold to flattened initializers.
288
+ Parameters for optional pooling + flatten emission after a layer output.
293
289
 
294
- ### DenseWeightBuildResult
290
+ ### PerNeuronConcatNodePayload
295
291
 
296
- Dense layer initializer fold output.
292
+ Per-neuron concat node payload.
297
293
 
298
- ### DenseWeightRowCollectionContext
294
+ ### PerNeuronGraphNames
299
295
 
300
- Context for collecting one dense row.
296
+ Per-neuron graph tensor names.
301
297
 
302
- ### DiagonalRecurrentBuildContext
298
+ ### PerNeuronLayerContext
303
299
 
304
- Context for building a diagonal recurrent matrix from self-connections.
300
+ Per-neuron layer context alias.
305
301
 
306
- ### RecurrentRowCollectionContext
302
+ ### PerNeuronLayerParams
307
303
 
308
- Context for collecting one recurrent matrix row.
304
+ Parameters for per-neuron layer emission.
309
305
 
310
- ### OptionalPoolingAndFlattenParams
306
+ ### PerNeuronNodeContext
311
307
 
312
- Parameters for optional pooling + flatten emission after a layer output.
308
+ Per-neuron normalized node context.
313
309
 
314
- ### PoolingEmissionContext
310
+ ### PerNeuronSubgraphContext
315
311
 
316
- Pooling emission context resolved for one layer output.
312
+ Per-neuron subgraph emission context.
317
313
 
318
- ### FlattenAfterPoolingContext
314
+ ### PerNeuronTensorNames
319
315
 
320
- Flatten emission context after optional pooling.
316
+ Per-neuron initializer tensor names.
321
317
 
322
318
  ### PoolingAttributes
323
319
 
324
320
  Pooling tensor attributes for ONNX node payloads.
325
321
 
326
- ### IndexedMetadataAppendContext
322
+ ### PoolingEmissionContext
327
323
 
328
- Append-an-index metadata context for JSON-array metadata keys.
324
+ Pooling emission context resolved for one layer output.
329
325
 
330
- ### SpecMetadataAppendContext
326
+ ### RecurrentActivationEmissionContext
331
327
 
332
- Append-a-spec metadata context for JSON-array metadata keys.
328
+ Context for selecting and emitting recurrent activation node payload.
333
329
 
334
- ### DenseLayerParams
330
+ ### RecurrentGateBlockCollectionContext
335
331
 
336
- Parameters for dense layer emission.
332
+ Context for collecting one gate parameter block.
337
333
 
338
- ### DenseLayerContext
334
+ ### RecurrentGateParameterCollectionResult
339
335
 
340
- Dense layer context enriched with resolved activation function.
336
+ Flattened recurrent gate parameter vectors for one fused operator.
341
337
 
342
- ### DenseTensorNames
338
+ ### RecurrentGateRow
343
339
 
344
- Dense initializer tensor names.
340
+ One recurrent gate row payload before flatten fold.
345
341
 
346
- ### DenseInitializerValues
342
+ ### RecurrentGateRowCollectionContext
347
343
 
348
- Dense initializer value arrays.
344
+ Context for collecting one recurrent gate row (one neuron).
349
345
 
350
- ### DenseGraphNames
346
+ ### RecurrentGemmEmissionContext
351
347
 
352
- Dense graph tensor names.
348
+ Context for emitting one Gemm node for recurrent single-step export.
353
349
 
354
- ### DenseActivationContext
350
+ ### RecurrentGraphNames
355
351
 
356
- Dense activation emission context.
352
+ Derived graph names for one recurrent single-step layer payload.
357
353
 
358
- ### DenseGemmNodePayload
354
+ ### RecurrentHeuristicEmissionContext
359
355
 
360
- Strongly typed Gemm node payload used by dense export helpers.
356
+ Context for heuristic recurrent operator emission traversal.
361
357
 
362
- ### DenseActivationNodePayload
358
+ ### RecurrentInitializerEmissionContext
363
359
 
364
- Strongly typed activation node payload used by dense export helpers.
360
+ Context for pushing recurrent initializers into ONNX graph state.
365
361
 
366
- ### DenseOrderedNodePayload
362
+ ### RecurrentInitializerNames
367
363
 
368
- Dense node payload union used by ordered append helpers.
364
+ Initializer tensor names for one single-step recurrent layer.
369
365
 
370
- ### PerNeuronLayerParams
366
+ ### RecurrentInitializerValues
371
367
 
372
- Parameters for per-neuron layer emission.
368
+ Collected initializer vectors for one single-step recurrent layer.
373
369
 
374
- ### PerNeuronLayerContext
370
+ ### RecurrentLayerEmissionContext
375
371
 
376
- Per-neuron layer context alias.
372
+ Derived execution context for single-step recurrent layer emission.
377
373
 
378
- ### PerNeuronSubgraphContext
374
+ ### RecurrentLayerEmissionParams
379
375
 
380
- Per-neuron subgraph emission context.
376
+ Parameters for single-step recurrent layer emission.
381
377
 
382
- ### PerNeuronNodeContext
378
+ ### RecurrentRowCollectionContext
383
379
 
384
- Per-neuron normalized node context.
380
+ Context for collecting one recurrent matrix row.
385
381
 
386
- ### PerNeuronTensorNames
382
+ ### SharedActivationNodeBuildParams
387
383
 
388
- Per-neuron initializer tensor names.
384
+ Shared parameters for constructing an activation node payload.
389
385
 
390
- ### PerNeuronGraphNames
386
+ ### SharedGemmNodeBuildParams
391
387
 
392
- Per-neuron graph tensor names.
388
+ Shared parameters for constructing a Gemm node payload.
393
389
 
394
- ### PerNeuronConcatNodePayload
390
+ ### SpecMetadataAppendContext
395
391
 
396
- Per-neuron concat node payload.
392
+ Append-a-spec metadata context for JSON-array metadata keys.
393
+
394
+ ### WeightToleranceComparisonContext
395
+
396
+ Context for comparing two scalar weights with numeric tolerance.
397
397
 
398
398
  ## architecture/network/onnx/export/network.onnx.export-flow.utils.ts
399
399
 
@@ -443,35 +443,39 @@ Returns: ONNX model.
443
443
 
444
444
  ## architecture/network/onnx/export/network.onnx.export-setup.utils.ts
445
445
 
446
- ### createGraphDimensions
446
+ ### appendRecurrentGraphInput
447
447
 
448
448
  ```ts
449
- createGraphDimensions(
450
- context: OnnxGraphDimensionBuildContext,
451
- ): OnnxGraphDimensions
449
+ appendRecurrentGraphInput(
450
+ model: OnnxModel,
451
+ traversalContext: OnnxRecurrentLayerTraversalContext,
452
+ ): void
452
453
  ```
453
454
 
454
- Build tensor dimensions for model input and output, optionally with symbolic batch dimension.
455
+ Append one recurrent previous-state graph input for a hidden layer.
455
456
 
456
457
  Parameters:
457
- - `context` - Dimension construction context.
458
+ - `model` - Target ONNX model.
459
+ - `traversalContext` - Hidden layer traversal context.
458
460
 
459
- Returns: Input and output dimension arrays for ONNX value info.
461
+ Returns: Nothing.
460
462
 
461
- ### createBaseModel
463
+ ### appendRecurrentLayerIndex
462
464
 
463
465
  ```ts
464
- createBaseModel(
465
- context: OnnxBaseModelBuildContext,
466
- ): OnnxModel
466
+ appendRecurrentLayerIndex(
467
+ recurrentLayerIndices: number[],
468
+ traversalContext: OnnxRecurrentLayerTraversalContext,
469
+ ): void
467
470
  ```
468
471
 
469
- Create the base ONNX model shell with graph input/output declarations.
472
+ Append one recurrent layer index to the collected index list.
470
473
 
471
474
  Parameters:
472
- - `context` - Base model build context.
475
+ - `recurrentLayerIndices` - Collected recurrent layer indices.
476
+ - `traversalContext` - Hidden layer traversal context.
473
477
 
474
- Returns: Initialized ONNX model with empty initializer/node lists.
478
+ Returns: Nothing.
475
479
 
476
480
  ### applyModelMetadata
477
481
 
@@ -503,22 +507,35 @@ Parameters:
503
507
 
504
508
  Returns: Export-layer indices with recurrent self-connections.
505
509
 
506
- ### createTensorDimensions
510
+ ### createBaseModel
507
511
 
508
512
  ```ts
509
- createTensorDimensions(
510
- width: number,
511
- batchDimension: boolean,
512
- ): OnnxDimension[]
513
+ createBaseModel(
514
+ context: OnnxBaseModelBuildContext,
515
+ ): OnnxModel
516
+ ```
517
+
518
+ Create the base ONNX model shell with graph input/output declarations.
519
+
520
+ Parameters:
521
+ - `context` - Base model build context.
522
+
523
+ Returns: Initialized ONNX model with empty initializer/node lists.
524
+
525
+ ### createGraphDimensions
526
+
527
+ ```ts
528
+ createGraphDimensions(
529
+ context: OnnxGraphDimensionBuildContext,
530
+ ): OnnxGraphDimensions
513
531
  ```
514
532
 
515
- Build one tensor shape dimension payload for dense vectors.
533
+ Build tensor dimensions for model input and output, optionally with symbolic batch dimension.
516
534
 
517
535
  Parameters:
518
- - `width` - Vector width.
519
- - `batchDimension` - Whether symbolic batch dimension is enabled.
536
+ - `context` - Dimension construction context.
520
537
 
521
- Returns: ONNX dimensions for the vector payload.
538
+ Returns: Input and output dimension arrays for ONNX value info.
522
539
 
523
540
  ### createGraphValueInfo
524
541
 
@@ -537,20 +554,20 @@ Parameters:
537
554
 
538
555
  Returns: ONNX value info payload.
539
556
 
540
- ### isRecurrentCollectionEnabled
557
+ ### createHiddenLayerIndices
541
558
 
542
559
  ```ts
543
- isRecurrentCollectionEnabled(
544
- context: OnnxRecurrentCollectionContext,
545
- ): boolean
560
+ createHiddenLayerIndices(
561
+ totalLayerCount: number,
562
+ ): number[]
546
563
  ```
547
564
 
548
- Determine whether recurrent layer collection should execute.
565
+ Build hidden layer indices excluding input and output layers.
549
566
 
550
567
  Parameters:
551
- - `context` - Recurrent collection context.
568
+ - `totalLayerCount` - Total number of network layers.
552
569
 
553
- Returns: True when recurrent collection is enabled.
570
+ Returns: Hidden layer indices.
554
571
 
555
572
  ### createHiddenLayerTraversalContexts
556
573
 
@@ -567,69 +584,52 @@ Parameters:
567
584
 
568
585
  Returns: Hidden layer traversal contexts.
569
586
 
570
- ### createHiddenLayerIndices
571
-
572
- ```ts
573
- createHiddenLayerIndices(
574
- totalLayerCount: number,
575
- ): number[]
576
- ```
577
-
578
- Build hidden layer indices excluding input and output layers.
579
-
580
- Parameters:
581
- - `totalLayerCount` - Total number of network layers.
582
-
583
- Returns: Hidden layer indices.
584
-
585
- ### processHiddenLayerRecurrence
587
+ ### createRecurrentInputValueInfo
586
588
 
587
589
  ```ts
588
- processHiddenLayerRecurrence(
589
- context: OnnxRecurrentLayerProcessingContext,
590
- ): void
590
+ createRecurrentInputValueInfo(
591
+ context: OnnxRecurrentInputValueInfoContext,
592
+ ): OnnxValueInfo
591
593
  ```
592
594
 
593
- Process one hidden layer for recurrent self-connections.
595
+ Build one recurrent previous-state graph input payload.
594
596
 
595
597
  Parameters:
596
- - `context` - Hidden layer recurrent processing context.
598
+ - `context` - Recurrent input value-info context.
597
599
 
598
- Returns: Nothing.
600
+ Returns: ONNX value info payload for recurrent state input.
599
601
 
600
- ### appendRecurrentLayerIndex
602
+ ### createRecurrentInputValueInfoContext
601
603
 
602
604
  ```ts
603
- appendRecurrentLayerIndex(
604
- recurrentLayerIndices: number[],
605
+ createRecurrentInputValueInfoContext(
605
606
  traversalContext: OnnxRecurrentLayerTraversalContext,
606
- ): void
607
+ ): OnnxRecurrentInputValueInfoContext
607
608
  ```
608
609
 
609
- Append one recurrent layer index to the collected index list.
610
+ Build recurrent input context for one hidden recurrent layer.
610
611
 
611
612
  Parameters:
612
- - `recurrentLayerIndices` - Collected recurrent layer indices.
613
613
  - `traversalContext` - Hidden layer traversal context.
614
614
 
615
- Returns: Nothing.
615
+ Returns: Recurrent input value-info context.
616
616
 
617
- ### appendRecurrentGraphInput
617
+ ### createTensorDimensions
618
618
 
619
619
  ```ts
620
- appendRecurrentGraphInput(
621
- model: OnnxModel,
622
- traversalContext: OnnxRecurrentLayerTraversalContext,
623
- ): void
620
+ createTensorDimensions(
621
+ width: number,
622
+ batchDimension: boolean,
623
+ ): OnnxDimension[]
624
624
  ```
625
625
 
626
- Append one recurrent previous-state graph input for a hidden layer.
626
+ Build one tensor shape dimension payload for dense vectors.
627
627
 
628
628
  Parameters:
629
- - `model` - Target ONNX model.
630
- - `traversalContext` - Hidden layer traversal context.
629
+ - `width` - Vector width.
630
+ - `batchDimension` - Whether symbolic batch dimension is enabled.
631
631
 
632
- Returns: Nothing.
632
+ Returns: ONNX dimensions for the vector payload.
633
633
 
634
634
  ### hasLayerSelfRecurrence
635
635
 
@@ -646,200 +646,197 @@ Parameters:
646
646
 
647
647
  Returns: True when a node has a self-connection.
648
648
 
649
- ### createRecurrentInputValueInfoContext
649
+ ### isRecurrentCollectionEnabled
650
650
 
651
651
  ```ts
652
- createRecurrentInputValueInfoContext(
653
- traversalContext: OnnxRecurrentLayerTraversalContext,
654
- ): OnnxRecurrentInputValueInfoContext
652
+ isRecurrentCollectionEnabled(
653
+ context: OnnxRecurrentCollectionContext,
654
+ ): boolean
655
655
  ```
656
656
 
657
- Build recurrent input context for one hidden recurrent layer.
657
+ Determine whether recurrent layer collection should execute.
658
658
 
659
659
  Parameters:
660
- - `traversalContext` - Hidden layer traversal context.
660
+ - `context` - Recurrent collection context.
661
661
 
662
- Returns: Recurrent input value-info context.
662
+ Returns: True when recurrent collection is enabled.
663
663
 
664
- ### createRecurrentInputValueInfo
664
+ ### processHiddenLayerRecurrence
665
665
 
666
666
  ```ts
667
- createRecurrentInputValueInfo(
668
- context: OnnxRecurrentInputValueInfoContext,
669
- ): OnnxValueInfo
667
+ processHiddenLayerRecurrence(
668
+ context: OnnxRecurrentLayerProcessingContext,
669
+ ): void
670
670
  ```
671
671
 
672
- Build one recurrent previous-state graph input payload.
672
+ Process one hidden layer for recurrent self-connections.
673
673
 
674
674
  Parameters:
675
- - `context` - Recurrent input value-info context.
675
+ - `context` - Hidden layer recurrent processing context.
676
676
 
677
- Returns: ONNX value info payload for recurrent state input.
677
+ Returns: Nothing.
678
678
 
679
679
  ## architecture/network/onnx/export/network.onnx.export-postprocess.utils.ts
680
680
 
681
- ### emitFusedRecurrentHeuristics
681
+ ### appendConvLayerValidationResult
682
682
 
683
683
  ```ts
684
- emitFusedRecurrentHeuristics(
685
- model: OnnxModel,
686
- layers: default[][],
687
- allowRecurrent: boolean | undefined,
688
- previousOutputName: string,
684
+ appendConvLayerValidationResult(
685
+ result: ConvSharingValidationResult,
686
+ layerIndex: number,
687
+ isConsistent: boolean,
689
688
  ): void
690
689
  ```
691
690
 
692
- Emit heuristic fused recurrent operators (LSTM/GRU) when recurrent export is enabled.
693
-
694
- Parameters:
695
- - `model` - Target ONNX model.
696
- - `layers` - Layered network nodes.
697
- - `allowRecurrent` - Whether recurrent export is enabled.
698
- - `previousOutputName` - Current graph output name (kept for backward-compatible emission semantics).
699
-
700
- Returns: Nothing.
691
+ Append one Conv-layer validation outcome and optional warning.
701
692
 
702
- ### finalizeExportMetadata
693
+ ### appendConvSharingMetadata
703
694
 
704
695
  ```ts
705
- finalizeExportMetadata(
696
+ appendConvSharingMetadata(
706
697
  model: OnnxModel,
707
- layers: default[][],
708
- options: OnnxExportOptions,
709
- includeMetadata: boolean,
710
- hiddenSizesMetadata: number[],
711
- recurrentLayerIndices: number[],
698
+ result: ConvSharingValidationResult,
712
699
  ): void
713
700
  ```
714
701
 
715
- Finalize export metadata and optional conv-sharing validation.
702
+ Append Conv-sharing validation metadata arrays.
716
703
 
717
- Parameters:
718
- - `model` - Target ONNX model.
719
- - `layers` - Layered network nodes.
720
- - `options` - Export options.
721
- - `includeMetadata` - Whether metadata emission is enabled.
722
- - `hiddenSizesMetadata` - Hidden-layer sizes collected during emission.
723
- - `recurrentLayerIndices` - Recurrent layer indices.
704
+ ### appendFusedRecurrentInitializers
724
705
 
725
- Returns: Nothing.
706
+ ```ts
707
+ appendFusedRecurrentInitializers(
708
+ model: OnnxModel,
709
+ initializerNames: FusedRecurrentInitializerNames,
710
+ parameters: RecurrentGateParameterCollectionResult,
711
+ gateCount: number,
712
+ unitSize: number,
713
+ previousSize: number,
714
+ ): void
715
+ ```
726
716
 
727
- ### tryEmitFusedLstm
717
+ Append fused recurrent initializer tensors to the ONNX graph.
718
+
719
+ ### appendFusedRecurrentNode
728
720
 
729
721
  ```ts
730
- tryEmitFusedLstm(
731
- context: HiddenLayerHeuristicContext,
722
+ appendFusedRecurrentNode(
723
+ graph: OnnxGraph,
724
+ operatorType: "LSTM" | "GRU",
725
+ previousOutputName: string,
726
+ initializerNames: FusedRecurrentInitializerNames,
727
+ graphNames: FusedRecurrentGraphNames,
728
+ unitSize: number,
732
729
  ): void
733
730
  ```
734
731
 
735
- Try emitting heuristic fused LSTM node and metadata.
732
+ Append fused recurrent operator node to the ONNX graph.
736
733
 
737
- ### buildFusedLstmExecutionContext
734
+ ### appendIndexMetadata
738
735
 
739
736
  ```ts
740
- buildFusedLstmExecutionContext(
741
- context: LstmEmissionContext,
742
- ): FusedRecurrentEmissionExecutionContext
737
+ appendIndexMetadata(
738
+ model: OnnxModel,
739
+ key: string,
740
+ layerIndex: number,
741
+ ): void
743
742
  ```
744
743
 
745
- Build shared fused-recurrent execution context for LSTM.
744
+ Append a unique layer index to metadata array key.
746
745
 
747
- ### tryEmitFusedGru
746
+ ### appendMetadataProperty
748
747
 
749
748
  ```ts
750
- tryEmitFusedGru(
751
- context: HiddenLayerHeuristicContext,
749
+ appendMetadataProperty(
750
+ model: OnnxModel,
751
+ metadataProperty: OnnxMetadataProperty,
752
752
  ): void
753
753
  ```
754
754
 
755
- Try emitting heuristic fused GRU node and metadata.
755
+ Append metadata property to model metadata_props list.
756
756
 
757
- ### buildFusedGruExecutionContext
757
+ ### appendRecurrentSingleStepMetadata
758
758
 
759
759
  ```ts
760
- buildFusedGruExecutionContext(
761
- context: GruEmissionContext,
762
- ): FusedRecurrentEmissionExecutionContext
760
+ appendRecurrentSingleStepMetadata(
761
+ model: OnnxModel,
762
+ recurrentLayerIndices: number[],
763
+ ): void
763
764
  ```
764
765
 
765
- Build shared fused-recurrent execution context for GRU.
766
+ Append recurrent single-step metadata when recurrent layers exist.
766
767
 
767
- ### emitFusedRecurrentLayer
768
+ ### areWeightsWithinTolerance
768
769
 
769
770
  ```ts
770
- emitFusedRecurrentLayer(
771
- context: FusedRecurrentEmissionExecutionContext,
772
- ): void
771
+ areWeightsWithinTolerance(
772
+ context: WeightToleranceComparisonContext,
773
+ ): boolean
773
774
  ```
774
775
 
775
- Emit shared fused recurrent payload (initializers, node, metadata).
776
+ Compare two scalar weights using configured tolerance.
776
777
 
777
- ### appendIndexMetadata
778
+ ### asNodeInternals
778
779
 
779
780
  ```ts
780
- appendIndexMetadata(
781
- model: OnnxModel,
782
- key: string,
783
- layerIndex: number,
784
- ): void
781
+ asNodeInternals(
782
+ node: default,
783
+ ): NodeInternals
785
784
  ```
786
785
 
787
- Append a unique layer index to metadata array key.
786
+ Resolve runtime node internals in one typed helper.
788
787
 
789
- ### findMetadataPropertyIndex
788
+ ### buildFusedGruExecutionContext
790
789
 
791
790
  ```ts
792
- findMetadataPropertyIndex(
793
- metadataProperties: OnnxMetadataProperty[],
794
- key: string,
795
- ): number
791
+ buildFusedGruExecutionContext(
792
+ context: GruEmissionContext,
793
+ ): FusedRecurrentEmissionExecutionContext
796
794
  ```
797
795
 
798
- Find metadata property index by key.
796
+ Build shared fused-recurrent execution context for GRU.
799
797
 
800
- ### upsertLayerIndexMetadataValue
798
+ ### buildFusedLstmExecutionContext
801
799
 
802
800
  ```ts
803
- upsertLayerIndexMetadataValue(
804
- metadataProperties: OnnxMetadataProperty[],
805
- metadataIndex: number,
806
- layerIndex: number,
807
- ): void
801
+ buildFusedLstmExecutionContext(
802
+ context: LstmEmissionContext,
803
+ ): FusedRecurrentEmissionExecutionContext
808
804
  ```
809
805
 
810
- Upsert one layer index into metadata array-like JSON value.
806
+ Build shared fused-recurrent execution context for LSTM.
811
807
 
812
- ### parseMetadataLayerIndices
808
+ ### buildFusedRecurrentGraphNames
813
809
 
814
810
  ```ts
815
- parseMetadataLayerIndices(
816
- metadataValue: string,
817
- ): number[]
811
+ buildFusedRecurrentGraphNames(
812
+ nodePrefix: string,
813
+ outputSuffix: string,
814
+ layerIndex: number,
815
+ ): FusedRecurrentGraphNames
818
816
  ```
819
817
 
820
- Parse metadata JSON value into a numeric layer-index array.
818
+ Build fused recurrent graph names for node and output.
821
819
 
822
- ### buildRecurrentHeuristicEmissionContext
820
+ ### buildFusedRecurrentInitializerNames
823
821
 
824
822
  ```ts
825
- buildRecurrentHeuristicEmissionContext(
826
- model: OnnxModel,
827
- layers: default[][],
828
- previousOutputName: string,
829
- ): RecurrentHeuristicEmissionContext
823
+ buildFusedRecurrentInitializerNames(
824
+ operatorType: "LSTM" | "GRU",
825
+ layerIndex: number,
826
+ ): FusedRecurrentInitializerNames
830
827
  ```
831
828
 
832
- Build reusable context for recurrent heuristic traversal.
829
+ Build fused recurrent initializer names for the current layer.
833
830
 
834
- ### collectHiddenLayerIndices
831
+ ### buildGruEmissionContext
835
832
 
836
833
  ```ts
837
- collectHiddenLayerIndices(
838
- layers: default[][],
839
- ): number[]
834
+ buildGruEmissionContext(
835
+ context: HiddenLayerHeuristicContext,
836
+ ): GruEmissionContext
840
837
  ```
841
838
 
842
- Collect hidden-layer indices for recurrent traversal.
839
+ Build GRU emission context from one hidden-layer traversal record.
843
840
 
844
841
  ### buildHiddenLayerHeuristicContext
845
842
 
@@ -852,85 +849,88 @@ buildHiddenLayerHeuristicContext(
852
849
 
853
850
  Build one hidden-layer traversal context.
854
851
 
855
- ### emitFallbackRecurrentPatternMetadata
852
+ ### buildLstmEmissionContext
856
853
 
857
854
  ```ts
858
- emitFallbackRecurrentPatternMetadata(
855
+ buildLstmEmissionContext(
859
856
  context: HiddenLayerHeuristicContext,
860
- ): void
857
+ ): LstmEmissionContext
861
858
  ```
862
859
 
863
- Emit fallback metadata for recurrent-size ambiguity.
860
+ Build LSTM emission context from one hidden-layer traversal record.
864
861
 
865
- ### isFallbackRecurrentPatternSize
862
+ ### buildMetadataProperty
866
863
 
867
864
  ```ts
868
- isFallbackRecurrentPatternSize(
869
- currentSize: number,
870
- ): boolean
865
+ buildMetadataProperty(
866
+ key: string,
867
+ value: unknown,
868
+ ): OnnxMetadataProperty
871
869
  ```
872
870
 
873
- Check whether hidden size should emit recurrent fallback metadata.
871
+ Build a metadata key/value property with JSON string serialization.
874
872
 
875
- ### isEligibleForLstmHeuristic
873
+ ### buildRecurrentHeuristicEmissionContext
876
874
 
877
875
  ```ts
878
- isEligibleForLstmHeuristic(
879
- currentSize: number,
880
- ): boolean
876
+ buildRecurrentHeuristicEmissionContext(
877
+ model: OnnxModel,
878
+ layers: default[][],
879
+ previousOutputName: string,
880
+ ): RecurrentHeuristicEmissionContext
881
881
  ```
882
882
 
883
- Check LSTM heuristic eligibility by size and gate divisibility.
883
+ Build reusable context for recurrent heuristic traversal.
884
884
 
885
- ### buildLstmEmissionContext
885
+ ### collectConvKernelCoordinates
886
886
 
887
887
  ```ts
888
- buildLstmEmissionContext(
889
- context: HiddenLayerHeuristicContext,
890
- ): LstmEmissionContext
888
+ collectConvKernelCoordinates(
889
+ convSpec: Conv2DMapping,
890
+ ): OnnxConvKernelCoordinate[]
891
891
  ```
892
892
 
893
- Build LSTM emission context from one hidden-layer traversal record.
893
+ Collect kernel coordinates for one Conv kernel traversal.
894
894
 
895
- ### collectLstmGateNodeGroups
895
+ ### collectConvOutputCoordinates
896
896
 
897
897
  ```ts
898
- collectLstmGateNodeGroups(
899
- context: LstmEmissionContext,
900
- ): default[][]
898
+ collectConvOutputCoordinates(
899
+ convSpec: Conv2DMapping,
900
+ ): ConvOutputCoordinate[]
901
901
  ```
902
902
 
903
- Collect LSTM gate node groups in canonical export order.
903
+ Collect output coordinates for full Conv traversal.
904
904
 
905
- ### isEligibleForGruHeuristic
905
+ ### collectGruGateNodeGroups
906
906
 
907
907
  ```ts
908
- isEligibleForGruHeuristic(
909
- currentSize: number,
910
- ): boolean
908
+ collectGruGateNodeGroups(
909
+ context: GruEmissionContext,
910
+ ): default[][]
911
911
  ```
912
912
 
913
- Check GRU heuristic eligibility by size and gate divisibility.
913
+ Collect GRU gate node groups in canonical export order.
914
914
 
915
- ### buildGruEmissionContext
915
+ ### collectHiddenLayerIndices
916
916
 
917
917
  ```ts
918
- buildGruEmissionContext(
919
- context: HiddenLayerHeuristicContext,
920
- ): GruEmissionContext
918
+ collectHiddenLayerIndices(
919
+ layers: default[][],
920
+ ): number[]
921
921
  ```
922
922
 
923
- Build GRU emission context from one hidden-layer traversal record.
923
+ Collect hidden-layer indices for recurrent traversal.
924
924
 
925
- ### collectGruGateNodeGroups
925
+ ### collectLstmGateNodeGroups
926
926
 
927
927
  ```ts
928
- collectGruGateNodeGroups(
929
- context: GruEmissionContext,
928
+ collectLstmGateNodeGroups(
929
+ context: LstmEmissionContext,
930
930
  ): default[][]
931
931
  ```
932
932
 
933
- Collect GRU gate node groups in canonical export order.
933
+ Collect LSTM gate node groups in canonical export order.
934
934
 
935
935
  ### collectRecurrentGateBlockParameters
936
936
 
@@ -952,142 +952,145 @@ collectRecurrentGateRow(
952
952
 
953
953
  Collect one recurrent gate row payload (inputs, recurrent slice, and bias).
954
954
 
955
- ### resolveRecurrentRowWeight
956
-
957
- ```ts
958
- resolveRecurrentRowWeight(
959
- context: RecurrentGateRowCollectionContext,
960
- columnIndex: number,
961
- ): number
962
- ```
963
-
964
- Resolve one recurrent row value at the requested column.
965
-
966
- ### foldRecurrentGateRows
955
+ ### collectRepresentativeKernelForChannel
967
956
 
968
957
  ```ts
969
- foldRecurrentGateRows(
970
- gateRows: RecurrentGateRow[],
971
- ): RecurrentGateParameterCollectionResult
958
+ collectRepresentativeKernelForChannel(
959
+ context: ConvRepresentativeKernelContext,
960
+ ): number[]
972
961
  ```
973
962
 
974
- Fold recurrent gate rows into flattened ONNX initializer vectors.
963
+ Collect one representative kernel by reading the first output position for a channel.
975
964
 
976
- ### foldRecurrentGateBlocks
965
+ ### collectRepresentativeKernels
977
966
 
978
967
  ```ts
979
- foldRecurrentGateBlocks(
980
- gateParameterBlocks: RecurrentGateParameterCollectionResult[],
981
- ): RecurrentGateParameterCollectionResult
968
+ collectRepresentativeKernels(
969
+ context: ConvLayerPairContext,
970
+ ): number[][]
982
971
  ```
983
972
 
984
- Fold gate blocks into a single fused parameter payload.
973
+ Collect representative kernels for each output channel.
985
974
 
986
- ### buildFusedRecurrentInitializerNames
975
+ ### collectRepresentativeKernelWeight
987
976
 
988
977
  ```ts
989
- buildFusedRecurrentInitializerNames(
990
- operatorType: "LSTM" | "GRU",
991
- layerIndex: number,
992
- ): FusedRecurrentInitializerNames
978
+ collectRepresentativeKernelWeight(
979
+ convSpec: Conv2DMapping,
980
+ previousLayerNodes: default[],
981
+ representativeInternal: NodeInternals,
982
+ kernelCoordinate: OnnxConvKernelCoordinate,
983
+ ): number
993
984
  ```
994
985
 
995
- Build fused recurrent initializer names for the current layer.
986
+ Collect representative kernel value using top-left receptive field indexing.
996
987
 
997
- ### buildFusedRecurrentGraphNames
988
+ ### emitFallbackRecurrentPatternMetadata
998
989
 
999
990
  ```ts
1000
- buildFusedRecurrentGraphNames(
1001
- nodePrefix: string,
1002
- outputSuffix: string,
1003
- layerIndex: number,
1004
- ): FusedRecurrentGraphNames
991
+ emitFallbackRecurrentPatternMetadata(
992
+ context: HiddenLayerHeuristicContext,
993
+ ): void
1005
994
  ```
1006
995
 
1007
- Build fused recurrent graph names for node and output.
996
+ Emit fallback metadata for recurrent-size ambiguity.
1008
997
 
1009
- ### appendFusedRecurrentInitializers
998
+ ### emitFusedRecurrentHeuristics
1010
999
 
1011
1000
  ```ts
1012
- appendFusedRecurrentInitializers(
1001
+ emitFusedRecurrentHeuristics(
1013
1002
  model: OnnxModel,
1014
- initializerNames: FusedRecurrentInitializerNames,
1015
- parameters: RecurrentGateParameterCollectionResult,
1016
- gateCount: number,
1017
- unitSize: number,
1018
- previousSize: number,
1003
+ layers: default[][],
1004
+ allowRecurrent: boolean | undefined,
1005
+ previousOutputName: string,
1019
1006
  ): void
1020
1007
  ```
1021
1008
 
1022
- Append fused recurrent initializer tensors to the ONNX graph.
1009
+ Emit heuristic fused recurrent operators (LSTM/GRU) when recurrent export is enabled.
1023
1010
 
1024
- ### appendFusedRecurrentNode
1011
+ Parameters:
1012
+ - `model` - Target ONNX model.
1013
+ - `layers` - Layered network nodes.
1014
+ - `allowRecurrent` - Whether recurrent export is enabled.
1015
+ - `previousOutputName` - Current graph output name (kept for backward-compatible emission semantics).
1016
+
1017
+ Returns: Nothing.
1018
+
1019
+ ### emitFusedRecurrentLayer
1025
1020
 
1026
1021
  ```ts
1027
- appendFusedRecurrentNode(
1028
- graph: OnnxGraph,
1029
- operatorType: "LSTM" | "GRU",
1030
- previousOutputName: string,
1031
- initializerNames: FusedRecurrentInitializerNames,
1032
- graphNames: FusedRecurrentGraphNames,
1033
- unitSize: number,
1022
+ emitFusedRecurrentLayer(
1023
+ context: FusedRecurrentEmissionExecutionContext,
1034
1024
  ): void
1035
1025
  ```
1036
1026
 
1037
- Append fused recurrent operator node to the ONNX graph.
1027
+ Emit shared fused recurrent payload (initializers, node, metadata).
1038
1028
 
1039
- ### resolveGruPreviousOutputName
1029
+ ### ensureMetadataProps
1040
1030
 
1041
1031
  ```ts
1042
- resolveGruPreviousOutputName(
1043
- layerIndex: number,
1044
- ): string
1032
+ ensureMetadataProps(
1033
+ model: OnnxModel,
1034
+ ): OnnxMetadataProperty[]
1045
1035
  ```
1046
1036
 
1047
- Resolve previous output naming semantics for GRU heuristic emission.
1037
+ Ensure metadata_props array exists and return it.
1048
1038
 
1049
- ### appendRecurrentSingleStepMetadata
1039
+ ### finalizeExportMetadata
1050
1040
 
1051
1041
  ```ts
1052
- appendRecurrentSingleStepMetadata(
1042
+ finalizeExportMetadata(
1053
1043
  model: OnnxModel,
1044
+ layers: default[][],
1045
+ options: OnnxExportOptions,
1046
+ includeMetadata: boolean,
1047
+ hiddenSizesMetadata: number[],
1054
1048
  recurrentLayerIndices: number[],
1055
1049
  ): void
1056
1050
  ```
1057
1051
 
1058
- Append recurrent single-step metadata when recurrent layers exist.
1052
+ Finalize export metadata and optional conv-sharing validation.
1059
1053
 
1060
- ### shouldValidateConvSharing
1054
+ Parameters:
1055
+ - `model` - Target ONNX model.
1056
+ - `layers` - Layered network nodes.
1057
+ - `options` - Export options.
1058
+ - `includeMetadata` - Whether metadata emission is enabled.
1059
+ - `hiddenSizesMetadata` - Hidden-layer sizes collected during emission.
1060
+ - `recurrentLayerIndices` - Recurrent layer indices.
1061
+
1062
+ Returns: Nothing.
1063
+
1064
+ ### findMetadataPropertyIndex
1061
1065
 
1062
1066
  ```ts
1063
- shouldValidateConvSharing(
1064
- options: OnnxExportOptions,
1065
- ): boolean
1067
+ findMetadataPropertyIndex(
1068
+ metadataProperties: OnnxMetadataProperty[],
1069
+ key: string,
1070
+ ): number
1066
1071
  ```
1067
1072
 
1068
- Determine whether Conv2D sharing validation is enabled and configured.
1069
-
1070
- ### validateConvSharingAcrossMappings
1073
+ Find metadata property index by key.
1071
1074
 
1072
- ```ts
1073
- validateConvSharingAcrossMappings(
1074
- context: ConvSharingValidationContext,
1075
- ): ConvSharingValidationResult
1075
+ ### foldRecurrentGateBlocks
1076
+
1077
+ ```ts
1078
+ foldRecurrentGateBlocks(
1079
+ gateParameterBlocks: RecurrentGateParameterCollectionResult[],
1080
+ ): RecurrentGateParameterCollectionResult
1076
1081
  ```
1077
1082
 
1078
- Validate Conv2D sharing across all declared Conv mappings.
1083
+ Fold gate blocks into a single fused parameter payload.
1079
1084
 
1080
- ### resolveConvLayerPairContext
1085
+ ### foldRecurrentGateRows
1081
1086
 
1082
1087
  ```ts
1083
- resolveConvLayerPairContext(
1084
- layers: default[][],
1085
- layerIndex: number,
1086
- convSpec: Conv2DMapping,
1087
- ): ConvLayerPairContext | undefined
1088
+ foldRecurrentGateRows(
1089
+ gateRows: RecurrentGateRow[],
1090
+ ): RecurrentGateParameterCollectionResult
1088
1091
  ```
1089
1092
 
1090
- Resolve one Conv mapping layer pair or return undefined for invalid layout.
1093
+ Fold recurrent gate rows into flattened ONNX initializer vectors.
1091
1094
 
1092
1095
  ### isConvLayerPairConsistent
1093
1096
 
@@ -1099,68 +1102,57 @@ isConvLayerPairConsistent(
1099
1102
 
1100
1103
  Validate one Conv layer pair against representative kernel sharing.
1101
1104
 
1102
- ### appendConvLayerValidationResult
1103
-
1104
- ```ts
1105
- appendConvLayerValidationResult(
1106
- result: ConvSharingValidationResult,
1107
- layerIndex: number,
1108
- isConsistent: boolean,
1109
- ): void
1110
- ```
1111
-
1112
- Append one Conv-layer validation outcome and optional warning.
1113
-
1114
- ### appendConvSharingMetadata
1105
+ ### isEligibleForGruHeuristic
1115
1106
 
1116
1107
  ```ts
1117
- appendConvSharingMetadata(
1118
- model: OnnxModel,
1119
- result: ConvSharingValidationResult,
1120
- ): void
1108
+ isEligibleForGruHeuristic(
1109
+ currentSize: number,
1110
+ ): boolean
1121
1111
  ```
1122
1112
 
1123
- Append Conv-sharing validation metadata arrays.
1113
+ Check GRU heuristic eligibility by size and gate divisibility.
1124
1114
 
1125
- ### collectRepresentativeKernels
1115
+ ### isEligibleForLstmHeuristic
1126
1116
 
1127
1117
  ```ts
1128
- collectRepresentativeKernels(
1129
- context: ConvLayerPairContext,
1130
- ): number[][]
1118
+ isEligibleForLstmHeuristic(
1119
+ currentSize: number,
1120
+ ): boolean
1131
1121
  ```
1132
1122
 
1133
- Collect representative kernels for each output channel.
1123
+ Check LSTM heuristic eligibility by size and gate divisibility.
1134
1124
 
1135
- ### collectRepresentativeKernelForChannel
1125
+ ### isFallbackRecurrentPatternSize
1136
1126
 
1137
1127
  ```ts
1138
- collectRepresentativeKernelForChannel(
1139
- context: ConvRepresentativeKernelContext,
1140
- ): number[]
1128
+ isFallbackRecurrentPatternSize(
1129
+ currentSize: number,
1130
+ ): boolean
1141
1131
  ```
1142
1132
 
1143
- Collect one representative kernel by reading the first output position for a channel.
1133
+ Check whether hidden size should emit recurrent fallback metadata.
1144
1134
 
1145
- ### collectConvOutputCoordinates
1135
+ ### isInputPositionInsideBounds
1146
1136
 
1147
1137
  ```ts
1148
- collectConvOutputCoordinates(
1138
+ isInputPositionInsideBounds(
1149
1139
  convSpec: Conv2DMapping,
1150
- ): ConvOutputCoordinate[]
1140
+ inputRow: number,
1141
+ inputColumn: number,
1142
+ ): boolean
1151
1143
  ```
1152
1144
 
1153
- Collect output coordinates for full Conv traversal.
1145
+ Check whether input row/column falls inside Conv input bounds.
1154
1146
 
1155
- ### collectConvKernelCoordinates
1147
+ ### isKernelCoordinateConsistent
1156
1148
 
1157
1149
  ```ts
1158
- collectConvKernelCoordinates(
1159
- convSpec: Conv2DMapping,
1160
- ): OnnxConvKernelCoordinate[]
1150
+ isKernelCoordinateConsistent(
1151
+ context: ConvKernelConsistencyContext,
1152
+ ): boolean
1161
1153
  ```
1162
1154
 
1163
- Collect kernel coordinates for one Conv kernel traversal.
1155
+ Validate one kernel coordinate against its representative channel value.
1164
1156
 
1165
1157
  ### isOutputCoordinateConsistent
1166
1158
 
@@ -1175,106 +1167,80 @@ isOutputCoordinateConsistent(
1175
1167
 
1176
1168
  Validate one output coordinate against channel representative kernel weights.
1177
1169
 
1178
- ### resolveNeuronInternalAtOutputCoordinate
1179
-
1180
- ```ts
1181
- resolveNeuronInternalAtOutputCoordinate(
1182
- context: ConvLayerPairContext,
1183
- outputCoordinate: ConvOutputCoordinate,
1184
- ): NodeInternals | undefined
1185
- ```
1186
-
1187
- Resolve runtime internals for output coordinate neuron, if present.
1188
-
1189
- ### isKernelCoordinateConsistent
1190
-
1191
- ```ts
1192
- isKernelCoordinateConsistent(
1193
- context: ConvKernelConsistencyContext,
1194
- ): boolean
1195
- ```
1196
-
1197
- Validate one kernel coordinate against its representative channel value.
1198
-
1199
- ### resolveInputPosition
1170
+ ### parseMetadataLayerIndices
1200
1171
 
1201
1172
  ```ts
1202
- resolveInputPosition(
1203
- context: ConvKernelConsistencyContext,
1204
- ): { inputRow: number; inputColumn: number; }
1173
+ parseMetadataLayerIndices(
1174
+ metadataValue: string,
1175
+ ): number[]
1205
1176
  ```
1206
1177
 
1207
- Resolve input row/column projected by output and kernel coordinates.
1178
+ Parse metadata JSON value into a numeric layer-index array.
1208
1179
 
1209
- ### isInputPositionInsideBounds
1180
+ ### resolveConvLayerPairContext
1210
1181
 
1211
1182
  ```ts
1212
- isInputPositionInsideBounds(
1183
+ resolveConvLayerPairContext(
1184
+ layers: default[][],
1185
+ layerIndex: number,
1213
1186
  convSpec: Conv2DMapping,
1214
- inputRow: number,
1215
- inputColumn: number,
1216
- ): boolean
1187
+ ): ConvLayerPairContext | undefined
1217
1188
  ```
1218
1189
 
1219
- Check whether input row/column falls inside Conv input bounds.
1190
+ Resolve one Conv mapping layer pair or return undefined for invalid layout.
1220
1191
 
1221
- ### resolveSourceNodeAtInputPosition
1192
+ ### resolveGruPreviousOutputName
1222
1193
 
1223
1194
  ```ts
1224
- resolveSourceNodeAtInputPosition(
1225
- convSpec: Conv2DMapping,
1226
- previousLayerNodes: default[],
1227
- inChannelIndex: number,
1228
- inputRow: number,
1229
- inputColumn: number,
1230
- ): default | undefined
1195
+ resolveGruPreviousOutputName(
1196
+ layerIndex: number,
1197
+ ): string
1231
1198
  ```
1232
1199
 
1233
- Resolve source node by Conv input position coordinates.
1200
+ Resolve previous output naming semantics for GRU heuristic emission.
1234
1201
 
1235
- ### collectRepresentativeKernelWeight
1202
+ ### resolveIncomingWeight
1236
1203
 
1237
1204
  ```ts
1238
- collectRepresentativeKernelWeight(
1239
- convSpec: Conv2DMapping,
1240
- previousLayerNodes: default[],
1241
- representativeInternal: NodeInternals,
1242
- kernelCoordinate: OnnxConvKernelCoordinate,
1205
+ resolveIncomingWeight(
1206
+ targetNodeInternal: NodeInternals,
1207
+ sourceNode: default,
1243
1208
  ): number
1244
1209
  ```
1245
1210
 
1246
- Collect representative kernel value using top-left receptive field indexing.
1211
+ Resolve incoming connection weight from a specific source node.
1247
1212
 
1248
- ### areWeightsWithinTolerance
1213
+ ### resolveInputPosition
1249
1214
 
1250
1215
  ```ts
1251
- areWeightsWithinTolerance(
1252
- context: WeightToleranceComparisonContext,
1253
- ): boolean
1216
+ resolveInputPosition(
1217
+ context: ConvKernelConsistencyContext,
1218
+ ): { inputRow: number; inputColumn: number; }
1254
1219
  ```
1255
1220
 
1256
- Compare two scalar weights using configured tolerance.
1221
+ Resolve input row/column projected by output and kernel coordinates.
1257
1222
 
1258
- ### asNodeInternals
1223
+ ### resolveNeuronInternalAtOutputCoordinate
1259
1224
 
1260
1225
  ```ts
1261
- asNodeInternals(
1262
- node: default,
1263
- ): NodeInternals
1226
+ resolveNeuronInternalAtOutputCoordinate(
1227
+ context: ConvLayerPairContext,
1228
+ outputCoordinate: ConvOutputCoordinate,
1229
+ ): NodeInternals | undefined
1264
1230
  ```
1265
1231
 
1266
- Resolve runtime node internals in one typed helper.
1232
+ Resolve runtime internals for output coordinate neuron, if present.
1267
1233
 
1268
- ### resolveIncomingWeight
1234
+ ### resolveRecurrentRowWeight
1269
1235
 
1270
1236
  ```ts
1271
- resolveIncomingWeight(
1272
- targetNodeInternal: NodeInternals,
1273
- sourceNode: default,
1237
+ resolveRecurrentRowWeight(
1238
+ context: RecurrentGateRowCollectionContext,
1239
+ columnIndex: number,
1274
1240
  ): number
1275
1241
  ```
1276
1242
 
1277
- Resolve incoming connection weight from a specific source node.
1243
+ Resolve one recurrent row value at the requested column.
1278
1244
 
1279
1245
  ### resolveSelfConnectionWeight
1280
1246
 
@@ -1286,71 +1252,73 @@ resolveSelfConnectionWeight(
1286
1252
 
1287
1253
  Resolve self-connection weight for diagonal recurrent matrix entries.
1288
1254
 
1289
- ### buildMetadataProperty
1255
+ ### resolveSourceNodeAtInputPosition
1290
1256
 
1291
1257
  ```ts
1292
- buildMetadataProperty(
1293
- key: string,
1294
- value: unknown,
1295
- ): OnnxMetadataProperty
1258
+ resolveSourceNodeAtInputPosition(
1259
+ convSpec: Conv2DMapping,
1260
+ previousLayerNodes: default[],
1261
+ inChannelIndex: number,
1262
+ inputRow: number,
1263
+ inputColumn: number,
1264
+ ): default | undefined
1296
1265
  ```
1297
1266
 
1298
- Build a metadata key/value property with JSON string serialization.
1267
+ Resolve source node by Conv input position coordinates.
1299
1268
 
1300
- ### appendMetadataProperty
1269
+ ### shouldValidateConvSharing
1301
1270
 
1302
1271
  ```ts
1303
- appendMetadataProperty(
1304
- model: OnnxModel,
1305
- metadataProperty: OnnxMetadataProperty,
1306
- ): void
1272
+ shouldValidateConvSharing(
1273
+ options: OnnxExportOptions,
1274
+ ): boolean
1307
1275
  ```
1308
1276
 
1309
- Append metadata property to model metadata_props list.
1277
+ Determine whether Conv2D sharing validation is enabled and configured.
1310
1278
 
1311
- ### ensureMetadataProps
1279
+ ### tryEmitFusedGru
1312
1280
 
1313
1281
  ```ts
1314
- ensureMetadataProps(
1315
- model: OnnxModel,
1316
- ): OnnxMetadataProperty[]
1282
+ tryEmitFusedGru(
1283
+ context: HiddenLayerHeuristicContext,
1284
+ ): void
1317
1285
  ```
1318
1286
 
1319
- Ensure metadata_props array exists and return it.
1320
-
1321
- ## architecture/network/onnx/export/network.onnx.export-orchestrators.utils.ts
1287
+ Try emitting heuristic fused GRU node and metadata.
1322
1288
 
1323
- ### assignExportNodeIndices
1289
+ ### tryEmitFusedLstm
1324
1290
 
1325
1291
  ```ts
1326
- assignExportNodeIndices(
1327
- network: default,
1292
+ tryEmitFusedLstm(
1293
+ context: HiddenLayerHeuristicContext,
1328
1294
  ): void
1329
1295
  ```
1330
1296
 
1331
- Assign stable index values to nodes for export diagnostics.
1297
+ Try emitting heuristic fused LSTM node and metadata.
1332
1298
 
1333
- Parameters:
1334
- - `network` - Source network.
1299
+ ### upsertLayerIndexMetadataValue
1335
1300
 
1336
- Returns: Nothing.
1301
+ ```ts
1302
+ upsertLayerIndexMetadataValue(
1303
+ metadataProperties: OnnxMetadataProperty[],
1304
+ metadataIndex: number,
1305
+ layerIndex: number,
1306
+ ): void
1307
+ ```
1337
1308
 
1338
- ### collectLstmPatternStubs
1309
+ Upsert one layer index into metadata array-like JSON value.
1310
+
1311
+ ### validateConvSharingAcrossMappings
1339
1312
 
1340
1313
  ```ts
1341
- collectLstmPatternStubs(
1342
- layers: default[][],
1343
- allowRecurrent: boolean | undefined,
1344
- ): LstmPatternStub[]
1314
+ validateConvSharingAcrossMappings(
1315
+ context: ConvSharingValidationContext,
1316
+ ): ConvSharingValidationResult
1345
1317
  ```
1346
1318
 
1347
- Collect heuristic LSTM grouping stubs from hidden layers.
1348
-
1349
- Parameters:
1350
- - `layers` - Layered network nodes.
1351
- - `allowRecurrent` - Whether recurrent export heuristics are enabled.
1319
+ Validate Conv2D sharing across all declared Conv mappings.
1352
1320
 
1353
- Returns: Candidate LSTM pattern stubs.
1321
+ ## architecture/network/onnx/export/network.onnx.export-orchestrators.utils.ts
1354
1322
 
1355
1323
  ### appendConvInferenceMetadata
1356
1324
 
@@ -1388,20 +1356,22 @@ Parameters:
1388
1356
 
1389
1357
  Returns: Nothing.
1390
1358
 
1391
- ### createExportNodeIndexAssignmentContexts
1359
+ ### appendMetadataProperties
1392
1360
 
1393
1361
  ```ts
1394
- createExportNodeIndexAssignmentContexts(
1395
- network: default,
1396
- ): ExportNodeIndexAssignmentContext[]
1362
+ appendMetadataProperties(
1363
+ model: OnnxModel,
1364
+ metadataProperties: OnnxMetadataProperty[],
1365
+ ): void
1397
1366
  ```
1398
1367
 
1399
- Create node/index assignment contexts for export diagnostics.
1368
+ Append metadata properties in a single, normalized path.
1400
1369
 
1401
1370
  Parameters:
1402
- - `network` - Source network.
1371
+ - `model` - Target ONNX model.
1372
+ - `metadataProperties` - Metadata properties to append.
1403
1373
 
1404
- Returns: Assignment contexts.
1374
+ Returns: Nothing.
1405
1375
 
1406
1376
  ### applyExportNodeIndexAssignments
1407
1377
 
@@ -1433,20 +1403,52 @@ Parameters:
1433
1403
 
1434
1404
  Returns: Nothing.
1435
1405
 
1436
- ### safelyCollectLstmPatternStubs
1406
+ ### assignExportNodeIndices
1437
1407
 
1438
1408
  ```ts
1439
- safelyCollectLstmPatternStubs(
1409
+ assignExportNodeIndices(
1410
+ network: default,
1411
+ ): void
1412
+ ```
1413
+
1414
+ Assign stable index values to nodes for export diagnostics.
1415
+
1416
+ Parameters:
1417
+ - `network` - Source network.
1418
+
1419
+ Returns: Nothing.
1420
+
1421
+ ### collectInferredConvMetadata
1422
+
1423
+ ```ts
1424
+ collectInferredConvMetadata(
1425
+ context: { layers: default[][]; declaredMappings: Conv2DMapping[] | undefined; },
1426
+ ): ConvInferenceResult
1427
+ ```
1428
+
1429
+ Collect inferred Conv metadata from hidden-layer traversals.
1430
+
1431
+ Parameters:
1432
+ - `context` - Conv traversal context.
1433
+
1434
+ Returns: Inferred Conv metadata result.
1435
+
1436
+ ### collectLstmPatternStubs
1437
+
1438
+ ```ts
1439
+ collectLstmPatternStubs(
1440
1440
  layers: default[][],
1441
+ allowRecurrent: boolean | undefined,
1441
1442
  ): LstmPatternStub[]
1442
1443
  ```
1443
1444
 
1444
- Collect LSTM pattern stubs with heuristic error isolation.
1445
+ Collect heuristic LSTM grouping stubs from hidden layers.
1445
1446
 
1446
1447
  Parameters:
1447
1448
  - `layers` - Layered network nodes.
1449
+ - `allowRecurrent` - Whether recurrent export heuristics are enabled.
1448
1450
 
1449
- Returns: LSTM pattern stubs.
1451
+ Returns: Candidate LSTM pattern stubs.
1450
1452
 
1451
1453
  ### collectLstmPatternStubsFromLayers
1452
1454
 
@@ -1463,6 +1465,51 @@ Parameters:
1463
1465
 
1464
1466
  Returns: LSTM pattern stubs.
1465
1467
 
1468
+ ### createConvInferenceEvaluationContext
1469
+
1470
+ ```ts
1471
+ createConvInferenceEvaluationContext(
1472
+ traversalContext: ConvInferenceTraversalContext,
1473
+ ): ConvInferenceEvaluationContext
1474
+ ```
1475
+
1476
+ Create width/square-evaluation context for Conv inference.
1477
+
1478
+ Parameters:
1479
+ - `traversalContext` - Conv traversal context.
1480
+
1481
+ Returns: Conv evaluation context.
1482
+
1483
+ ### createConvTraversalContexts
1484
+
1485
+ ```ts
1486
+ createConvTraversalContexts(
1487
+ context: { layers: default[][]; declaredMappings: Conv2DMapping[] | undefined; },
1488
+ ): ConvInferenceTraversalContext[]
1489
+ ```
1490
+
1491
+ Create Conv traversal contexts for hidden layers.
1492
+
1493
+ Parameters:
1494
+ - `context` - Conv traversal source context.
1495
+
1496
+ Returns: Conv traversal contexts.
1497
+
1498
+ ### createExportNodeIndexAssignmentContexts
1499
+
1500
+ ```ts
1501
+ createExportNodeIndexAssignmentContexts(
1502
+ network: default,
1503
+ ): ExportNodeIndexAssignmentContext[]
1504
+ ```
1505
+
1506
+ Create node/index assignment contexts for export diagnostics.
1507
+
1508
+ Parameters:
1509
+ - `network` - Source network.
1510
+
1511
+ Returns: Assignment contexts.
1512
+
1466
1513
  ### createHiddenLayerTraversalContexts
1467
1514
 
1468
1515
  ```ts
@@ -1493,35 +1540,20 @@ Parameters:
1493
1540
 
1494
1541
  Returns: LSTM candidate context.
1495
1542
 
1496
- ### isValidLstmCandidateContext
1543
+ ### hasInferredConvMetadata
1497
1544
 
1498
1545
  ```ts
1499
- isValidLstmCandidateContext(
1500
- candidateContext: LstmCandidateContext,
1546
+ hasInferredConvMetadata(
1547
+ inferenceResult: ConvInferenceResult,
1501
1548
  ): boolean
1502
1549
  ```
1503
1550
 
1504
- Determine whether a candidate context satisfies heuristic LSTM conditions.
1505
-
1506
- Parameters:
1507
- - `candidateContext` - Candidate context.
1508
-
1509
- Returns: True when the candidate is a valid LSTM stub.
1510
-
1511
- ### mapLstmCandidateToStub
1512
-
1513
- ```ts
1514
- mapLstmCandidateToStub(
1515
- candidateContext: LstmCandidateContext,
1516
- ): LstmPatternStub
1517
- ```
1518
-
1519
- Map a valid candidate context to metadata stub.
1551
+ Check whether inferred Conv metadata exists.
1520
1552
 
1521
1553
  Parameters:
1522
- - `candidateContext` - Valid candidate context.
1554
+ - `inferenceResult` - Inferred Conv result.
1523
1555
 
1524
- Returns: LSTM pattern stub.
1556
+ Returns: True when inferred metadata exists.
1525
1557
 
1526
1558
  ### hasRequiredSelfConnectionCount
1527
1559
 
@@ -1538,78 +1570,78 @@ Parameters:
1538
1570
 
1539
1571
  Returns: True when self-connection count matches requirement.
1540
1572
 
1541
- ### collectInferredConvMetadata
1573
+ ### isDeclaredConvLayer
1542
1574
 
1543
1575
  ```ts
1544
- collectInferredConvMetadata(
1545
- context: { layers: default[][]; declaredMappings: Conv2DMapping[] | undefined; },
1546
- ): ConvInferenceResult
1576
+ isDeclaredConvLayer(
1577
+ traversalContext: ConvInferenceTraversalContext,
1578
+ ): boolean
1547
1579
  ```
1548
1580
 
1549
- Collect inferred Conv metadata from hidden-layer traversals.
1581
+ Check whether a traversal layer already has declared Conv mapping.
1550
1582
 
1551
1583
  Parameters:
1552
- - `context` - Conv traversal context.
1584
+ - `traversalContext` - Conv traversal context.
1553
1585
 
1554
- Returns: Inferred Conv metadata result.
1586
+ Returns: True when mapping is already declared.
1555
1587
 
1556
- ### createConvTraversalContexts
1588
+ ### isInferredConvSpec
1557
1589
 
1558
1590
  ```ts
1559
- createConvTraversalContexts(
1560
- context: { layers: default[][]; declaredMappings: Conv2DMapping[] | undefined; },
1561
- ): ConvInferenceTraversalContext[]
1591
+ isInferredConvSpec(
1592
+ specification: (Conv2DMapping & { note?: string | undefined; }) | undefined,
1593
+ ): boolean
1562
1594
  ```
1563
1595
 
1564
- Create Conv traversal contexts for hidden layers.
1596
+ Type guard for inferred Conv specifications.
1565
1597
 
1566
1598
  Parameters:
1567
- - `context` - Conv traversal source context.
1599
+ - `specification` - Conv specification candidate.
1568
1600
 
1569
- Returns: Conv traversal contexts.
1601
+ Returns: True when specification is defined.
1570
1602
 
1571
- ### resolveConvInferenceForLayer
1603
+ ### isValidLstmCandidateContext
1572
1604
 
1573
1605
  ```ts
1574
- resolveConvInferenceForLayer(
1575
- traversalContext: ConvInferenceTraversalContext,
1576
- ): (Conv2DMapping & { note?: string | undefined; }) | undefined
1606
+ isValidLstmCandidateContext(
1607
+ candidateContext: LstmCandidateContext,
1608
+ ): boolean
1577
1609
  ```
1578
1610
 
1579
- Resolve inferred Conv specification for one hidden layer.
1611
+ Determine whether a candidate context satisfies heuristic LSTM conditions.
1580
1612
 
1581
1613
  Parameters:
1582
- - `traversalContext` - Conv traversal context.
1614
+ - `candidateContext` - Candidate context.
1583
1615
 
1584
- Returns: Inferred Conv specification when matched.
1616
+ Returns: True when the candidate is a valid LSTM stub.
1585
1617
 
1586
- ### createConvInferenceEvaluationContext
1618
+ ### mapLstmCandidateToStub
1587
1619
 
1588
1620
  ```ts
1589
- createConvInferenceEvaluationContext(
1590
- traversalContext: ConvInferenceTraversalContext,
1591
- ): ConvInferenceEvaluationContext
1621
+ mapLstmCandidateToStub(
1622
+ candidateContext: LstmCandidateContext,
1623
+ ): LstmPatternStub
1592
1624
  ```
1593
1625
 
1594
- Create width/square-evaluation context for Conv inference.
1626
+ Map a valid candidate context to metadata stub.
1595
1627
 
1596
1628
  Parameters:
1597
- - `traversalContext` - Conv traversal context.
1629
+ - `candidateContext` - Valid candidate context.
1598
1630
 
1599
- Returns: Conv evaluation context.
1631
+ Returns: LSTM pattern stub.
1600
1632
 
1601
- ### resolveConvSpecFromKernelCandidates
1633
+ ### resolveConvInferenceForLayer
1602
1634
 
1603
1635
  ```ts
1604
- resolveConvSpecFromKernelCandidates(
1605
- evaluationContext: ConvInferenceEvaluationContext,
1636
+ resolveConvInferenceForLayer(
1637
+ traversalContext: ConvInferenceTraversalContext,
1606
1638
  ): (Conv2DMapping & { note?: string | undefined; }) | undefined
1607
1639
  ```
1608
1640
 
1609
- Resolve Conv specification using ordered kernel candidates.
1641
+ Resolve inferred Conv specification for one hidden layer.
1610
1642
 
1611
1643
  Parameters:
1612
- - `evaluationContext` - Conv evaluation context.
1644
+ - `traversalContext` - Conv traversal context.
1613
1645
 
1614
1646
  Returns: Inferred Conv specification when matched.
1615
1647
 
@@ -1628,64 +1660,32 @@ Parameters:
1628
1660
 
1629
1661
  Returns: Inferred Conv specification when matched.
1630
1662
 
1631
- ### isDeclaredConvLayer
1632
-
1633
- ```ts
1634
- isDeclaredConvLayer(
1635
- traversalContext: ConvInferenceTraversalContext,
1636
- ): boolean
1637
- ```
1638
-
1639
- Check whether a traversal layer already has declared Conv mapping.
1640
-
1641
- Parameters:
1642
- - `traversalContext` - Conv traversal context.
1643
-
1644
- Returns: True when mapping is already declared.
1645
-
1646
- ### isInferredConvSpec
1647
-
1648
- ```ts
1649
- isInferredConvSpec(
1650
- specification: (Conv2DMapping & { note?: string | undefined; }) | undefined,
1651
- ): boolean
1652
- ```
1653
-
1654
- Type guard for inferred Conv specifications.
1655
-
1656
- Parameters:
1657
- - `specification` - Conv specification candidate.
1658
-
1659
- Returns: True when specification is defined.
1660
-
1661
- ### hasInferredConvMetadata
1663
+ ### resolveConvSpecFromKernelCandidates
1662
1664
 
1663
1665
  ```ts
1664
- hasInferredConvMetadata(
1665
- inferenceResult: ConvInferenceResult,
1666
- ): boolean
1666
+ resolveConvSpecFromKernelCandidates(
1667
+ evaluationContext: ConvInferenceEvaluationContext,
1668
+ ): (Conv2DMapping & { note?: string | undefined; }) | undefined
1667
1669
  ```
1668
1670
 
1669
- Check whether inferred Conv metadata exists.
1671
+ Resolve Conv specification using ordered kernel candidates.
1670
1672
 
1671
1673
  Parameters:
1672
- - `inferenceResult` - Inferred Conv result.
1674
+ - `evaluationContext` - Conv evaluation context.
1673
1675
 
1674
- Returns: True when inferred metadata exists.
1676
+ Returns: Inferred Conv specification when matched.
1675
1677
 
1676
- ### appendMetadataProperties
1678
+ ### safelyCollectLstmPatternStubs
1677
1679
 
1678
1680
  ```ts
1679
- appendMetadataProperties(
1680
- model: OnnxModel,
1681
- metadataProperties: OnnxMetadataProperty[],
1682
- ): void
1681
+ safelyCollectLstmPatternStubs(
1682
+ layers: default[][],
1683
+ ): LstmPatternStub[]
1683
1684
  ```
1684
1685
 
1685
- Append metadata properties in a single, normalized path.
1686
+ Collect LSTM pattern stubs with heuristic error isolation.
1686
1687
 
1687
1688
  Parameters:
1688
- - `model` - Target ONNX model.
1689
- - `metadataProperties` - Metadata properties to append.
1689
+ - `layers` - Layered network nodes.
1690
1690
 
1691
- Returns: Nothing.
1691
+ Returns: LSTM pattern stubs.