NengoDL to probe

Hello, I’m using NengoDL in the NengoGUI to integrate a tensorflow model and train within Nengo. For training, I have:

def on_start(sim):
    sim.compile(loss={net.en_arm_probe: tf.keras.losses.MeanSquaredError}){net.en_arm_probe: net.target_arm_probe}, verbose=0, n_steps=1000)

where net.en_arm_probe is probing the output of my Tensorflow network (TensorNode), and net.target_arm_probe is probing a target (true) y value, which changes as the simulation runs.

This gives AttributeError: 'Probe' object has no attribute 'shape' at From the documentation, it’s clear that is expecting a tensor, not a nengo.Probe or nengo.Node. But I don’t know these y values in advance, they are generated during the simulation, so I wanted to probe the y values as I simulate. Is this possible? I want to do a mean squared error loss between two probes while the simulation is running; one probe is the TensorNode output, and the other is the target tensornode output.

Hi @Luciano,

TensorFlow (i.e., the backend that NengoDL uses to do is designed primarily for off-line training of networks. For this use case, the training data is typically known before the training process is started, and does not change during the training process. From your description:

It looks like what you’ll want is to use an online training algorithm. If you are using NengoDL to run your simulation, you can implement such an algorithm with the built in Nengo learning rules (e.g., the PES learning rule, example here). This learning rule won’t run during the call, but you can run it using (or if you are using NengoGUI, by pressing the play button).

Another approach to this problem (if you don’t want to use something like the PES learning rule) is to do on your network once to generate the output and target outputs. Then, use the probed data as training data and do a second training pass.