Training SNN by STDP

For me i switched to Nengo recently but in my old simulator that i use, i record all the spikes at the last layer for every input (digit in MNIST for example) and assign class to each neuron based on the max number of spikes, and the other spikes in the other classes are considered as loss. Sum all the losses and i get the global loss value.