Keras: is compile really necessary when we predict using a pretrained model?

Created on 26 Jun 2016  路  2Comments  路  Source: keras-team/keras

I search a result from stackoverflow:

http://stackoverflow.com/questions/33474424/keras-load-weights-of-a-neural-network-error-when-predicting

it says you must compile before predict,but in my current keras version,I remove the compile code block,and then also get a good predict result.

from my opinion,when we predict ,we just do forward-propogation rather than back-propogation,so we dont need know what the loss is and how the loss is comprised of.so for a better architecture design,we shouldnt need "compile".

so finally,i want to confirm whether we need "complie" before we "predict"??yes or no

Most helpful comment

Since this commit https://github.com/fchollet/keras/commit/d8864bfe48d64c15dc70f13e46c7e08772811fd9 or keras version 1.0.3 it is no longer necessary to compile the model to use predict.

All 2 comments

Since this commit https://github.com/fchollet/keras/commit/d8864bfe48d64c15dc70f13e46c7e08772811fd9 or keras version 1.0.3 it is no longer necessary to compile the model to use predict.

I read that to profile keras (and TF) I need to enable trace for TF session as shown here. But, after this (https://github.com/keras-team/keras/issues/3074), compile is not necessary for calling predict. I am not sure how to pass run_metadata options for timeline. can you please help?

Was this page helpful?
0 / 5 - 0 ratings