Google Cloud ML-Engine在线预测错误:输入占位符张量的值,该值已包含在内

时间:2019-04-16 14:42:58

标签: python tensorflow google-cloud-platform tensorflow-serving google-cloud-ml

几天来我一直在遇到以下错误,但仍然无法提出解决方案:

  

InvalidArgumentError(请参见上面的回溯):您必须使用dtype float和形状[?,?,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引擎。

通过运行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或Regularization层,该模型是一个简单的seq2seq keras模型,其中包含RNN和GRUCells。

预先感谢您的帮助。

0 个答案:

没有答案
相关问题