Probe weights with Loihi simulator


With Loihi simulator , Im getting the below error when trying to probe weight values from the connection. However this is not the case with nengo core simulator. Is there any workaround for obtaining the weight values?


with nengo.Network(label="A Single Neuron") as model:
    neuron = nengo.Ensemble(
        dimensions=1,  # Represent a scalar
        # Set intercept to 0.5
        intercepts=Uniform(-0.5, -0.5),
        # Set the maximum firing rate of the neuron to 100hz
        max_rates=Uniform(100, 100),
        # Set the neuron's firing rate to increase for positive input
        # neuron_type=nengo_loihi.neurons.LoihiLIF()

    cos = nengo.Node(lambda t: np.cos(8 * t))
    # Connect the input signal to the neuron
    con = nengo.Connection(cos, neuron,synapse=None)
    # The original input
    cos_probe = nengo.Probe(cos)
    # The raw spikes from the neuron
    spikes = nengo.Probe(neuron.neurons)
    # Subthreshold soma voltage of the neuron
    voltage = nengo.Probe(neuron.neurons, "voltage")
    # Spikes filtered by a 10ms post-synaptic filter
    filtered = nengo.Probe(neuron, synapse=0.01)
    wt = nengo.Probe(con,"output",synapse=0)

Error =>

nengo.exceptions.BuildError: Object (<Connection at 0x7f2e984745c0 from <Node (unlabeled) at 0x7f2e98474550> to <Ensemble (unlabeled) at 0x7f2e984744a8>>) is not a part of the network

It is currently not possible to probe weights with NengoLoihi, because we haven’t implemented a way to get the weights off the chip each timestep.

If you’re interested in getting weights with the Loihi simulator only (i.e. not an actual Loihi board), then you might want to look at hacking in something to store a copy of the weights in a global variable somewhere, probably around this line where we update the weights.

If you’re interested in doing it on an actual Loihi board, then you either need to use NxSDK to get the weights at the end of the run (if you’re only interested in the final weight values), or write a custom SNIP to get the weight values each timestep (if you’re interested in the intermediary weights, too).