snntorch
Use snnTorch to build spiking neuron models, encode data into spikes, train with surrogate gradients, plot spike tensors, export/import NIR graphs, and maintain legacy spikevision workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- snntorch
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use snnTorch to build spiking neuron models, encode data into spikes, train with surrogate gradients, plot spike tensors, export/import NIR graphs, and maintain legacy spikevision workflows.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/install-and-import.md1.8 KB
- 参考文档references/repo-provenance.md944 B
- 参考文档references/repo-routing-metadata.json347 B
- 参考文档references/troubleshooting.md4.2 KB
- 参考文档references/workflows.md2.7 KB
- 脚本scripts/stack_smoke.py3.6 KB
03 SKILL.md 正文
snnTorch
Use this skill when a task touches the snntorch package: stateful spiking neurons, spike encoders, surrogate gradients, training helpers, plotting, NIR exchange, or legacy neuromorphic datasets.
Install and import check
Read Install and import for the package-level install matrix. For a quick smoke test, run:
pip install snntorch
python -c "import snntorch as snn; print(snn.__version__)"
python scripts/stack_smoke.py
If you need the broader stack for plotting, NIR, or legacy dataset workflows, add the optional dependencies described in that reference.
Route by task
- Build, combine, or debug neuron and layer workflows, hidden-state ownership, reset semantics, recurrent cells, BNTT, or
GradedSpikes->core-neurons - Convert raw tensors or labels into spikes, choose surrogate gradients, compute losses or accuracies, inspect monitors, run backprop wrappers, or use STDP ->
encoding-training - Export supported models to NIR or import NIR graphs back into snnTorch ->
nir-interoperability - Plot rasters, spike counts, traces, or animations ->
plotting - Use the legacy
spikevisiondataset wrappers or migrate old neuromorphic dataset code ->spikevision
Common starting points
- If the model returns the wrong number of values, states leak across batches, or
nn.Sequentialbreaks on tuple outputs, start withcore-neurons. - If the task starts with tensors or labels and ends with spike codes, a loss, or a training step, start with
encoding-training. - If
export_to_nirorimport_from_nirfails with type inference or graph-shape errors, start withnir-interoperability. - If plotting fails in a headless environment or
spike_countlabels behave oddly, start withplotting. - If an old tutorial or repo script uses
snntorch.spikevision, treat it as legacy and start withspikevision; new work should use Tonic instead.
Shared references
- Install and import
- Workflow map
- Cross-cutting troubleshooting
- Repository provenance
- Routing metadata
scripts/stack_smoke.py
Boundaries
This skill is a runtime router, not a maintainer guide. It does not cover release engineering, CI, packaging automation, or repo-specific development tasks. Keep the generated guidance self-contained inside this skill tree and use the sub-skills for workflow depth.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).