Make it compile on compiler that don't support OpenMP.
[CRASH FIX] Use the new Theano grad interface.
Use new NumPy C-API
some pep8