Unable to deploy a Cloud ML model

拟墨画扇 提交于 2019-12-23 18:34:27

问题


Why I try to deploy my trained model to Google Cloud ML, I get the following error:

Create Version failed.Model validation failed: Model metagraph does not have inputs collection.

What does this mean and how to get around this?


回答1:


The Tensorflow model deployed on CloudML did not have a collection named “inputs”. This collection should name all the input tensors for your graph. Similarly, a collection named “outputs” is required to name the output tensors for your graph. Assuming your graph has two input tensors x and y, and one output tensor scores, this can be done as follows:

tf.add_to_collection(“inputs”, json.dumps({“x” : x.name, “y”: y.name}))
tf.add_to_collection(“outputs”, json.dumps({“scores”: scores.name}))

Here “x”, “y” and “scores” become aliases to the actual tensor names (x.name, y.name and scores.name)



来源:https://stackoverflow.com/questions/39781946/unable-to-deploy-a-cloud-ml-model

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