title: keras: theano.function is slower as compared to a model.predict()
body: <p>I have trained a recurrent neural network ( RNN ). For profiling the attention weights, I need 2 output from the trained network ( one at the final layer and one at an intermediate layer ).</p>
  
  <p>Since <code>model.predict()</code>  gives its output from only the last layer, I wrote a theano function to fetch an output at both the intermediate layer and the final layer.</p>
  
  <p>It works fine, but it is <strong>almost 20 times slower</strong> as compared to the <strong><code>model.predict()</code></strong>.</p>
  
  <p>Can anybody help me to understand <strong>why</strong> the theano function is slower and <strong>how</strong> can I make it faster?</p>