TensorFlow Lite GPU 对 Python 的支持

Joh*_* M. 10 machine-learning tensorflow tensorflow-lite

有人知道 Tensorflow Lite 是否支持 Python 的 GPU 吗?我看过 Android 和 iOS 的指南,但我没有遇到任何关于 Python 的内容。如果tensorflow-gpu安装并tensorflow.lite.python.interpreter导入,GPU会自动使用吗?

小智 -1

您可以强制计算在 GPU 上进行:

import tensorflow as tf
with tf.device('/gpu:0'):
   for i in range(10):
         t = np.random.randint(len(x_test) )
         ...
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助。

  • 但我正在尝试在 GPU 上运行“tensorflow.lite.python.interpreter”。如果我将其包装在“tf.device”下,我不会得到任何 GPU 活动。 (2认同)