Religious wars have been a cornerstone in tech.

Just think about the endless talk about IDEs.

Some people prefer VisualStudio, others use IntelliJ, again others use plain old editors like Vim.

Why TensorFlow for Python is dying a slow death

Theres anever-ending debate, half-ironic of course, about what your favorite text editor might say about your personality.

Similar wars seem to be flaring up around PyTorch and TensorFlow.

Both camps have troves of supporters.

Graph showing percentage of StackOverflow tagged TensorFlow, Keras, and PyTorch over time

And both camps have good arguments to suggest why their favorite deep learning frameworkmight be the best.

That being said, the data speaks a fairly simple truth.

TensorFlow is, as of now, the most widespread deep learning framework.

It gets almost twice as many questions on StackOverflow every month as PyTorch does.

On the other hand, TensorFlow hasnt been growing since around 2018.

PyTorch has been steadily gaining traction until the day this post got published.

For the sake of completeness, Ive also included Keras in the figure below.

It was released at around the same time as TensorFlow.

But, as one can see, its tanked in recent years.

StackOverflow traffic for TensorFlow might not be declining at a rapid speed, but its declining nevertheless.

A good rule of thumb is that you’re free to do anything that PyTorch does in TensorFlow.

It will just take you twice as much effort to write the code.

Its not so intuitive and feels quite un-pythonic, even today.

PyTorch, on the other hand, feels very natural to use if you enjoy using Python.

However, a staggering 85% of these models canonly be used with PyTorch.

Only about 8% of HuggingFace models are exclusive to TensorFlow.

The remainder is available for both frameworks.

PyTorch is better for students and research

PyTorch has a reputation for being appreciated more by academia.

This is not unjustified; three out of four research papers use PyTorch.

Whats perhaps more striking about this is that research influences teaching, and therefore defines what students might learn.

College students therefore might get much more insights about PyTorch than TensorFlow.

Its worth stating that, as of now, TensorFlow has aslightly more developedecosystem than PyTorch.

Therefore one can expect that PyTorchs ecosystem might outgrow TensorFlows in due time.

PyTorch, on the other hand, has been notoriously slow in releasing deployment tools.

That being said, it has been closing the gap with TensorFlow quite rapidly as of late.

TensorFlow code will probably stick around for a while because its costly to switch frameworks after deployment.

However, its quite conceivable that newer deep learning applications will increasingly be written and deployed with PyTorch.

TensorFlow is not all about Python

TensorFlow isnt dead.

Its just not as popular as it once was.

The core reason for this is that many people who use Python for machine learning are switching to PyTorch.

But Python is not the only language out there for machine learning.

of machine learning, and thats the only reason why thedevelopersof TensorFlow centered its support around Python.

These days,one can useTensorFlow with JavaScript, Java, and C++.

Its quite conceivable that PyTorch will overtake TensorFlow within Python.

Whether you choose TensorFlow or PyTorch for your next project depends mostly on how much you love Python.

This article was written by Ari Joury and was originally published on Medium.

you’re able to read ithere.

Also tagged with