【发布时间】:2019-10-02 07:34:49
【问题描述】:
我已经成功创建了一个 TensorFlow 模型,通过自定义操作保存为 SavedModel .pb 格式。
我的问题是我无法使用命令行实用程序或 python API 将其转换为精简版
我的 python API 是:
import tensorflow as tf
import os
import custom_op
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
converter = tf.lite.TFLiteConverter.from_saved_model("./SavedModel")
converter.target_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,
tf.lite.OpsSet.SELECT_TF_OPS]
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
但转换失败并出现错误:
ValueError: Provide an input shape for input array 'X'.
我假设是因为我的占位符没有形状类型。我不明白为什么普通的 TensorFlow 模型没有它。
有什么帮助吗?
【问题讨论】:
标签: tensorflow tensorflow-lite