Tensorflow vs. PyTorch for research?

f3ba: <p>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.</p>
<p>Can someone pitch in their opinion on the current state of these frameworks? Which one do you think is more suitable for research?</p>

ptrblck: <p>Since you are asking this in the PyTorch forum, I would guess you could get a slightly biased answer. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"></p>
<p>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”.</p>
<p>Also, in case you get stuck somewhere you can always ask here in the discussion board.</p>

kabilan: <p>obviously pytorch (I am not <strong>biased</strong>). pytorch is famous for research. I migrated from tensorflow to pytorch.</p>

vdw: <p>Disclaimer: I am a researcher myself, probably very biased by now, and don’t know the latest version of Tensorflow.</p>
<p>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:</p>
<ul>
<li>
<p>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”.</p>
</li>
<li>
<p>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.</p>
</li>
</ul>
<p>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 :).</p>
<p>As <a class="mention" href="/u/ptrblck">@ptrblck</a> 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.</p>

Peter_Ham: <p>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.</p>

f3ba: <p>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.</p>

Huy_Ngo: <p>PyTorch. That’s a no-brainer.</p>

Emad_Elazhary: <p>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…</p>
<p>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)</p>
<p>Enjoy pytorch…</p>