c++ - Tensorflow Lite arm64 错误 : cannot convert ‘const int8x8_t?

标签 c++ c tensorflow artificial-intelligence tensorflow-lite

我尝试在 ubuntu 16.04 上构建 AARCH64。我遵循了本指南(本地编译)https://tensorflow.google.cn/lite/guide/build_arm64 .

但是我得到了这个错误。 什么是问题? 我也想在 Orange Pi 3 上尝试示例。 在为 arm64 构建后如何使用 libtensorflow-lite.a 文件。我知道 Qt ide 和 C&C++。 谢谢。

In file included from ./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h:22:0,
                 from tensorflow/lite/kernels/depthwise_conv.cc:29:
./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h: In static member function ‘static void tflite::optimized_ops::depthwise_conv::WorkspacePrefetchWrite<(tflite::DepthwiseConvImplementation)3>::Run(int8, int, int8*)’:
./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:5782:71: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts
       vst1_lane_u32(reinterpret_cast<uint32_t*>(ptr), fill_data_vec, 0);
                                                                       ^
./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:5782:71: error: cannot convert ‘const int8x8_t {aka const __vector(8) signed char}’ to ‘uint32x2_t {aka __vector(2) unsigned int}’ for argument ‘2’ to ‘void vst1_lane_u32(uint32_t*, uint32x2_t, int)’
./tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h:5785:35: error: cannot convert ‘const int8x8_t {aka const __vector(8) signed char}’ to ‘uint32x2_t {aka __vector(2) unsigned int}’ for argument ‘2’ to ‘void vst1_lane_u32(uint32_t*, uint32x2_t, int)’
                   fill_data_vec, 0);
                                   ^
tensorflow/lite/tools/make/Makefile:225: recipe for target '/tensorflow/tensorflow/lite/tools/make/gen/aarch64_armv8-a/obj/tensorflow/lite/kernels/depthwise_conv.o' failed
make: *** [/tensorflow/tensorflow/lite/tools/make/gen/aarch64_armv8-a/obj/tensorflow/lite/kernels/depthwise_conv.o] Error 1
make: *** Waiting for unfinished jobs....

最佳答案

在尝试解决问题数小时后,我想我找到了解决方案:

只需将“-flax-vector-conversions”参数添加到 tensorflow/lite/tools/make/Makefile 文件中的 CXXFLAGS 变量即可。

对我来说是第 58 行:

CXXFLAGS := -O3 -DNDEBUG -fPIC -flax-vector-conversions

之前的错误消失了,但现在我得到了另一个错误:

undefined reference to `shm_open'

之后,我在 tensorflow/lite/tools/make/targets/aarch64_makefile.inc 添加了“-lrt”

LIBS := \
-lstdc++ \
-lpthread \
-lm \
-ldl \
-lrt

并将 Makefile 中的 BUILD_WITH_NNAPI 更改为 false

编译过程有效。 我会尽快测试TF库。

关于c++ - Tensorflow Lite arm64 错误 : cannot convert ‘const int8x8_t?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56055359/

相关文章:

c++ - 如何使用 TBB 多线程 "tail call"递归

c++ - 通过 USB 编程访问多个网络摄像头

mysql - 如何在 C 中返回 SELECT COUNT 的值

c - 为结构体中的成员生成随机数

python - 将 tensorflow.contrib 与 cv_bridge 一起使用会导致 tcmalloc 错误

C++11 Setter 函数参数传递 nullptr

c++ - 跨平台编译和安装程序

c - 如何在其他文件中包含的 C 函数中使用全局变量

python - 无法构建模型,因为 backend.squeeze 没有层

Tensorflow - 总变异损失 - reduce_sum vs reduce_mean?