Repository navigation
[Feature]: ONNX importer — replace placeholder ops with real operations, stream tensors in OnnxModelReader #1400
Description
🧠 D: DOCUMENT — Problem & Opportunity
The ONNX graph importer (OnnxImport.kt) maps several common node types to OnnxPlaceholderOperation: the graph imports, but executing it throws. Today that includes LeakyRelu, Silu and BatchNormalization (all three have real SKaiNET ops), and every unlisted type such as Clip, Pad and ConvTranspose. Separately, OnnxModelReader.loadTensor is a TODO() and its tensors/metadata maps are always empty (listed in config/stub-allowlist.txt).
Recurrent/control-flow ops (LSTM, Gather, Where, If…) are tracked in #1279 and are out of scope here.
Summary: map the remaining simple node types to real operations and make OnnxModelReader actually stream tensors.
🔍 A: ASSESS — Feasibility & Impact
- Feasibility: high for the op mappings (the SKaiNET ops exist); medium for streaming reads (
ProtobufWireReaderexists, the work is lazy offsets for initializers).
📚 R: RESEARCH — What Must Be Understood First?
- None; the ONNX operator spec is the reference: https://onnx.ai/onnx/operators/
🛠️ C: CODE — Implementation Plan
- One lane per op mapping
- Streaming
OnnxModelReader.loadTensor
Acceptance Criteria
- No
OnnxPlaceholderOperationfor the listed ops -
OnnxModelReaderreturns initializers and metadata; its entry is removed fromconfig/stub-allowlist.txt
Lane breakdown
- [Lane 2 · kotlin-core] ONNX importer — import ONNX LeakyRelu as a real op #1401 — [Lane 2 · kotlin-core] import ONNX
LeakyReluas a real op (size:xs, good first issue) - [Lane 2 · kotlin-core] ONNX importer — import ONNX Silu as a real op #1402 — [Lane 2 · kotlin-core] import ONNX
Siluas a real op (size:xs, good first issue) - [Lane 2 · kotlin-core] ONNX importer — import ONNX Clip as a real op #1403 — [Lane 2 · kotlin-core] import ONNX
Clipas a real op (size:s, good first issue) - [Lane 2 · kotlin-core] ONNX importer — import ONNX BatchNormalization as a real op #1404 — [Lane 2 · kotlin-core] import ONNX
BatchNormalizationas a real op (size:s) - [Lane 2 · kotlin-core] ONNX importer — import ONNX Pad as a real op #1405 — [Lane 2 · kotlin-core] import ONNX
Padas a real op (size:s) - [Lane 2 · kotlin-core] ONNX importer — import ONNX ConvTranspose as a real op #1406 — [Lane 2 · kotlin-core] import ONNX
ConvTransposeas a real op (size:s) - [Lane 2 · kotlin-core] ONNX importer — streaming tensor loading in OnnxModelReader #1407 — [Lane 2 · kotlin-core] streaming tensor loading in OnnxModelReader (
size:m)
Related: #1279 (LSTM, Gather, Unsqueeze/Squeeze, Cast, Where, If). Only Lane 2 applies.
New here? Read Getting started as a contributor and the Issue taxonomy. Lanes marked good first issue assume no prior SKaiNET codebase knowledge. The gap markers and the coverage matrix were introduced in #1370.
Activity