Training of neural networks