gpt4 book ai didi

c++ - 我怎样才能只构建 TensorFlow lite 而不是从源代码构建所有 TensorFlow?

转载 作者:行者123 更新时间:2023-11-30 04:45:40 28 4
gpt4 key购买 nike

我正在尝试将 edgetpu USB 加速器与 Intel ATOM 单板计算机和 C++ API 一起用于实时推理。

edgetpu 的 C++ API 基于 TensorFlow lite C++ API。我需要包含来自 tensorflow/lite 目录的头文件(例如 tensorflow/lite/interpreter.h)。

我的问题是我能否仅使用 Lite 构建 tensorflow(不能使用其他用于训练的操作)?如果是,我该怎么做?

因为安装一切都需要很长时间。

最佳答案

假设您使用的是基于 Linux 的系统,则以下说明应该有效:

  • 克隆存储库,然后 checkout 到稳定版本(当前为 r1.14):

    git clone https://github.com/tensorflow/tensorflow
    git checkout r1.14
    cd tensorflow
  • 下载依赖:

    ./tensorflow/lite/tools/make/download_dependencies.sh
  • 构建它(默认情况下它构建一个 Linux 库,对于其他平台还有其他选项):

    make -f ./tensorflow/lite/tools/make/Makefile
  • 现在,您需要在您的项目中链接构建的库,将其添加到您的 makefile 中:

    TENSORFLOW_PATH = path/to/tensorflow/
    TFLITE_MAKE_PATH = $(TENSORFLOW_PATH)/tensorflow/lite/tools/make
    CLAGS += \
    -L$(TFLITE_MAKE_PATH)/gen/linux_x86_64/obj \
    -L$(TFLITE_MAKE_PATH)/gen/linux_x86_64/lib/ \
    -ltensorflow-lite -ldl

关于c++ - 我怎样才能只构建 TensorFlow lite 而不是从源代码构建所有 TensorFlow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57151987/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com