Open arvoelke opened 5 years ago
Here's a quick work-around that seems to do the trick (can add this to the top of your model):
# jupyter-specific: guard against this cell being re-run
if 'orig_build_chip_connection' not in locals():
orig_build_chip_connection = (
nengo_loihi.builder.connection.build_chip_connection)
def monkeypatched_build_chip_connection(model, conn):
# https://github.com/nengo/nengo-loihi/issues/230
if (isinstance(conn.pre, nengo.Ensemble)
and isinstance(conn.post, nengo.Ensemble)):
print("Forcing neuron-to-neuron: %s" % conn)
conn.solver = nengo.solvers.LstsqL2(weights=True)
return orig_build_chip_connection(model, conn)
nengo_loihi.builder.connection.build_chip_connection = (
monkeypatched_build_chip_connection)
Continuation of #74.
Setting the solver to
weights=True
can improve accuracy by avoiding the use ofDecodeNeurons
, especially in the context of recurrent connections. I can add some examples in #224 to demonstrate.One reason this is necessary is because
weights=True
can't be set on a passthrough connection. e.g., if you havex -> passthrough -> x
as in thedocs/examples/integrator_multi_d.ipynb
example. Even though thepassthrough
ends up getting removed, there's no way to signal to the backend that I'd like to have the new connection useweights=True
.This cannot be done at the config level because if the network contains a node then you get the error: