Keras is a high level neural network API providing python library which uses tensor flow or theano or cntk as backend. What are the primary roles of backend libraries? Is it implementation? or Is it computational heavylifting using GPU, threading etc?

I couldn't find any good resources online to understand how keras interacts with tensor flow or theano(backend) session. Any such resource or direction for understanding interaction is helpful !


1 Answer 1


Keras is a high level API but the backend is readily available. You simply access it by doing:

from keras import backend as K

The K will then be the same as tf as if you imported Tensorflow like this:

import tensorflow as tf

So you can use K to perform lower level operations with the backend.

For more information you can read the Keras backend documentation.

  • $\begingroup$ Thanks for the backend documentation ! As stated in link "it relies on a specialized, well optimized tensor manipulation library to do so, serving as the "backend engine" of Keras". Is it safe to say backend's, for example, implements logic of Conv2D computationally optimal? $\endgroup$
    – Genie
    Commented May 8, 2019 at 8:40
  • $\begingroup$ Few things are optimal. But for things like Conv2D I think Keras uses the backend more or less directly. So if it is fast in the backend then it will be fast in Keras too. $\endgroup$ Commented May 8, 2019 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.