Posts

Showing posts with the label ANN

Timings and Code for Spiking Neural Networks with JAX

Image
 I've been encouraged to flesh out my earlier posts about JAX to support  27DaysOfJAX . I've written simulations of a Leaky Integrate and Fire Neuron in *Plowman's* (pure) Python, Python + numpy, and Python + JAX. Here's a plot of a 2000-step simulation for a single neuron: Plot for a single neuron The speedups using Python, Jax and the JAX jit compiler are dramatic. Pure Python can simulate a single step for a single neuron in roughly 0.25 µs. so 1,000,000 neurons would take about 0.25 seconds. numpy can simulate a single step for 1,000,000 neurons in 13.7 ms . Python, JAX + JAX's jit compilation can simulate a single step for 1,000,000 neurons in 75 µs . Here's the core code for each version. # Pure Python def step(v, tr, injected_current): spiking = False if tr > 0: next_v = reset_voltage tr = tr - 1 elif v > threshold: next_v = reset_voltage tr = int(refactory_period / dt) spiking = True else...

Training ANNs on the Raspberry Pi 4 and Jetson Nano

Image
There have been several benchmarks published comparing performance of the Raspberry Pi and Jetson Nano. They suggest there is little to chose between them when running Deep Learning tasks. I'm sure the results have been accurately reported, but I found them surprising. Don't get me wrong. I love the Pi 4, and am very happy with the two I've been using. The Pi 4 is significantly faster than its predecessors, but... The Jetson Nano has a powerful GPU that's optimised for many of the operations used by Artificial Neural Networks (ANNs). I'd expect the Nano to significantly outperform the Pi running ANNs. How can this be? I think I've identified reasons for the surprising results. At least one benchmark appears to have tested the Nano in 5W power mode. I'm not 100% certain, as the author has not responded to several enquiries, but the article talks about the difficulty in finding a 4A USB supply. That suggests that the author is not entirely...