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

cnwbcb6i  于 2023-08-06  发布在  其他
关注(0)|答案(1)|浏览(118)

我正在尝试为C++ image classification demo启用XNNPACK委托来编译TensorFlow lite代码。
我看到它是可能建立与巴泽尔。但是,我想知道如何用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


有人知道如何在TensorFlow Lite图像分类中使用cmake启用XNNPACK吗?
谢谢你的好意

2ul0zpep

2ul0zpep1#

if(TFLITE_ENABLE_XNNPACK)
  list(APPEND TFLITE_LABEL_IMAGE_SRCS
    ${TFLITE_SOURCE_DIR}/tools/delegates/xnnpack_delegate_provider.cc
  )
  list(APPEND TFLITE_LABEL_IMAGE_SRCS
    ${TFLITE_SOURCE_DIR}/core/acceleration/configuration/c/xnnpack_plugin.cc
  )
else()
  set(TFLITE_LABEL_IMAGE_CC_OPTIONS "-DTFLITE_WITHOUT_XNNPACK")
endif()  # TFLITE_ENABLE_XNNPACK

字符串

相关问题