【发布时间】:2020-05-14 01:03:33
【问题描述】:
我正在尝试使用 C-API 运行 SavedModel。
在运行 TF_SessionRun 时,它总是在各种输入节点上失败并出现相同的错误。
TF_SessionRun status: 3:Input to reshape is a tensor with 6 values, but the requested shape has 36
TF_SessionRun status: 3:Input to reshape is a tensor with 19 values, but the requested shape has 361
TF_SessionRun status: 3:Input to reshape is a tensor with 3111 values, but the requested shape has 9678321
...
可以看出,请求的形状值的数量始终是预期输入大小的平方。这很奇怪。
模型在saved_model_cli 命令下运行良好。
输入都是标量 DT_STRING 或 DT_FLOAT,我不进行图像识别。
这是该命令的输出:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['f1'] tensor_info:
dtype: DT_STRING
shape: (-1)
name: f1:0
inputs['f2'] tensor_info:
dtype: DT_STRING
shape: (-1)
name: f2:0
inputs['f3'] tensor_info:
dtype: DT_STRING
shape: (-1)
name: f3:0
inputs['f4'] tensor_info:
dtype: DT_FLOAT
shape: (-1)
name: f4:0
inputs['f5'] tensor_info:
dtype: DT_STRING
shape: (-1)
name: f5:0
The given SavedModel SignatureDef contains the following output(s):
outputs['o1_probs'] tensor_info:
dtype: DT_DOUBLE
shape: (-1, 2)
name: output_probs:0
outputs['o1_values'] tensor_info:
dtype: DT_STRING
shape: (-1, 2)
name: output_labels:0
outputs['predicted_o1'] tensor_info:
dtype: DT_STRING
shape: (-1, 1)
name: output_class:0
Method name is: tensorflow/serving/predict
非常感谢任何有关正在发生的事情的线索。 saved_model.pb 文件来自 AutoML,我的代码只是查询该模型。我不改变图表。
【问题讨论】:
标签: tensorflow predict c-api