首页 > 解决方案 > 为 macOS 构建 TensorFlow Lite C++ API 的正确命令是什么?

问题描述

我成功地使用了基于 macOS 的 TensorFlow Lite C++ API for Android。

现在我想在 macOS 上试用它,因为 TensorFlow Lite 支持 Metal 委托(对于 iOS?)。要知道,TensorFlow 本身在几年前就已经停止在 macOS 上支持 GPU。

为 macOS 构建 TensorFlow Lite C++ API 的正确命令是什么?

对于安卓,

bazel build -c opt --config=android_arm64 //tensorflow/lite:libtensorflowlite.so

我不知道 macOS 的配置。但我认为它应该存在,因为 tflite_runtime 包存在于 macOS 上。

谢谢你。

标签: macostensorflowtensorflow-lite

解决方案


你可以试试下面的吗?

bazel build -c opt --cpu=darwin //tensorflow/lite:libtensorflowlite.so

这将为 x86_64 macos 构建.so文件。话虽如此,Metal 委托可能不包含在最终的二进制文件中,因为 Metal 委托专门针对 iOS。


推荐阅读