使用 cmake 构建 TensorFlow Lite 图像分类时出现未定义的参考错误

问题描述 投票:0回答:1

我正在尝试编译 TensorFlow lite 代码,并为 C++ 图像分类演示启用 XNNPACK 委托。

我发现可以用 bazel 构建它。但是,我想知道如何用 cmake 构建它。

如果我禁用 XNNPACK,它就可以工作。

cmake -DTFLITE_ENABLE_XNNPACK=OFF ../tensorflow/lite
cmake --build . -j -t label_image

但是如果我启用 XNNPACK,它会给我未定义的参考错误。

cmake -DTFLITE_ENABLE_XNNPACK=ON ../tensorflow/lite
cmake --build . -j -t label_image

错误信息如下所示。

[ 95%] Building CXX object examples/label_image/CMakeFiles/label_image.dir/__/__/tools/tool_params.cc.o
[100%] Linking CXX executable label_image
CMakeFiles/label_image.dir/__/__/tools/evaluation/utils.cc.o: In function `tflite::evaluation::CreateXNNPACKDelegate(TfLiteXNNPackDelegateOptions const*)':
utils.cc:(.text+0x9ce): undefined reference to `TfLiteXnnpackDelegatePluginCApi'
collect2: error: ld returned 1 exit status
examples/label_image/CMakeFiles/label_image.dir/build.make:370: recipe for target 'examples/label_image/label_image' failed
make[3]: *** [examples/label_image/label_image] Error 1
CMakeFiles/Makefile2:6488: recipe for target 'examples/label_image/CMakeFiles/label_image.dir/all' failed
make[2]: *** [examples/label_image/CMakeFiles/label_image.dir/all] Error 2
CMakeFiles/Makefile2:6495: recipe for target 'examples/label_image/CMakeFiles/label_image.dir/rule' failed
make[1]: *** [examples/label_image/CMakeFiles/label_image.dir/rule] Error 2
Makefile:2262: recipe for target 'label_image' failed
make: *** [label_image] Error 2

有谁知道如何使用 cmake 在 TensorFlow Lite 图像分类中启用 XNNPACK?

谢谢你

tensorflow compiler-errors delegates tensorflow-lite
1个回答
0
投票

如果(TFLITE_ENABLE_XNNPACK) 列表(附加 TFLITE_LABEL_IMAGE_SRCS ${TFLITE_SOURCE_DIR}/tools/delegates/xnnpack_delegate_provider.cc ) 列表(附加 TFLITE_LABEL_IMAGE_SRCS ${TFLITE_SOURCE_DIR}/core/acceleration/configuration/c/xnnpack_plugin.cc ) 别的() 设置(TFLITE_LABEL_IMAGE_CC_OPTIONS“-DTFLITE_WITHOUT_XNNPACK”) endif() # TFLITE_ENABLE_XNNPACK

© www.soinside.com 2019 - 2024. All rights reserved.