![](/img/trans.png)
[英]How to fix: on Android TensorFlow Lite inference is much slower than standard TensorFlow inference
[英]How to fix this module 'tensorflow' has no attribute 'lite'?
我從https://www.tensorflow.org/lite/convert/python_api復制了代碼,在運行代碼時,它給了我這個錯誤模塊'tensorflow'沒有屬性'lite'
我還沒有看過任何可以解決我問題的教程,所以想在這里問是否有人可以幫助我解決我的問題
這是從tensorflow lite官方文檔復制的代碼,當我嘗試運行它時,它給我這個錯誤``模塊'tensorflow'沒有屬性'lite'''
import tensorflow as tf
img = tf.placeholder(name="img", dtype=tf.float32, shape=(1, 64, 64, 3))
var = tf.get_variable("weights", dtype=tf.float32, shape=(1, 64, 64, 3))
val = img + var
out = tf.identity(val, name="out")
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
converter = tf.lite.TFLiteConverter.from_session(sess, [img], [out])
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
很抱歉給您帶來不便,您可以通過每晚下載來解決。
編輯:或使用tf.contrib.lite也應該起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.