Today, we look at another machine learning software library, PyTorch. This is obviously inspired by the Torch project, with the main difference being that PyTorch is made for Python, while Torch is based in Lua. I know all the cool kids are learning Lua, but I already know Python and several other scripting languages, so the marginal utility of another one just isn’t there for me. So it’s nice to see PyTorch available in my environment of choice.

Overall, PyTorch seems pretty decent. It’s similar to TensorFlow or Theano in that it offers fine-grained control (and specification) over graph-based computations. I did encounter a bug (already reported and couldn’t get the CUDA stuff working, but that might be due to legacy hardware. I did enjoy the interactivity of the computations; you can see right away what’s inside various nodes without having to eval them all the time. This comes with a downside, however, as the “value” inside nodes doesn’t get updated unless you force it, so you could get confused about what value is supposed to be in there. Building a neural network is also unintuitive to me. It seems you have to use a Python class; I tried to work around this, but it’s built-in at a low level. I suspect this is behavior or style inherited from traditional Torch, but I’m not a fan. I strongly prefer Keras’ ability to let me muck around with a model, or TensorFlow/Theano’s generality. If I want to put those models in classes, I can, but only PyTorch seems to force me. For now, I’ll stick with Theano/Keras for regular work since they support my hardware and workflow.