Big deep learning news: Google Tensorflow chooses Keras


Rachel Thomas


January 3, 2017

Buried in a Reddit comment, Francois Chollet, author of Keras and AI researcher at Google, made an exciting announcement: Keras will be the first high-level library added to core TensorFlow at Google, which will effectively make it TensorFlow’s default API. This is excellent news for a number of reasons!

As background, Keras is a high-level Python neural networks library that runs on top of either TensorFlow or Theano. There are other high level Python neural networks libraries that can be used on top of TensorFlow, such as TF-Slim, although these are less developed and not part of core TensorFlow.

Using TensorFlow makes me feel like I’m not smart enough to use TensorFlow; whereas using Keras makes me feel like neural networks are easier than I realized. This is because TensorFlow’s API is verbose and confusing, and because Keras has the most thoughtfully designed, expressive API I’ve ever experienced. I was too embarrassed to publicly criticize TensorFlow after my first few frustrating interactions with it. It felt so clunky and unnatural, but surely this was my failing. However, Keras and Theano confirm my suspicions that tensors and neural networks don’t have to be so painful. (In addition, in part 2 of our deep learning course Jeremy will be showing some tricks to make it easier to write custom code in Tensorflow.)

For a college assignment, I once used a hardware description language to code division by adding and shifting bits in the CPU’s registers. It was an interesting exercise, but I certainly wouldn’t want to code a neural network this way. There are a number of advantages to using a higher level language: quicker coding, fewer bugs, and less pain. The benefits of Keras go beyond this: it is so well-suited to the concepts of neural networks, that Keras has improved how Jeremy and I think about neural networks and facilitated new discoveries. Keras makes me better at neural networks, because the language abstractions match up so well with neural network concepts.

Writing programs in the same conceptual language that I’m thinking in allows me to focus my attention on the problems I’m trying to solve, and not on artifacts of the programming language. When most of my mental energy is spent converting between the abstractions in my head and the abstractions of the language, my thinking becomes slower and fuzzier. TensorFlow effects my productivity in a similar way that having to code in Assembly would effect my productivity.

As Chollet wrote, “If you want a high-level object-oriented TF API to use for the long term, Keras is the way to go.” And I am thrilled about this news.

Note: For our Practical Deep Learning for Coders course, we used Keras and Theano. For Practical Deep Learning for Coders Part 2, we plan to use Keras and TensorFlow. We prefer Theano over TensorFlow, because Theano is more elegant and doesn’t make scope super annoying. Unfortunately, only TensorFlow supports some of the things we want to teach in part 2.

UPDATE: I drafted this post last week. After publishing, I saw on Twitter that Francois Chollet had announced the integration of Keras into TensorFlow a few hours earlier.