我希望将我的模型转换为tensorrt优化模型为tensorflow服务,但是我得到了以下错误,我怎么能固定这个?
Got a dictionary containing non-Tensor value None for key __saved_model_init_op
下面是我的保存的模型签名,我认为是签名_def['__saved_model]的问题。
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:
signature_def['__saved_model_init_op']:
The given SavedModel SignatureDef contains the following input(s):
The given SavedModel SignatureDef contains the following output(s):
outputs['__saved_model_init_op'] tensor_info:
dtype: DT_INVALID
shape: unknown_rank
name: init_1
Method name is:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['input_1'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 64, -1, 3)
name: input_1:0
The given SavedModel SignatureDef contains the following output(s):
outputs['time_distributed'] tensor_info:
dtype: DT_FLOAT
shape: (-1, -1, 7695)
name: time_distributed/Reshape_1:0
Method name is: tensorflow/serving/predict
我认为是签名_def['__saved_model_init_op']上的问题,这是未知的,我用以下方法保存了我的模型。
K.experimental.export_saved_model(model, "{}/01".format(output_path))
这可能是由我的模型中包含的tf.keras.layer.TimeDistributed层引起的。
这是我的模型中的 tensorflow问题 等待Tensorflow的更新。
在这里添加解决方案,即使它存在于 Github
赠予,以飨读者。StackOverflow
社区。
这个问题已经在 Tensorflow 2.1
,请升级您的 TensorFlow
版本为 >=2.1
详细内容请参考 此处