Commit 3b39644
Add spyx.experimental.onnx: ONNX export of spiking step functions
to_onnx(model, input_shape, *, batch, dtype, opset, sequence_length) -> bytes
exports a spiking model's single-timestep (x, state) -> (out, new_state) forward to
an ONNX ModelProto via jax2tf -> tf2onnx. ONNX reaches phones (ONNX Runtime Mobile,
NNAPI/CoreML), servers, and edge from one export. tensorflow/tf2onnx imported lazily
(module imports without them; 'pip install tensorflow tf2onnx onnx onnxruntime' to
convert); NOT a declared extra, so the lock/Python-3.14 stay clean.
- Verified: the onnxruntime output matches the JAX single step (out + every new-state
tensor) at atol/rtol 1e-4 (zero and nonzero state).
- Honest limitation: full-sequence export (sequence_length=T, an ONNX Scan/Loop of the
whole time loop) does NOT convert here — jax2tf emits a StableHLO XlaCallModule that
tf2onnx's TF-graph importer can't parse. Documented, test skipped (not faked). Per-
step export + an external loop is the shipped capability (same shape as LiteRT).
Experimental / unstable API. Third export leg alongside NIR (neuromorphic) and LiteRT.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 3202e91 commit 3b39644
3 files changed
Lines changed: 538 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
34 | | - | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
0 commit comments