Keras on Google ML Engine error: You must feed a value for placeholder tensor

故事扮演 提交于 2019-12-25 02:29:14

问题


I have deployed a model on Google Cloud ML Engine, but when I try to perform a prediction (I'm using curl), this is the result I obtain:

{"error": "Prediction failed: Error during model execution: AbortionError(code=StatusCode.INVALID_ARGUMENT, details=\"You must feed a value for placeholder tensor 'lstm_1/keras_learning_phase' with dtype bool\n\t [[Node: lstm_1/keras_learning_phase = Placeholder[dtype=DT_BOOL, shape=[], _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"]()]]\")"}

How exactly can I set the value of this placeholder tensor? Is it on the json? Is it something that has to be done during training? As many suggestions said, I tried setting K.set_learning_phase(0) but didnt work.

Thanks


回答1:


Let me guess - your model has batch normalization layers, right? :)

As many suggestions said, I tried setting K.set_learning_phase(0) but didnt work.

Indeed - I happened to have the same problem a couple of days ago; the solution is to set

K.set_learning_phase(0)

before initializing (or loading) your model - if you do it later in the script, the said error keeps poping up...



来源:https://stackoverflow.com/questions/52151309/keras-on-google-ml-engine-error-you-must-feed-a-value-for-placeholder-tensor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!