Tensorflow vs. PyTorch for research?

I intend to use one of these frameworks for research purposes, where I will be writing many custom training loops, playing with the network architecture a lot, and I need a lot of flexibility. I have seen many comparisons on the web with the usual conclusion that PyTorch is more suitable for research because it is better designed and is more flexible, but these articles are usually from before Tensorflow 2.0 came out.

Can someone pitch in their opinion on the current state of these frameworks? Which one do you think is more suitable for research?

Since you are asking this in the PyTorch forum, I would guess you could get a slightly biased answer. :wink:

That being said, I would recommend to look at some tutorials for both frameworks, play around with your architectures, look for examples of similar work you are planning to do, etc. and just pick what “feels better”.

Also, in case you get stuck somewhere you can always ask here in the discussion board.

3 Likes

obviously pytorch (I am not biased). pytorch is famous for research. I migrated from tensorflow to pytorch.

Disclaimer: I am a researcher myself, probably very biased by now, and don’t know the latest version of Tensorflow.

I actually first tried Tensorflow when I (had to) get started with Deep Learning. I’m not a hardcore DL/ML/AI researcher, but use it in a more applied fashion mainly in the context if NLP. However, once I tried PyTorch, I quickly switched and had so far no reason to look back. Two simple reasons, obviously very subjective:

  • I find the usability/readability of PyTorch much more intuitive. It just writes more like normal Python/numpy compared to the Tensorflows session concept. Sometimes I still have to look at Tensorflow code – for example, when I’m looking for an implementation of an architecture I’ve found in an paper – and the code just looks more “bloated”.

  • At least back then (I’m not very up to date), Tensorflow might have had the two advantages of having a better performance and be able to deplyed across different platforms including mobile devices. But for me as a researcher, these were/are non-issues.

In short, In need to implement and test networks quickly. Hence, I’m absolutely on team PyTorch. But then again, some colleagues are happy with Tensorflow, and I’m not trying to convert them :).

As @ptrblck mentioned, just go through some tutorials for both frameworks (and maybe others?), and see what feels “right” for you. I’d just argue that for research readability/usability beats things like (slightly) better performance etc. any day of the week.

2 Likes

Pytorch hands down. If you have compared some of the repos implementing the same algorithm using pytorch and tensorflow, you would find that the lines of code using tensorflow is usually much larger than if you use pytorch.

1 Like

Going through some tutorials is what I’m trying to do. However I’ve found the Tensorflow 2 documentation not very well organized. I now started following the PyTorch docs and they feel much better organized.

1 Like

PyTorch. That’s a no-brainer.

2 Likes

I’m a convert from tensorflow… Pytorch is easier to work with, the community is geeting larger and the examples on github are much more…

TensorFlow is great, however with the changes in its api all projects on github (the ones u usually learn from) suddenly became obsolete (or at least un-understandable to the newcomer)

Enjoy pytorch…

1 Like