summaryrefslogtreecommitdiff
path: root/neurobench_testing/examples/gsc/SNN.py
diff options
context:
space:
mode:
authorTanner Robison <[email protected]>2026-06-17 18:14:20 -0700
committerTanner Robison <[email protected]>2026-06-17 22:05:02 -0700
commit3b87b8bd271ade1622149516ae14f94b7ff20dd5 (patch)
treea715ff83c167238b6152fd380cdfa5cf1086d70f /neurobench_testing/examples/gsc/SNN.py
parent190b63c9e25770a52f9b93f4a6267c2bc21c3cfc (diff)
neurobench & memtorch
Diffstat (limited to 'neurobench_testing/examples/gsc/SNN.py')
-rw-r--r--neurobench_testing/examples/gsc/SNN.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/neurobench_testing/examples/gsc/SNN.py b/neurobench_testing/examples/gsc/SNN.py
new file mode 100644
index 0000000..1642e28
--- /dev/null
+++ b/neurobench_testing/examples/gsc/SNN.py
@@ -0,0 +1,17 @@
+from torch import nn
+import snntorch as snn
+from snntorch import surrogate
+
+beta = 0.9
+spike_grad = surrogate.fast_sigmoid()
+net = nn.Sequential(
+ nn.Flatten(),
+ nn.Linear(20, 256),
+ snn.Leaky(beta=beta, spike_grad=spike_grad, init_hidden=True),
+ nn.Linear(256, 256),
+ snn.Leaky(beta=beta, spike_grad=spike_grad, init_hidden=True),
+ nn.Linear(256, 256),
+ snn.Leaky(beta=beta, spike_grad=spike_grad, init_hidden=True),
+ nn.Linear(256, 35),
+ snn.Leaky(beta=beta, spike_grad=spike_grad, init_hidden=True, output=True),
+) \ No newline at end of file