【问题标题】:module 'tensorflow._api.v2.lite' has no attribute 'TFliteConverter'模块“tensorflow._api.v2.lite”没有属性“TFliteConverter”
【发布时间】:2022-01-12 16:13:14
【问题描述】:

我正在尝试将 tensorflow 模型转换为 tensorflowlite 模型

converter =tf.lite.TFliteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
tflite_model = converter.convert()
open(tflite_model_name + '.tflite', 'wb').write(tflite_model)

但我收到错误“模块'tensorflow._api.v2.lite'没有属性'TFliteConverter'” 是因为我在模型中使用了 LSTM?

【问题讨论】:

    标签: tensorflow tensorflow-lite


    【解决方案1】:

    您的代码有错字。 converter = tf.lite.TFLiteConverter.from_keras_model(model) 而不是 converter =tf.lite.TFliteConverter.from_keras_model(model)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-24
      • 2020-10-03
      • 2021-10-08
      • 2021-03-25
      • 1970-01-01
      • 2020-07-30
      • 1970-01-01
      相关资源
      最近更新 更多