nengo-loihi
nengo-loihi copied to clipboard
Calling `get_probe_output` multiple times changes result
It was discovered in #264 that calling Emulator.get_probe_output
multiple times with the same probe would give different results due to the Synapse
maintaining state across calls. A test was added to reproduce the bug, but marked as an xfail
to not hold up the PR queue (see test_multiple_get_probe_output
). It's definitely a bug that should be fixed.
Note that this DOES have an effect even if not using the interface directly (i.e. even if doing everything through nengo_loihi.Simulator
). I wasn't sure if it would. It also shows up in HardwareInterface
.
Here's an integration test that exhibits the problem (the assertion will fail):
import nengo
import nengo_loihi
import numpy as np
with nengo.Network(seed=0) as net:
u = nengo.Node(lambda t: np.sin(t))
e = nengo.Ensemble(100, 1)
ep = nengo.Probe(e, synapse=0.01)
nengo.Connection(u, e)
with nengo_loihi.Simulator(net) as sim0:
sim0.run(1.0)
with nengo_loihi.Simulator(net) as sim1:
sim1.run(0.5)
sim1.run(0.5)
assert np.array_equal(sim0.data[ep], sim1.data[ep])