Update NeuralNetwork.py

Appeared (by grad checking) that the additional layers were not being computed correctly. A corrected and more thoroughly checked version is posted here