Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there a reason for choosing PyTorch over tensorflow?


TF is pretty much dead. The examples often do not work, the docs are not up to date and I don't think any recent paper/projects use TF so you'll also find a better community and better resources around Pytorch.


Yes, many. At this point you should be asking the question whether there's ever a reason to choose tensorflow at all.


Tensorflow was also riddled with bugs, which worsened after Keras was made as default. Things didn't work as expected even in some regular cases.

I switched to Pytorch after I encountered this bug in a very normal use case back in v1.13 https://colab.research.google.com/drive/1D-kgD7NiRXTNTNwVr18...

I've never encountered such a bug in Pytorch in the last 4-5 years.


Back when I worked on that stuff, Pytorch was a joy to use and TF was a pain. I remember Pytorch code being easier to understand and debug.

As a researcher, Pytorch was also much easier to tinker with, which is perhaps a factor that explains why it rapidly gained popularity in academia.


Debugging is a lot easier in PyTorch. Although you can debug the compiled graph in Tensorflow, from experience, the local state might not be the same in debug mode as in compiled mode.

Also, I've encountered strange performance regression issues with the newest Docker releases of Tensorflow, with 10x slow-downs compared to previous minor releases. And the docker version was always slower than the local version. Something something Nvidia & CUDA I guess. I had not performance differences with PyTorch when using docker.

It should be said that Tensorflow was generally 10 to 20% faster for similar models. But that could be down to my ineptitude.


I thought tensorflow was dead and PyTorch the new king.


One reason is that overall there are more PyTorch based ML projects out there, which translates to larger exploration space and wider support base. Around the beginning of 2021 PyTorch overtook TensorFlow as the ML framework of choice, see https://trends.google.com/trends/explore?date=today%205-y&q=...


If you add keras to the mix it seems to be the most popular of all https://trends.google.com/trends/explore?date=today%205-y&q=...


PyTorch has a very good record of backwards compatibility compared to Tensorflow; your code is much less likely to be broken/deprecated if you use PyTorch.


PyTorch has taken over the field w.r.t. popularity. TF unfortunately isn't that popular outside of Google


On mobile devices, specifically Android, there are some benefits. Also, in the embedded/tinyml space.


That was a valid question ... in 2018


Pytorch is both faster in terms of performance and ease of development.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: