Tensorflow Lite ARM64错误:无法转换‘const int8x8_t
Tensorflow Lite arm64 error: cannot convert ‘const int8x8_t?
我尝试在Ubuntu 16.04上构建Aarch64。我遵循了本指南(本地化合物(https://tensorflow.google.cn/lite/guide/build_arm64。
但是我有这个错误。有什么问题?我也想在橙色PI 3上尝试示例。如何在ARM64构建后使用libtensorflow-lite.一个文件。我知道QT IDE和C&amp 。谢谢。
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....
尝试解决问题几个小时后,我认为我找到了一个解决方案:
只需在tensorflow/lite/lite/tools/make/makefile文件中添加" -flax-vector-conversions"参数。
对我来说,它在第58行中:
CXXFLAGS := -O3 -DNDEBUG -fPIC -flax-vector-conversions
上一个错误已经消失,但是现在我有其他错误:
undefined reference to `shm_open'
之后,我将" -lrt"添加到tensorflow/lite/lite/tools/make/targets/aarch64_makefile.inc
LIBS :=
-lstdc++
-lpthread
-lm
-ldl
-lrt
和更改 build_with_nnapi 在 false
中编译过程有效。我将尽快测试TF库。
构建ARM64的TensorFlow Lite,我修改了:
tensorflow/lite/tools/make/targets/aarch64_makefile.inc
通过添加CXXFLAG和CFLAGS:
-flax-vector-conversions
-fomit-frame-pointer
给出:
CXXFLAGS +=
-march=armv8-a
-funsafe-math-optimizations
-ftree-vectorize
-flax-vector-conversions
-fomit-frame-pointer
-fPIC
CFLAGS +=
-march=armv8-a
-funsafe-math-optimizations
-ftree-vectorize
-flax-vector-conversions
-fomit-frame-pointer
-fPIC
对我来说,这消除了error: cannot convert
以及error: x29 cannot be used in asm here
。
我可以构建libtensorflow-lite.a
。
构建示例应用程序时,来自教程的命令仍然给我一个错误
https://github.com/tensorflow/tensorflow/issues/28863
如果您想从指南中使用docker容器,则作为旁注:
https://tensorflow.google.cn/lite/guide/build_arm64
它建议使用tensorflow/tensorflow:nightly-devel
,该CC_5根据Docker Hub目前为6个月的图像(绝对不是每晚(:
https://hub.docker.com/r/tensorflow/tensorflow/tags/?page=1
从同一链接中,您可以找到一个最近的devel
容器,在我的情况下,我使用了devel-py3
我在aarch64上构建TensorFlow-1.14时也遇到了类似的问题。我使用了此PR中建议的更改,并解决了此问题。
在linux_aarch64系统上解决以下两个问题:
- 禁止向量之间的转换
- 禁止在ASM中明确使用框架指针寄存器x29
在tensorflow/lite/build_def.bzl
的def tflite_copts()
中添加以下情况
str(Label("//tensorflow:linux_aarch64")): [
"-flax-vector-conversions",
"-fomit-frame-pointer",
],