| 18 | |
| 19 | |
| 20 | class SpikeModule(nn.Module): |
| 21 | |
| 22 | def __init__(self, module): |
| 23 | super().__init__() |
| 24 | self.ann_module = module |
| 25 | |
| 26 | def forward(self, x): |
| 27 | B, T, *spatial_dims = x.shape |
| 28 | out = self.ann_module(x.reshape(B * T, *spatial_dims)) |
| 29 | BT, *spatial_dims = out.shape |
| 30 | out = out.view(B, T, *spatial_dims).contiguous() |
| 31 | return out |
| 32 | |
| 33 | |
| 34 | def fire_function(gamma): |