Code in Python
Machine Learning and Deep Learning Blogs

Deep Learning Tensorflow vs Keras vs PyTorch

What is Deep Learning?

Deep learning is the application of artificial neural networks (ANNs) to learn tasks. These tasks contain more than one hidden layer. Deep learning is part of a broader family of machine learning. Machine learning itself is a part of Artificial Intelligence(AI). It is something like this

Artificial Intelligence > Machine Learning > Deep Learning

Machine Learning at its least is the practice of using algorithms to read data, learn from it, and then make a determination or prediction about something in the world. So instead of writing instructions for each and every task that you wish to accomplish, the machine is “trained” using large amounts of data and algorithms. This gives machines the ability to learn and perform the task.

Another algorithmic approach is Artificial Neural Networks. Neural Networks are inspired by the biology of our brain – neurons, their interconnections and transfer of response through an electric impulse. But unlike a biological brain, these artificial neural networks have discrete layers, connections, and directions of data propagation.

deep learning

In future articles, we will talk more about Machine Learning, Deep Learning, and Neural Networks. In this article, we will compare different Deep Learning Frameworks available. Machine Learning practitioners already are familiar with scikit-learn, a machine learning library with all supervised and unsupervised machine learning algorithms. One aspect where scikit-learn fails to perform is neural networks. Many tech giants like Google and Facebook have released their own deep learning libraries like Tensorflow, PyTorch, etc.


TensorFlow is an open-source software library for machine learning for a range of tasks. TensorFlow was originally developed by the Google Brain team for internal Google use before being released under the Apache 2.0 open source license on November 9, 2015. It is currently used for both research and production at Google products.

If you want to peek inside the hood, here is the Github repository


1. Community Engagement is good: A large number of developers and students are now interested in deep learning because they heard about TensorFlow. Everyone in the machine learning community is aware of TensorFlow. Most of them are open to trying it, and hopefully, there will be a lot of useful products based on this library.
2. Flexible: You need to express your computation as a data flow graph in order to use TensorFlow. The architecture of TensorFlow is highly modular. This gives the flexibility to create multiple models or multiple versions of the same model.
3. Portable: It runs on GPUs, CPUs, desktops, servers, and mobile computing platforms. You can deploy a trained model on your mobile as a part of your product. Google has announced to launch Tensorflow Lite for Android devices.
4. Performance: TensorFlow allows you to make the most of your available hardware with its advanced support for threads, asynchronous computation, and queues.


Keras is an open source neural network library written in Python. It is more of a front-end library, unlike Tensorflow which is a back-end library. It is capable of running on top of other Machine and Deep Learning libraries like MXNet, Deeplearning4j, Tensorflow, CNTK or Theano.


1. Designed to enable fast experimentation with deep neural networks
2. It focuses on being minimal, modular and extensible.
3. It presents a higher-level, more intuitive set of abstractions that make it easy to configure neural networks regardless of the backend computing library.
4. The library contains various implementations of commonly used neural network building blocks such as layers, objectives, activation functions, optimizers. It has tools to make working with image and text data easier.

People have reported that the documentation is not enough to understand Keras easily. If you wish to look under the hood. Check this Github repository.


PyTorch is in early-release Beta as of writing this article. PyTorch claims to be a deep learning framework that puts Python first. Currently, PyTorch is only available in Linux and OSX operating system. It supports three versions of Python specifically Python 2.7, 3.5 and 3.6 and is developed by these companies and universities.


Difference between PyTorch and TensorFlow

TensorFlow is built around a concept of Static Computational Graph (SCG). That means, first you define everything that is going to happen inside your framework, then you run it.

A network written in PyTorch is a Dynamic Computational Graph (DCG). It has following advantages
1. Dynamic data structures inside the network. You can have any number of inputs at any given point of training in PyTorch.
2. Networks are modular. Each part is implemented separately, and you can debug it separately.

You can explore PyTorch Github repository from this link


In the end, I would suggest that to perform supervised, semi-supervised and unsupervised learning task stick to scikit-learn. Scikit-learn has a great interface to support such algorithms. But it does not support neural networks and deep learning algorithms and this is where above-mentioned libraries come in. Even though it totally depends on you and your project to select which framework suits best. My recommendation would be Tensorflow solely because it is developed and maintained by Google and other AI related industries will adopt this in their product.
Subscribe to the newsletter and get notified when a new article drops.

If you are new to Python consider reading these articles

If you are already familiar with Python then consider these NumPy tutorials to start your Machine Learning journey.


Akarsh Singh
Follow me

Akarsh Singh

Founder, Code in Python. Web and Android App Developer. He loves Python and wants to share his knowledge via this website. Follow him on Facebook, Twitter and Github.
Akarsh Singh
Follow me

Latest posts by Akarsh Singh (see all)


  1. WЕ WILL.? They Ьoth shouted they usually raan to the bed room bickering about who ges
    to go first.

  2. I see you don’t monetize your site, don’t waste your traffic,
    you can earn additional bucks every month because you’ve got hi quality content.

    If you want to know how to make extra $$$, search for: best adsense alternative Wrastain’s tools

  3. I’ve been exploring for a little bit for any high quality
    articles or blog posts on this sort of area . Exploring in Yahoo I ultimately stumbled
    upon this site. Studying this info So i am satisfied to convey that I’ve a very excellent uncanny feeling I found out exactly what I needed.
    I such a lot surely will make certain to don?t fail to remember this site and give it a glance on a continuing basis.

  4. а где вы взяли эту инфу😉

  5. Im not that much of a online reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back later. Cheers gaacdafebadk

  6. hi!,I really like your writing so so much! proportion we communicate more about your post on AOL? I need a specialist on this space to unravel my problem. Maybe that’s you! Looking ahead to see you. bdcdebkaadad

  7. I do not even know how I stopped up here, however I assumed this put up was good. I do not recognise who you are however definitely you’re going to a wellknown blogger for those who are not already eegdadedfacb

  8. I like this post, enjoyed this one regards for putting up. The goal of revival is conformity to the image of Christ, not imitation of animals. by Richard F. Lovelace. cfegbegkbccb

  9. I like this weblog very much so much good info. It’s a poor sort of memory that only works backward. by Lewis Carroll. gkgekbkeakcafbfg

  10. I appreciate, cause I found just what I was looking for. You have ended my 4 day long hunt! God Bless you man. Have a great day. Bye aeadagbbeeekgagb

  11. Hello there! This post could not be written any better! Reading this post reminds me of my good old room mate! He always kept talking about this. I will forward this page to him. Fairly certain he will have a good read. Thank you for sharing! kkkbgdeafafg

  12. Nice post. I was checking constantly this blog and I am impressed! Extremely useful information specially the last part dccdecakedebdgbb

  13. I’m impressed, I have to admit. Seldom do I come across a blog that’s equally educative and engaging, and without a doubt, you have hit the nail on the head.
    The problem is something which too few men and women are speaking
    intelligently about. I’m very happy I stumbled across this
    in my search for something relating to this.

  14. I can’t believe how great this site is. You keep up the good work. That’s my advice pal.

  15. Just fabulous. Who wrote this and how can we get more?

  16. Have you ever considered publishing an e-book or guest authoring on other sites?

    I have a blog centered on the same topics you discuss and would love to
    have you share some stories/information. I know my viewers would value your work.
    If you’re even remotely interested, feel free to shoot me an email.

  17. I got this site from my friend who told me about this web page and at the moment this time I am browsing this web site and reading very informative articles here.

  18. I used to be able to find good information from your content.

  19. Hi. I see that you don’t update your page too often. I know
    that writing articles is boring and time consuming. But did you know
    that there is a tool that allows you to create new articles
    using existing content (from article directories or other blogs from
    your niche)? And it does it very well. The new articles are high quality and
    pass the copyscape test. You should try miftolo’s tools

  20. I got what you mean ,saved to fav, very nice internet site.

  21. Hey very interesting blog!

  22. This post provides clear idea for the new viewers of
    blogging, that really how to do running a blog.

  23. I’ve learn some excellent stuff here. Definitely value bookmarking for
    revisiting. I surprise how so much effort you put to create such a excellent
    informative site.

  24. Very good blog you have here but I was curious if
    you knew of any message boards that cover the same topics discussed in this article?
    I’d really like to be a part of online community where I can get responses from other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know. Kudos!

  25. Valuable information. Fortunate me I found your
    site accidentally, and I am stunned why this twist of fate did not happened earlier!
    I bookmarked it.

  26. fantastic issues altogether, you just gained a logo new reader.
    What could you suggest in regards to your submit that you
    made a few days ago? Any certain?

  27. Because the admin of this web page is working, no question very shortly it
    will be renowned, due to its feature contents.

  28. Just desire to say your article is as astonishing.

    The clarity for your put up is just great and
    i could assume you are an expert in this subject. Fine along with
    your permission let me to grab your feed to stay up to date with forthcoming post.
    Thanks 1,000,000 and please continue the gratifying work.

  29. Flipbooks can be customized based on requirement.

  30. The root of your writing while appearing reasonable originally, did not really work perfectly with me personally after some time. Somewhere within the paragraphs you were able to make me a believer but just for a while. I nevertheless have got a problem with your jumps in assumptions and one might do well to fill in all those gaps. When you actually can accomplish that, I will undoubtedly be fascinated.

Leave a Reply

Your email address will not be published.


© 2019 Code in Python