-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.py
34 lines (24 loc) · 1.31 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import torch
import torch.nn as nn
from spikingjelly.activation_based import layer
from spikingjelly.activation_based import surrogate, neuron
import modules
class SHD_STSC(nn.Module):
def __init__(self):
super().__init__()
time_rf_conv = 5
time_rf_at = 3
self.fc = nn.Sequential(
modules.STSC(700,dimension=2,time_rf_conv=time_rf_conv, time_rf_at=time_rf_at, use_gate=True, use_filter=True),
layer.Linear(700,128),
neuron.LIFNode(tau=10.0, decay_input=False, v_threshold=0.3, surrogate_function=surrogate.ATan(), detach_reset=True),
# modules.STSC(128,dimension=2,time_rf_conv=time_rf_conv, time_rf_at=time_rf_at, use_gate=True, use_filter=True),
layer.Linear(128,128),
neuron.LIFNode(tau=10.0, decay_input=False, v_threshold=0.3, surrogate_function=surrogate.ATan(), detach_reset=True),
# modules.STSC(128,dimension=2,time_rf_conv=time_rf_conv, time_rf_at=time_rf_at, use_gate=True, use_filter=True),
layer.Linear(128,100),
neuron.LIFNode(tau=10.0, decay_input=False, v_threshold=0.3, surrogate_function=surrogate.ATan(), detach_reset=True),
layer.VotingLayer(5)
)
def forward(self, x: torch.Tensor):
return self.fc(x)