Skip to content

ONNX importer: LSTM, Gather, Unsqueeze/Squeeze, Cast, Where, If (Silero VAD import as the gate) #1279

Description

@michalharakal

Context

skainet-io-onnx's graph importer (OnnxImport.kt) handles Add, BatchNormalization, Concat, Conv, Div, Gemm, LeakyRelu, MatMul, MaxPool, Mul, Relu, Reshape, Resize, Sigmoid, Silu, Slice, Softmax, Split, Sub, Transpose, Upsample — the YOLO-shaped set from #230. Recurrent and control-flow nodes are absent, so common small audio/speech graphs (Silero VAD, RNN-T prediction nets, NeMo exports) cannot be imported even though the DSL has Lstm (#823) and gather.

This is the verification path for the native Silero VAD issue: importing the upstream graph and comparing against the hand-written module catches drift in either.

Scope

  • LSTM (ONNX opset ≥ 7 semantics: W, R, B layouts, initial_h/initial_c, direction=forward first; bidirectional as a follow-up) lowered onto Lstm.step unrolled over the sequence axis.
  • Gather, Unsqueeze, Squeeze, Cast, Where, Shape/ConstantOfShape as needed by the Silero graph.
  • If with constant-foldable conditions (Silero's sample-rate branch) — fold at import when the condition is an initializer, reject otherwise with a clear message rather than silently importing one branch.
  • Import test on the pinned silero_vad.onnx: graph builds, forward matches ORT golden within 1e-4 (same golden as the native Silero issue).
  • Ground-truth coverage for the new ops (Ground truth: expand Python-side op coverage to match OperationExecutor #985).

Acceptance

  • OnnxLoader imports Silero VAD end to end without hand edits to the file.
  • Each new converter has a unit test with a minimal one-node graph.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions