[sparse] convert to sparse before any use in sparse test. (#3337)

pull/3346/head
Peiming Liu 2024-05-14 09:10:36 -07:00 committed by GitHub
parent 73b3065a94
commit 8e74d64e8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -583,8 +583,8 @@ def test_sparse_network():
for t in range(T):
mem = mem * self.decay + X[..., t]
spike = self.act(mem - self.thresh)
mem = mem * (1.0 - spike)
spike = spike.to_sparse().to_dense() # prop hack
mem = mem * (1.0 - spike)
spike_pot.append(spike)
spike_pot = torch.stack(spike_pot, dim=-1)
return spike_pot