You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run Spaun in direct mode (just for benchmarking, I don't care whether the behaviour is replicated), but I am getting an exception. I didn't look into Spaun itself for the cause of this problem, but I have a minimal example that at least gives the similar exception.
Running this will work fine. Yes, there might be a division by 0 and the output may be way off, but it will run because the network is just producing spikes, filtering them, and multiplying them with some weights. No actual division is performed. But when I switch the first ensemble to direct mode like this:
e1.neuron_type=nengo.Direct()
This exception will be produced when running because an actual divison by 0 is performed which feeds nan values to the neuron code:
FloatingPointError Traceback (most recent call last)
<ipython-input-52-83cea7b88218> in <module>()
1 with nengo.Simulator(model) as sim:
----> 2 sim.run(1.)
/home/jgosmann/.pyenv/versions/3.5.2/lib/python3.5/site-packages/nengo/simulator.py in run(self, time_in_seconds, progress_bar)
259 logger.info("Running %s for %f seconds, or %d steps",
260 self.model.label, time_in_seconds, steps)
--> 261 self.run_steps(steps, progress_bar=progress_bar)
262
263 def run_steps(self, steps, progress_bar=True):
/home/jgosmann/.pyenv/versions/3.5.2/lib/python3.5/site-packages/nengo/simulator.py in run_steps(self, steps, progress_bar)
279 with ProgressTracker(steps, progress_bar) as progress:
280 for i in range(steps):
--> 281 self.step()
282 progress.step()
283
/home/jgosmann/.pyenv/versions/3.5.2/lib/python3.5/site-packages/nengo/simulator.py in step(self)
290 try:
291 for step_fn in self._steps:
--> 292 step_fn()
293 finally:
294 np.seterr(**old_err)
/home/jgosmann/.pyenv/versions/3.5.2/lib/python3.5/site-packages/nengo/builder/neurons.py in step_simneurons()
66
67 def step_simneurons():
---> 68 self.neurons.step_math(dt, J, output, *states)
69 return step_simneurons
70
/home/jgosmann/.pyenv/versions/3.5.2/lib/python3.5/site-packages/nengo/neurons.py in step_math(self, dt, J, spiked, voltage, refractory_time)
319 # set v(0) = 1 and solve for t to compute the spike time
320 t_spike = dt + self.tau_rc * np.log1p(
--> 321 -(voltage[spiked_mask] - 1) / (J[spiked_mask] - 1))
322
323 # set spiked voltages to zero, refractory times to tau_ref, and
FloatingPointError: invalid value encountered in true_divide
I think we should handle this more gracefully. But I'm not sure whether to convert all nan values in direct mode to some fixed number or provide an option to do that. Also note, that the exception right now is not helpful in providing a pointer what the actual problem is.
The text was updated successfully, but these errors were encountered:
I'm trying to run Spaun in direct mode (just for benchmarking, I don't care whether the behaviour is replicated), but I am getting an exception. I didn't look into Spaun itself for the cause of this problem, but I have a minimal example that at least gives the similar exception.
Consider this network:
Running this will work fine. Yes, there might be a division by 0 and the output may be way off, but it will run because the network is just producing spikes, filtering them, and multiplying them with some weights. No actual division is performed. But when I switch the first ensemble to direct mode like this:
This exception will be produced when running because an actual divison by 0 is performed which feeds
nan
values to the neuron code:I think we should handle this more gracefully. But I'm not sure whether to convert all
nan
values in direct mode to some fixed number or provide an option to do that. Also note, that the exception right now is not helpful in providing a pointer what the actual problem is.The text was updated successfully, but these errors were encountered: