{"id":597455,"date":"2023-01-14T05:49:16","date_gmt":"2023-01-14T11:49:16","guid":{"rendered":"https:\/\/news.sellorbuyhomefast.com\/index.php\/2023\/01\/14\/why-tensorflow-for-python-is-dying-a-slow-death\/"},"modified":"2023-01-14T05:49:16","modified_gmt":"2023-01-14T11:49:16","slug":"why-tensorflow-for-python-is-dying-a-slow-death","status":"publish","type":"post","link":"https:\/\/newsycanuse.com\/index.php\/2023\/01\/14\/why-tensorflow-for-python-is-dying-a-slow-death\/","title":{"rendered":"Why TensorFlow for Python is dying a slow death"},"content":{"rendered":"<div id=\"article-main-content\">\n<p>Religious wars have been a cornerstone in tech. Whether it\u2019s debating about the pros and cons of different operating systems, cloud providers, or deep learning frameworks \u2014 a few beers in, the facts slide aside and people start fighting for their technology like it\u2019s the holy grail.<\/p>\n<p>Just think about the endless talk about IDEs. Some people prefer VisualStudio, others use IntelliJ, again others use plain old editors like Vim. There\u2019s a <a href=\"https:\/\/towardsdatascience.com\/what-your-favorite-text-editor-reveals-about-your-personality-f3d4f71f88c2\" target=\"_blank\" rel=\"nofollow noopener\">never-ending debate<\/a>, half-ironic of course, about what your favorite text editor might say about your personality.<\/p>\n<p>Similar wars seem to be flaring up around PyTorch and TensorFlow. Both camps have troves of supporters. And both camps have good arguments to suggest why their favorite deep learning framework <a href=\"https:\/\/realpython.com\/pytorch-vs-tensorflow\/\" target=\"_blank\" rel=\"nofollow noopener\">might be the best<\/a>.<\/p>\n<p>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.<\/p>\n<p>On the other hand, TensorFlow hasn\u2019t been growing since around 2018. PyTorch has been steadily gaining traction until the day this post got published.<\/p>\n<p>For the sake of completeness, I\u2019ve also included Keras in the figure below. It was released at around the same time as TensorFlow. But, as one can see, it\u2019s tanked in recent years. The short explanation for this is that Keras is a bit <a href=\"https:\/\/www.simplilearn.com\/keras-vs-tensorflow-vs-pytorch-article\" target=\"_blank\" rel=\"nofollow noopener\">simplistic and too slow<\/a> for the demands that most deep learning practitioners have.<\/p>\n<figure><img decoding=\"async\" loading=\"lazy\" alt=\"Graph showing percentage of StackOverflow tagged TensorFlow, Keras, and PyTorch over time\" width=\"1390\" height=\"942\"  src=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2023\/01\/Screenshot-2023-01-13-at-2.32.32-PM.png\" srcset=\"https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2023\/01\/Screenshot-2023-01-13-at-2.32.32-PM.png 1390w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2023\/01\/Screenshot-2023-01-13-at-2.32.32-PM-280x190.png 280w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2023\/01\/Screenshot-2023-01-13-at-2.32.32-PM-199x135.png 199w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2023\/01\/Screenshot-2023-01-13-at-2.32.32-PM-398x270.png 398w, https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2023\/01\/Screenshot-2023-01-13-at-2.32.32-PM-796x539.png 796w\" ><figcaption>PyTorch is still growing, while TensorFlow\u2019s growth has stalled. Graph from <a href=\"https:\/\/insights.stackoverflow.com\/trends?tags=pytorch%2Ctensorflow%2Ckeras\" target=\"_blank\" rel=\"nofollow noopener\">StackOverflow trends<\/a>.<\/figcaption><\/figure>\n<p>StackOverflow traffic for TensorFlow might not be declining at a rapid speed, but it\u2019s declining nevertheless. And there are reasons to believe that this decline will become more pronounced in the next few years, particularly in the world of <a href=\"https:\/\/thenextweb.com\/topic\/python\" target=\"_blank\" rel=\"noopener\">Python<\/a>.<\/p>\n<h2>PyTorch feels more pythonic<\/h2>\n<p>Developed by Google, TensorFlow might have been one of the first frameworks to show up to the deep learning party in late 2015. However, the first version was rather cumbersome to use \u2014 as many first versions of any software tend to be.<\/p>\n<p>That is why Meta started developing PyTorch as a means to offer pretty much the same functionalities as TensorFlow, but making it easier to use.<\/p>\n<p>The people behind TensorFlow soon took note of this, and adopted many of PyTorch\u2019s most popular features in TensorFlow 2.0.<\/p>\n<p>A good rule of thumb is that you can do anything that PyTorch does in TensorFlow. It will just take you twice as much effort to write the code. It\u2019s not so intuitive and feels quite un-pythonic, even today.<\/p>\n<p>PyTorch, on the other hand, feels very natural to use if you enjoy using Python.<\/p>\n<h2>PyTorch has more available models<\/h2>\n<p>Many companies and academic institutions don\u2019t have the massive computational power needed to build large models. Size is king, however, when it comes to machine learning; the larger the model the more impressive its performance is.<\/p>\n<p>With <a href=\"https:\/\/huggingface.co\/\" target=\"_blank\" rel=\"nofollow noopener\">HuggingFace<\/a>, engineers can use large, trained and tuned models and incorporate them in their pipelines with just a few lines of code. However, a staggering 85% of these models can <a href=\"https:\/\/www.assemblyai.com\/blog\/pytorch-vs-tensorflow-in-2023\/\" target=\"_blank\" rel=\"nofollow noopener\">only be used with PyTorch<\/a>. Only about 8% of HuggingFace models are exclusive to TensorFlow. The remainder is available for both frameworks.<\/p>\n<p>This means that if you\u2019re planning to use large models, you\u2019d better stay away from TensorFlow or invest heavily in compute resources to train your own model.<\/p>\n<h2>PyTorch is better for students and research<\/h2>\n<p>PyTorch has a reputation for being appreciated more by academia. This is not unjustified; three out of four research papers use PyTorch. Even among those researchers who started out using TensorFlow \u2014 remember that it arrived earlier to the deep learning party \u2014 the majority have migrated to PyTorch now.<\/p>\n<p>These trends are staggering and persist despite the fact that Google has quite a large footprint in AI research and mainly uses TensorFlow.<\/p>\n<p>What\u2019s perhaps more striking about this is that research influences teaching, and therefore defines what students might learn. A professor who has published the majority of their papers using PyTorch will be more inclined to use it in lectures. Not only are they more comfortable teaching and answering questions regarding PyTorch; they might also have stronger beliefs regarding its success.<\/p>\n<p>College students therefore might get much more insights about PyTorch than TensorFlow. And, given that the college students of today are the workers of tomorrow, you can probably guess where this trend is going\u2026<\/p>\n<h2>PyTorch\u2019s ecosystem has grown faster<\/h2>\n<p>At the end of the day, software frameworks only matter insofar as they\u2019re players in an ecosystem. Both PyTorch and TensorFlow have quite developed ecosystems, including repositories for trained models other than HuggingFace, data management systems, failure prevention mechanisms, and more.<\/p>\n<p>It\u2019s worth stating that, as of now, TensorFlow has a <a href=\"https:\/\/www.assemblyai.com\/blog\/pytorch-vs-tensorflow-in-2023\/\" target=\"_blank\" rel=\"nofollow noopener\">slightly more developed<\/a> ecosystem than PyTorch. However, keep in mind that PyTorch has shown up later to the party and has had quite some user growth over the past few years. Therefore one can expect that PyTorch\u2019s ecosystem might outgrow TensorFlow\u2019s in due time.<\/p>\n<h2>TensorFlow has the better deployment infrastructure<\/h2>\n<p>As cumbersome as TensorFlow might be to code, once it\u2019s written is a lot easier to deploy than PyTorch. Tools like TensorFlow Serving and TensorFlow Lite make deployment to cloud, servers, mobile, and IoT devices happen in a jiffy.<\/p>\n<p>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.<\/p>\n<p>It\u2019s hard to predict at this point in time, but it\u2019s quite possible that PyTorch might match or even outgrow TensorFlow\u2019s deployment infrastructure in the years to come.<\/p>\n<p>TensorFlow code will probably stick around for a while because it\u2019s costly to switch frameworks after deployment. However, it\u2019s quite conceivable that newer deep learning applications will increasingly be written and deployed with PyTorch.<\/p>\n<h2>TensorFlow is not all about Python<\/h2>\n<p>TensorFlow isn\u2019t dead. It\u2019s just not as popular as it once was.<\/p>\n<p>The core reason for this is that many people who use Python for machine learning are switching to PyTorch.<\/p>\n<p>But Python is not the only language out there for machine learning. It\u2019s the O.G. of machine learning, and that\u2019s the only reason why the <a href=\"https:\/\/thenextweb.com\/topic\/software-developer\" target=\"_blank\" rel=\"noopener\">developers<\/a> of TensorFlow centered its support around Python.<\/p>\n<p>These days, <a href=\"https:\/\/www.tensorflow.org\/api_docs\" target=\"_blank\" rel=\"nofollow noopener\">one can use<\/a> TensorFlow with JavaScript, Java, and C++. The community is also starting to develop support for other languages like Julia, Rust, Scala, and Haskell, among others.<\/p>\n<p>PyTorch, on the other hand, is very centered around Python \u2014 that\u2019s why it feels so pythonic after all. <a href=\"https:\/\/pytorch.org\/cppdocs\/\" target=\"_blank\" rel=\"nofollow noopener\">There is a C++ API<\/a>, but there isn\u2019t half the support for other languages that TensorFlow offers.<\/p>\n<p>It\u2019s quite conceivable that PyTorch will overtake TensorFlow within Python. On the other hand, TensorFlow, with its impressive ecosystem, deployment features, and support for other languages, will remain an important player in deep learning.<\/p>\n<p>Whether you choose TensorFlow or PyTorch for your next project depends mostly on how much you love Python.<\/p>\n<p><em>This article was written by Ari Joury and was originally published on Medium. You can read it <a href=\"https:\/\/levelup.gitconnected.com\/why-tensorflow-for-python-is-dying-a-slow-death-ba4dafcb37e6\" target=\"_blank\" rel=\"nofollow noopener\">here<\/a>. <\/em><\/p>\n<\/p><\/div>\n<p><a href=\"https:\/\/thenextweb.com\/news\/why-tensorflow-for-python-is-dying-a-slow-death\" class=\"button purchase\" rel=\"nofollow noopener\" target=\"_blank\">Read More<\/a><br \/>\n Ari Joury<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Religious wars have been a cornerstone in tech. Whether it\u2019s debating about the pros and cons of different operating systems, cloud providers, or deep learning frameworks \u2014 a few beers in, the facts slide aside and people start fighting for their technology like it\u2019s the holy grail. Just think about the endless talk about IDEs.<\/p>\n","protected":false},"author":1,"featured_media":597456,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32994,46,96794],"tags":[],"class_list":["post-597455","post","type-post","status-publish","format-standard","has-post-thumbnail","category-python","category-technology","category-tensorflow"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/posts\/597455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/comments?post=597455"}],"version-history":[{"count":0,"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/posts\/597455\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/media\/597456"}],"wp:attachment":[{"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/media?parent=597455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/categories?post=597455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/newsycanuse.com\/index.php\/wp-json\/wp\/v2\/tags?post=597455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}