Suppose I write a program in Keras for MNIST data set. I used TensorFlow as my backend in Keras. Is it possible in any way that I can extract the backend code used for TensorFlow that has been used by Keras. if yes, please provide an example.
If you are looking for a way to compile code written for the Keras API to code only using the Tensorflow API, there is no ready-to-use solution for that. And I cannot see any good reason why someone would want to do that in the first place...
You can simply look at the Keras backend source code for Tensorflow and rewrite your entire implementation. But once again I don't see any valid reason that would make this worth it.
1$\begingroup$ It might be worthwhile for deployment. It removes Keras as a dependency on production systems for instance. You would use Keras as a quick way to build and prototype different networks, then discard it for pure TensorFlow version once you had found your ideal network. However, I agree in that I don't think there's much to gain in terms of performance or deployment effort between Keras+TensorFlow vs just TensorFlow (although in older versions there was, Keras did not use TensorFlow efficiently). It is not a huge effort to build a network natively in TensorFlow anyway. $\endgroup$ Apr 7, 2017 at 11:56