Tensorflow vs PyTorch

This is something I have been asked frequently. Which should I learn? Are both required for a Data Scientist? Let's check the following benchmark I made:

Capture.PNG

Warning: This comparison is biased from my experience which is mostly with tensorflow, but there are interesting conclusions. Althought they scored similarly, there are some aspects that might weigh a bit more, here they are.

  1. According ti AssemblyAI, Historically TF has been used as the defacto framework for deep learning, but the raise of popularity for PyTorch as grown exponentially. In 2017 almost 90% of the research papers used TF. In 2021 almost 80% of the new research are made with PyTorch.

  2. Papers with Code Shows that most of the papers exposed are done with PyTorch.

  3. Althoug Tensorflow 1 was first, it was difficult to use, giving other Libraries and Frameworks a chance to shine.

  4. Companies like OpenAI have moved a lot of their internal efforts from TF to PyTorch. There are things like Reinforcement Learning that are still done in TF.

  5. According to GradietFlow, Tensorflow is the most popular framework in job postings, but I believe this is because of historical reasons. PyTorch grew 194% year-over-year in contrast to Tensorflow who grew just 23%.

  6. Most of the models ready-to-use on HuggingFace are made in PyTorch.

  7. Tensorflow has some unique features such as TFLite for mobile devices and for Javascript, allowing you to train simple models on the web. PyTorch Mobile was released in 2019 for iOS and Android devices. PyTorchLive was Facebooks's response for javascript and react-native support.

  8. Reinformcement Learning is more robust on the Tensorflow side.

I believe the final message is loud an clear. PyTorch is the future and it's becoming the new bad boy in town. Tensorflow is still widely used and supported. So, you better learn both as they will be competing.

If you are just starting, I recommend start with Tensorflow and look for the alternative PyTorch code.

Buy Me A Coffee.