我有一个保存的模型,我设法加载,运行并获得1行9个特征的预测。(输入)现在我试图预测100行这样的行,但是当尝试从Tensor.copyTo()读取结果数组时,我得到了不兼容的形状
java.lang.IllegalArgumentException: cannot copy Tensor with shape [1, 1] into object with shape [100, 1]
显然,我设法在循环中运行了这个预测 - 但这比一次运行100的等效python执行慢20倍。
这里是 /saved_model_cli.py 报告的已保存模型信息
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['input'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 9)
name: dense_1_input:0
The given SavedModel SignatureDef contains the following output(s):
outputs['output'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 1)
name: dense_4/BiasAdd:0
Method name is: tensorflow/serving/predict
问题是 - 我是否需要为我想预测的每一行运行(),就像这里的问题一样
catspeake
相关分类