Originally, tensorflow and pytorch had a fundamental difference:
- tensorflow is based on a computional graph. Building this graph and evaluating it in a session are two separate steps. While it is being used, the graph doesn't change, which allows for optimizations.
- torch eagerly evaluates operations on a tensor. This makes the API more convenient (no sessions) but also looses the potential to recognize and optimize operations that always occur in sequence.
Now this difference is becoming less clear. Tensorflow has answered to the popularity of torch with tf eager. There is also the JAX project, which builds on the same underlying framework as tensorflow (XLA). JAX has no concept of a session. But it allows you to compile multiple operations together by simply calling jit.
Since Tensorflow has moved to cover PyTorch functionality, is PyTorch also working on integrating Tensorflow advantages? Is there something like a session or jit functionality in PyTorch (or on its roadmap) ?
The API docs have a jit section, but as far as I can see, that is more about exporting your models.