Naive solution (1 line):
https://gist.github.com/applecrazy/deda2fac6e83c07b93e001731...
Edit: I literally took newlines, converted to \n in a string, and then exec()ed the whole thing. Here's a repl of it working: https://repl.it/@applecrazy/Code-Golfing-a-Neural-Net