More or less copied from the horses mouth. Added model saving.

Conclusion: pytorch is pretty neat! Perhaps an argument for libraries over frameworks (namely TensorFlow).