architecture/network/onnx/import

ONNX import orchestration for rebuilding a NeatapticTS runtime network.

This file is the chapter-level tour guide for the import folder. The import path is intentionally staged so a reader can follow the same questions the runtime asks while restoring a model:

  1. What architecture should be rebuilt?
  2. Which runtime factories should own the scaffold?
  3. How do dense weights and activations map back onto nodes?
  4. Which recurrent and pooling hints need a second pass?

The neighboring files each own one of those stages. Keeping this overview on the flow file makes the generated folder README read like an import pipeline instead of an alphabetical pile of helper files.

Example:

const restored = runOnnxImportFlow(onnxModel);
const output = restored.activate([0.2, 0.8]);

architecture/network/onnx/import/network.onnx.import-flow.utils.ts

runOnnxImportFlow

runOnnxImportFlow(
  onnx: OnnxModel,
): default

Execute the complete ONNX import flow and reconstruct a runtime network.

High-level behavior:

  1. Extract architecture dimensions and build a perceptron scaffold.
  2. Restore dense parameters and activation functions.
  3. Reconstruct recurrent/pooling metadata and rebuild connection caches.

Parameters:

Returns: Reconstructed network instance.

architecture/network/onnx/import/network.onnx.runtime-load.types.ts

Import-owned types for ONNX runtime factory loading.

These payloads describe the small runtime bootstrap contract that the import flow uses to rebuild a perceptron scaffold and attach recurrent layer constructors without making the parser own a hard-coded constructor shape.

Example:

const runtimeFactories: OnnxRuntimeFactories = {
  perceptronFactory,
  layerModule,
};

OnnxPerceptronBuildContext

Build context for mapping ONNX layer sizes into a Neataptic MLP factory call.

OnnxPerceptronSizeValidationContext

Validation context for perceptron size-list checks during ONNX import.

OnnxRuntimeFactories

Runtime factories consumed during ONNX import network reconstruction.

OnnxRuntimeLayerFactory

OnnxRuntimeLayerFactory(
  size: number,
): default

Runtime layer-constructor signature used for recurrent layer reconstruction.

OnnxRuntimeLayerModule

Runtime layer module shape consumed by ONNX import orchestration.

OnnxRuntimePerceptronFactory

OnnxRuntimePerceptronFactory(
  sizes: number[],
): default

Runtime perceptron factory signature used by ONNX import orchestration.

architecture/network/onnx/import/network.onnx.runtime-load.utils.ts

buildPerceptronNetwork

buildPerceptronNetwork(
  buildContext: OnnxPerceptronBuildContext,
): default

Build a perceptron network from size-extraction context.

Parameters:

Returns: Reconstructed network instance.

createPerceptronBuildContext

createPerceptronBuildContext(
  sizes: number[],
): OnnxPerceptronBuildContext

Build perceptron-network construction context.

Parameters:

Returns: Build context.

createPerceptronFactory

createPerceptronFactory(): OnnxRuntimePerceptronFactory

Create an ONNX import network factory from modern static constructors.

Returns: Perceptron-compatible factory function.

createPerceptronSizeValidationContext

createPerceptronSizeValidationContext(
  sizes: number[],
): OnnxPerceptronSizeValidationContext

Build perceptron-size validation context.

Parameters:

Returns: Validation context.

createRuntimeLayerModule

createRuntimeLayerModule(): OnnxRuntimeLayerModule

Create the runtime layer-module wiring used by ONNX import orchestrators.

Returns: Runtime recurrent-layer module object.

foldRuntimeFactories

foldRuntimeFactories(
  perceptronFactory: OnnxRuntimePerceptronFactory,
  layerModule: OnnxRuntimeLayerModule,
): OnnxRuntimeFactories

Fold runtime perceptron and layer module into a transport payload.

Parameters:

Returns: Runtime factories payload.

foldRuntimeLayerModule

foldRuntimeLayerModule(
  lstmFactory: OnnxRuntimeLayerFactory,
  gruFactory: OnnxRuntimeLayerFactory,
): OnnxRuntimeLayerModule

Fold LSTM/GRU factories into a runtime layer module payload.

Parameters:

Returns: Runtime layer module.

loadRuntimeFactories

loadRuntimeFactories(): OnnxRuntimeFactories

Resolve runtime factories used by ONNX import orchestration.

Returns: Perceptron factory and layer module object.

resolveLayerFactory

resolveLayerFactory(
  layerKey: keyof OnnxRuntimeLayerModule,
): OnnxRuntimeLayerFactory

Resolve one runtime layer factory by module key.

Parameters:

Returns: Matching layer factory.

validatePerceptronSizes

validatePerceptronSizes(
  validationContext: OnnxPerceptronSizeValidationContext,
): void

Validate perceptron size-list constraints.

Parameters:

Returns: Nothing. Throws on invalid size-list.

architecture/network/onnx/import/network.onnx.import-weights.types.ts

Import-owned types for ONNX weight restoration and Conv reconstruction.

This chapter explains the state carried through the importer's heaviest restoration pass: hidden-size derivation, dense and per-neuron tensor assignment, and the optional Conv metadata replay that maps flattened ONNX initializers back onto runtime connections.

Keeping these types near the weight importer makes the generated import README read like a reconstruction guide instead of scattering the execution model across the root compatibility barrel.

Example:

const assignmentContext: OnnxImportWeightAssignmentContext = {
  onnx,
  hiddenLayerSizes,
  metadataProps,
  initializerMap,
  sortedLayerIndices,
  inputNodes,
  hiddenNodes,
  outputNodes,
};

OnnxImportAggregatedLayerAssignmentContext

Context for assigning aggregated dense tensors for one layer.

OnnxImportAggregatedNeuronAssignmentContext

Context for assigning one aggregated dense target neuron row.

OnnxImportConvCoordinateAssignmentContext

Context for applying Conv weights and bias at one output coordinate.

OnnxImportConvKernelAssignmentContext

Context for assigning one concrete Conv kernel connection weight.

OnnxImportConvLayerContext

Context for reconstructing one Conv layer's imported connectivity.

OnnxImportConvLayerContextBuildParams

Build params for creating one Conv reconstruction layer context.

OnnxImportConvMetadata

Parsed Conv metadata payload used for optional reconstruction pass.

OnnxImportConvNodeSlices

Layer node slices used while applying Conv reconstruction assignments.

OnnxImportConvOutputCoordinate

Coordinate for one Conv output neuron traversal position.

OnnxImportConvTensorContext

Resolved Conv initializer tensors and dimensions for one layer.

OnnxImportHiddenSizeDerivationContext

Context for deriving hidden layer sizes from initializer tensors and metadata.

OnnxImportInboundConnectionMap

Inbound connection lookup map keyed by source node for one target neuron.

OnnxImportLayerNodePair

Node slices for one sequential imported layer assignment pass.

OnnxImportLayerNodePairBuildParams

Build params for one sequential layer node-pair slice operation.

OnnxImportLayerTensorNames

Weight tensor names for one imported layer index.

OnnxImportLayerWeightBucket

Bucketed ONNX dense/per-neuron tensors for one exported layer index.

OnnxImportPerNeuronAssignmentContext

Context for assigning one per-neuron imported target node.

OnnxImportPerNeuronLayerAssignmentContext

Context for assigning per-neuron tensors for one layer.

OnnxImportWeightAssignmentBuildParams

Build params for creating shared ONNX import weight-assignment context.

OnnxImportWeightAssignmentContext

Shared weight-assignment context built once per ONNX import.

architecture/network/onnx/import/network.onnx.import-weights.utils.ts

applyAggregatedLayerWeights

applyAggregatedLayerWeights(
  aggregatedContext: OnnxImportAggregatedLayerAssignmentContext,
): void

Apply aggregated dense tensor assignments for one layer.

Parameters:

Returns: Nothing.

applyAggregatedNeuronAssignment

applyAggregatedNeuronAssignment(
  neuronContext: OnnxImportAggregatedNeuronAssignmentContext,
): void

Apply aggregated dense row weights and bias for one target neuron.

Parameters:

Returns: Nothing.

applyConvCoordinateAssignment

applyConvCoordinateAssignment(
  coordinateContext: OnnxImportConvCoordinateAssignmentContext,
): void

Apply Conv bias and kernel weights for one output coordinate.

Parameters:

Returns: Nothing.

applyConvLayerReconstruction

applyConvLayerReconstruction(
  layerContext: OnnxImportConvLayerContext,
): void

Apply Conv reconstruction for one validated Conv layer context.

Parameters:

Returns: Nothing.

applyDenseWeightAssignments

applyDenseWeightAssignments(
  assignmentContext: OnnxImportWeightAssignmentContext,
): void

Apply dense/per-neuron assignments for all sorted layer indices.

Parameters:

Returns: Nothing.

applyOptionalConvReconstruction

applyOptionalConvReconstruction(
  assignmentContext: OnnxImportWeightAssignmentContext,
): void

Apply optional Conv2D reconstruction pass from metadata payloads.

Parameters:

Returns: Nothing.

applyPerNeuronAssignment

applyPerNeuronAssignment(
  perNeuronAssignmentContext: OnnxImportPerNeuronAssignmentContext,
): void

Apply one per-neuron weight vector and bias assignment.

Parameters:

Returns: Nothing.

applyPerNeuronLayerWeights

applyPerNeuronLayerWeights(
  perNeuronContext: OnnxImportPerNeuronLayerAssignmentContext,
): void

Apply per-neuron tensor assignments for one layer.

Parameters:

Returns: Nothing.

assignConvKernelWeight

assignConvKernelWeight(
  kernelAssignmentContext: OnnxImportConvKernelAssignmentContext,
): void

Assign one Conv kernel weight to the matching inbound neuron connection.

Parameters:

Returns: Nothing.

assignLayerWeights

assignLayerWeights(
  initializerMap: Record<string, OnnxTensor>,
  nodePair: OnnxImportLayerNodePair,
): void

Assign one layer's weights using aggregated or per-neuron tensors.

Parameters:

Returns: Nothing.

assignWeightsAndBiases

assignWeightsAndBiases(
  network: default,
  onnx: OnnxModel,
  hiddenLayerSizes: number[],
  metadataProps: OnnxMetadataProperty[] | undefined,
): void

Assign weights and biases from ONNX initializers to a newly created network.

Parameters:

Returns: Nothing.

buildConvLayerContext

buildConvLayerContext(
  params: OnnxImportConvLayerContextBuildParams,
): OnnxImportConvLayerContext | null

Build one Conv layer reconstruction context.

Parameters:

Returns: Conv layer context when valid.

buildConvNeuronLinearIndex

buildConvNeuronLinearIndex(
  coordinate: OnnxImportConvOutputCoordinate,
  convSpec: Conv2DMapping,
): number

Build flattened linear index for one Conv output coordinate.

Parameters:

Returns: Linear neuron index.

buildConvNodeSlices

buildConvNodeSlices(
  layerContext: OnnxImportConvLayerContext,
): OnnxImportConvNodeSlices

Build Conv current/previous node slices for one layer context.

Parameters:

Returns: Node slice payload.

buildConvTensorContext

buildConvTensorContext(
  layerContext: OnnxImportConvLayerContext,
): OnnxImportConvTensorContext | null

Build validated Conv tensor context for one layer.

Parameters:

Returns: Conv tensor context when valid.

buildHiddenLayerSizesFromBuckets

buildHiddenLayerSizesFromBuckets(
  layerWeightBuckets: Record<string, OnnxImportLayerWeightBucket>,
  sortedLayerIndices: number[],
): number[]

Build hidden-layer sizes from weight buckets while excluding output layer.

Parameters:

Returns: Hidden-layer sizes.

buildInboundConnectionMap

buildInboundConnectionMap(
  neuronInternal: NodeInternals,
): OnnxImportInboundConnectionMap

Build inbound connection lookup map for one neuron.

Parameters:

Returns: Inbound connection map keyed by source node.

buildInitializerMap

buildInitializerMap(
  initializers: OnnxTensor[],
): Record<string, OnnxTensor>

Build ONNX initializer map keyed by tensor name.

Parameters:

Returns: Tensor map by name.

buildInputCoordinate

buildInputCoordinate(
  kernelAssignmentContext: OnnxImportConvKernelAssignmentContext,
): { inputRow: number; inputColumn: number; } | null

Build input-space coordinate for one Conv kernel element.

Parameters:

Returns: Input coordinate when in bounds.

buildInputFeatureLinearIndex

buildInputFeatureLinearIndex(
  convSpec: Conv2DMapping,
  inChannelIndex: number,
  inputRow: number,
  inputColumn: number,
): number

Build linear feature index in input feature space.

Parameters:

Returns: Linear input feature index.

buildLayerNodePair

buildLayerNodePair(
  assignmentContext: OnnxImportWeightAssignmentContext,
  params: OnnxImportLayerNodePairBuildParams,
): OnnxImportLayerNodePair

Build current/previous node slices for one sequential import layer pass.

Parameters:

Returns: Layer node pair.

buildLayerTensorNames

buildLayerTensorNames(
  layerIndex: number,
): OnnxImportLayerTensorNames

Build dense weight/bias tensor names for one layer index.

Parameters:

Returns: Layer tensor names.

buildPerNeuronTensorNames

buildPerNeuronTensorNames(
  layerIndex: number,
  neuronIndex: number,
): OnnxImportLayerTensorNames

Build per-neuron tensor names for one layer and neuron index.

Parameters:

Returns: Per-neuron tensor names.

buildWeightAssignmentContext

buildWeightAssignmentContext(
  params: OnnxImportWeightAssignmentBuildParams,
): OnnxImportWeightAssignmentContext

Build the shared assignment context for import weight restoration.

Parameters:

Returns: Shared assignment context.

collectConvKernelCoordinates

collectConvKernelCoordinates(
  inChannels: number,
  kernelHeight: number,
  kernelWidth: number,
): OnnxConvKernelCoordinate[]

Collect all kernel traversal coordinates for one Conv output position.

Parameters:

Returns: Kernel traversal coordinates.

collectConvOutputCoordinates

collectConvOutputCoordinates(
  convSpec: Conv2DMapping,
  outChannels: number,
): OnnxImportConvOutputCoordinate[]

Collect all output traversal coordinates for one Conv layer.

Parameters:

Returns: Output traversal coordinates.

collectLayerWeightBuckets

collectLayerWeightBuckets(
  initializers: OnnxTensor[],
): Record<string, OnnxImportLayerWeightBucket>

Collect ONNX weight tensor buckets grouped by export layer index.

Parameters:

Returns: Layer-weight buckets keyed by export layer index.

collectNodesByType

collectNodesByType(
  nodes: default[],
  nodeType: "input" | "output" | "hidden",
): default[]

Collect nodes by runtime node type discriminator.

Parameters:

Returns: Filtered nodes.

collectSortedLayerIndices

collectSortedLayerIndices(
  layerWeightBuckets: Record<string, OnnxImportLayerWeightBucket>,
): number[]

Collect sorted layer indices from weight buckets.

Parameters:

Returns: Ascending export layer indices.

collectSortedUniqueLayerIndices

collectSortedUniqueLayerIndices(
  initializerMap: Record<string, OnnxTensor>,
): number[]

Collect unique sorted layer indices from initializer weight tensors.

Parameters:

Returns: Unique sorted layer indices.

deriveHiddenLayerSizes

deriveHiddenLayerSizes(
  initializers: OnnxTensor[],
  metadataProps: OnnxMetadataProperty[] | undefined,
): number[]

Extract hidden layer sizes from ONNX initializers (weight tensors).

Parameters:

Returns: Hidden layer sizes in order.

hasAggregatedLayerWeights

hasAggregatedLayerWeights(
  aggregatedContext: OnnxImportAggregatedLayerAssignmentContext,
): boolean

Determine whether the layer has aggregated weight tensor data.

Parameters:

Returns: True when aggregated tensor exists.

parseConvMetadata

parseConvMetadata(
  metadataProps: OnnxMetadataProperty[],
): OnnxImportConvMetadata | null

Parse Conv reconstruction metadata payload.

Parameters:

Returns: Parsed Conv metadata.

parseLayerIndexFromWeightTensor

parseLayerIndexFromWeightTensor(
  tensorName: string,
): number | null

Parse layer index from dense/per-neuron weight tensor name.

Parameters:

Returns: Parsed layer index or null.

parseMetadataLayerSizes

parseMetadataLayerSizes(
  metadataProps: OnnxMetadataProperty[],
): number[] | null

Parse explicit metadata-driven hidden layer sizes.

Parameters:

Returns: Parsed hidden layer sizes when available.

parseWeightTensorName

parseWeightTensorName(
  tensorName: string,
): { layerIndex: string; neuronIndex: number | null; } | null

Parse layer/neuron components from a weight tensor name.

Parameters:

Returns: Parsed layer+neuron components when matched.

readConvKernelWeight

readConvKernelWeight(
  kernelAssignmentContext: OnnxImportConvKernelAssignmentContext,
): number

Read one Conv kernel weight from flattened ONNX tensor payload.

Parameters:

Returns: Kernel weight.

resolveCurrentLayerNodes

resolveCurrentLayerNodes(
  assignmentContext: OnnxImportWeightAssignmentContext,
  params: { sequentialIndex: number; },
): default[]

Resolve current layer nodes for one sequential layer assignment pass.

Parameters:

Returns: Current layer nodes.

resolveLayerHiddenSize

resolveLayerHiddenSize(
  layerWeightBuckets: Record<string, OnnxImportLayerWeightBucket>,
  layerIndex: number,
): number

Resolve one hidden-layer size from its weight bucket.

Parameters:

Returns: Hidden-layer size.

resolvePreviousLayerNodes

resolvePreviousLayerNodes(
  assignmentContext: OnnxImportWeightAssignmentContext,
  params: { sequentialIndex: number; },
): default[]

Resolve previous layer nodes for one sequential layer assignment pass.

Parameters:

Returns: Previous layer nodes.

sumHiddenSizesToIndex

sumHiddenSizesToIndex(
  hiddenLayerSizes: number[],
  exclusiveEndIndex: number,
): number

Sum hidden-layer sizes from index 0 to exclusiveEndIndex.

Parameters:

Returns: Prefix sum.

architecture/network/onnx/import/network.onnx.import-activations.utils.ts

assignActivationFunctions

assignActivationFunctions(
  network: default,
  onnx: OnnxModel,
  hiddenLayerSizes: number[],
): void

Assign node activation functions from ONNX activation nodes.

Parameters:

Returns: Nothing.

architecture/network/onnx/import/network.onnx.import-orchestrators.types.ts

Import-owned type surface for ONNX architecture reconstruction orchestration.

These payloads stay close to the orchestration helpers that parse terminal dimensions, restore recurrent self-connections, and attach pooling metadata. Keeping them here makes the import chapter explain its own execution state without forcing the root ONNX compatibility barrel to remain the ownership home for importer-only details.

NetworkWithOnnxImportPooling

Network instance augmented with optional imported ONNX pooling metadata.

OnnxImportArchitectureContext

Shared architecture extraction context with resolved graph dimensions.

OnnxImportArchitectureResult

Parsed architecture dimensions extracted from ONNX import graph payloads.

OnnxImportDimensionRecord

Loose ONNX shape-dimension record used by legacy import payload access.

OnnxImportHiddenLayerSpan

Hidden-layer span payload with one-based layer numbering and global offset.

OnnxImportLayerConnectionContext

Execution context for assigning one hidden-layer recurrent diagonal tensor.

OnnxImportPoolingMetadata

Parsed pooling metadata payload attached to imported network instances.

OnnxImportRecurrentRestorationContext

Context for recurrent self-connection restoration from ONNX metadata and tensors.

OnnxImportSelfConnectionUpsertContext

Context for upserting one hidden node self-connection from recurrent weight.

architecture/network/onnx/import/network.onnx.import-orchestrators.utils.ts

applyLayerSelfConnections

applyLayerSelfConnections(
  layerConnectionContext: OnnxImportLayerConnectionContext,
): void

Apply one hidden layer diagonal recurrent self-weights.

Parameters:

Returns: Nothing.

attachOnnxPoolingMetadata

attachOnnxPoolingMetadata(
  network: default,
  metadata: OnnxMetadataProperty[],
): void

Attach optional pooling metadata from ONNX model to network instance.

Parameters:

Returns: Nothing.

attachParsedPoolingMetadata

attachParsedPoolingMetadata(
  network: default,
  poolingMetadata: OnnxImportPoolingMetadata,
): void

Attach parsed pooling metadata to imported network instance.

Parameters:

Returns: Nothing.

buildArchitectureContext

buildArchitectureContext(
  onnx: OnnxModel,
): OnnxImportArchitectureContext

Build architecture extraction context from ONNX graph state.

Parameters:

Returns: Normalized architecture extraction context.

buildHiddenLayerSpans

buildHiddenLayerSpans(
  hiddenLayerSizes: number[],
): OnnxImportHiddenLayerSpan[]

Build hidden-layer spans with one-based layer numbering and global offsets.

Parameters:

Returns: Hidden-layer span payload list.

collectDiagonalRecurrentWeights

collectDiagonalRecurrentWeights(
  recurrentTensorWeights: number[],
  hiddenLayerSize: number,
): number[]

Collect diagonal recurrent weights from flattened layer tensor data.

Parameters:

Returns: Diagonal recurrent self-weights.

collectNodesByType

collectNodesByType(
  nodes: default[],
  nodeType: "input" | "output" | "hidden",
): default[]

Collect nodes matching one runtime node-type discriminator.

Parameters:

Returns: Filtered node list.

collectPerceptronBoundaryNodes

collectPerceptronBoundaryNodes(
  nodes: default[],
): default[]

Collect input and output boundary nodes for perceptron imports.

Parameters:

Returns: Input/output-only node list.

collectRecurrentLayerSpans

collectRecurrentLayerSpans(
  restorationContext: OnnxImportRecurrentRestorationContext,
): OnnxImportHiddenLayerSpan[]

Resolve recurrent-target hidden-layer spans from metadata + hidden sizes.

Parameters:

Returns: Hidden-layer spans requiring recurrent restoration.

extractOnnxArchitecture

extractOnnxArchitecture(
  onnx: OnnxModel,
): OnnxImportArchitectureResult

Extract input/output counts and hidden layer sizes from ONNX model.

Parameters:

Returns: Parsed architecture dimensions.

findMetadataProperty

findMetadataProperty(
  metadata: OnnxMetadataProperty[],
  metadataKey: string,
): OnnxMetadataProperty | undefined

Find one ONNX metadata property by key.

Parameters:

Returns: Matching metadata property when present.

findRecurrentInitializer

findRecurrentInitializer(
  layerConnectionContext: OnnxImportLayerConnectionContext,
): { name: string; float_data: number[]; } | undefined

Resolve recurrent initializer tensor for one hidden-layer span.

Parameters:

Returns: Recurrent initializer tensor when available.

isSingleLayerPerceptronImport

isSingleLayerPerceptronImport(
  hiddenLayerSizes: number[],
): boolean

Determine whether import shape corresponds to a single-layer perceptron.

Parameters:

Returns: True when no hidden layers exist.

normalizeRecurrentLayerIndices

normalizeRecurrentLayerIndices(
  parsedMetadataValue: string | number | boolean | number[] | Record<string, number> | null,
): number[]

Normalize recurrent layer indices parsed from metadata JSON.

Parameters:

Returns: Recurrent layer indices.

parsePoolingMetadata

parsePoolingMetadata(
  metadata: OnnxMetadataProperty[],
): OnnxImportPoolingMetadata | null

Parse pooling metadata payload from ONNX metadata.

Parameters:

Returns: Parsed pooling metadata payload.

parseRecurrentLayerIndices

parseRecurrentLayerIndices(
  rawMetadataValue: string,
): number[]

Parse recurrent layer indices metadata.

Parameters:

Returns: Normalized recurrent layer indices.

pruneSingleLayerHiddenPlaceholders

pruneSingleLayerHiddenPlaceholders(
  network: default,
  hiddenLayerSizes: number[],
): void

Remove placeholder hidden nodes for single-layer perceptron imports.

Parameters:

Returns: Nothing.

readLastDimensionValue

readLastDimensionValue(
  dimensions: { dim_value?: number | undefined; }[],
): number

Read the terminal ONNX shape dimension value from one shape array.

Parameters:

Returns: Terminal dim_value payload.

reconstructFusedRecurrentLayers

reconstructFusedRecurrentLayers(
  network: default,
  onnx: OnnxModel,
  hiddenLayerSizes: number[],
  layerFactory: OnnxLayerFactory,
  metadata: OnnxMetadataProperty[],
): void

Reconstruct emitted fused LSTM/GRU layers from ONNX metadata and initializers.

Parameters:

Returns: Nothing.

resolveRecurrentLayerIndices

resolveRecurrentLayerIndices(
  metadata: OnnxMetadataProperty[],
): number[]

Resolve recurrent layer indices from ONNX metadata.

Parameters:

Returns: Parsed recurrent layer indices.

restoreRecurrentSelfConnections

restoreRecurrentSelfConnections(
  network: default,
  onnx: OnnxModel,
  hiddenLayerSizes: number[],
  metadata: OnnxMetadataProperty[],
): void

Restore recurrent self-connections from recurrent metadata and R tensors.

Parameters:

Returns: Nothing.

sliceLayerHiddenNodes

sliceLayerHiddenNodes(
  layerConnectionContext: OnnxImportLayerConnectionContext,
): default[]

Slice hidden nodes for one hidden-layer span.

Parameters:

Returns: Hidden nodes belonging to the span.

upsertSelfConnection

upsertSelfConnection(
  selfConnectionContext: OnnxImportSelfConnectionUpsertContext,
): void

Upsert one node self-connection for recurrent import restoration.

Parameters:

Returns: Nothing.

architecture/network/onnx/import/network.onnx.import-fused-recurrent.types.ts

OnnxFusedGateApplicationContext

Gate-weight application context for one reconstructed fused layer.

OnnxFusedGateRowAssignmentContext

Context for assigning one gate-neuron row from flattened ONNX tensors.

OnnxFusedLayerNeighborhood

Hidden-layer neighborhood slices around a reconstructed fused layer.

OnnxFusedLayerReconstructionContext

Execution context for one fused recurrent layer reconstruction.

OnnxFusedLayerRuntime

Runtime interface of a reconstructed fused recurrent layer instance.

The importer only relies on a narrow runtime contract: access to the reconstructed nodes, an input wiring hook, and an optional output group that can be reconnected to the next restored layer.

OnnxFusedRecurrentKind

Supported fused recurrent operator families recognized during ONNX import.

OnnxFusedRecurrentSpec

Fused recurrent family specification used during import reconstruction.

This tells the importer how to interpret one emitted ONNX recurrent family: how many gates to expect, what order those gates were serialized in, and which gate owns the self-recurrent diagonal replay.

OnnxFusedTensorPayload

Fused recurrent tensor payload read from ONNX initializers.

The importer resolves the three recurrent tensor families up front so the reconstruction pass can focus on wiring and row assignment instead of repeatedly re-looking up initializers.

OnnxIncomingWeightAssignmentContext

Context for assigning dense incoming weights for one gate-neuron row.

architecture/network/onnx/import/network.onnx.import-fused-recurrent.utils.ts

reconstructFusedRecurrentLayers

reconstructFusedRecurrentLayers(
  network: default,
  onnx: OnnxModel,
  hiddenLayerSizes: number[],
  layerFactory: OnnxLayerFactory,
  metadata: OnnxMetadataProperty[],
): void

Reconstruct emitted fused LSTM/GRU layers from ONNX metadata and initializers.

Parameters:

Returns: Nothing.

Generated from source JSDoc • GitHub