Physical implementation of neural networks