Updated nntrainer.py and nntrainer_test.py to fix gradient accuracy.

Still buggy, does not compute gradient correctly.