python - Google Cloud ML-Engine 在线预测错误:为已包含的占位符张量提供值
问题描述
我这几天一直面临以下错误,但仍然无法提出解决方案:
InvalidArgumentError(有关回溯,请参见上文):您必须为占位符张量“decoder_input”提供一个 dtype float 和 shape [?,?,1] 的值
[[节点decoder_input(定义在/Users/me/Downloads/google-cloud-sdk/lib/third_party/ml_sdk/cloud/ml/prediction/frameworks/tf_prediction_lib.py:210)]]
(错误代码:2)
我训练了我的tf.keras.Model
(Python 3.6,Tensorflow 1.13.1)并将其成功导出到 Google Cloud ML-engine。
通过运行saved_model_cli show --all --dir=trainer/predict-dir/1552642125
我得到:
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['decoder_input'] tensor_info:
dtype: DT_FLOAT
shape: (-1, -1, 1)
name: decoder_input_1:0
inputs['encoder_input'] tensor_info:
dtype: DT_FLOAT
shape: (-1, -1, 1)
name: encoder_input_1:0
The given SavedModel SignatureDef contains the following output(s):
outputs['reg_sequence_prediction'] tensor_info:
dtype: DT_FLOAT
shape: (-1, -1, 1)
name: reg_sequence_prediction/BiasAdd:0
Method name is: tensorflow/serving/predict
我的instances.json
文件是:
{"decoder_input": [[0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0]], "encoder_input": [[-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672], [-1.1672]]}
如您所见,我包含了两个必要的输入值,但我仍然收到相同的错误。
我没有包含任何 Dropout 或正则化层,该模型是一个简单的 seq2seq keras 模型,带有 RNN 和 GRUCells。
预先感谢您的帮助。
解决方案
推荐阅读
- sql - jpa postgres - 查询结果与文本字段上的类似
- python-3.x - 应用程序之间的文件传输
- google-apps-script - 尝试在驱动器文件夹中列出 pdf 文件时出现“在对象测试中找不到函数 getFiles”错误
- npm - 如何提供 npm 脚本的使用信息
- c# - 将平移按钮添加到 C# WinForm eDrawings 查看器
- sed - 使用 sed(或其他命令行程序)删除每隔 X 行
- sql-server - 如何远程检查两个 SQL 数据行是否相同,而不在服务器之间发送所有数据?
- c# - 如何在控制台应用程序中使用实体框架从数据库中填充 html 字段?
- javascript - 当我遍历一个对象时,为什么我的数组没有按应有的方式更新?Javascript
- eiffel - 在 Eiffel 中使用循环初始化数组