本文主要是介绍tflite micro makefile and test,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Makefile
怎么控制的target
target 控制的是target相关的功能如:
打印log的方法,timer的方法等
lite/micro/stm32f4/debug_log.cc
extern "C" void DebugLog(const char* s) {
asm("mov r0, #0x04\n" // SYS_WRITE0
"mov r1, %[str]\n"
"bkpt #0xAB\n"
:
: [ str ] "r"(s)
: "r0", "r1");
}
如果要编译运行在target: stm32f4上的image, 应该怎么控制能编译到这个文件?
怎么控制的kernel 优化
以Register_DEPTHWISE_CONV_2D的实现为例: 多个优化kernel下都有同名文件:depthwise_conv.cc 且kernel根目录下是个通用的文件, 且文件中都实现了
TfLiteRegistration Register_DEPTHWISE_CONV_2D() 这样可以看出是通过编译那个具体的文件控制的 和target 的控制方法一样
➜ micro git:(V2.4.2) ✗ find ./ -name depthwise_conv.cc
./kernels/depthwise_conv.cc
./kernels/arc_mli/depthwise_conv.cc
./kernels/xtensa_hifimini/depthwise_conv.cc
./kernels/xtensa_hifi/depthwise_conv.cc
./kernels/cmsis-nn/depthwise_conv.cc
./kernels/vexriscv/depthwise_conv.cc
./kernels/depthwise_conv.cc:315:TfLiteRegistration Register_DEPTHWISE_CONV_2D() {
./kernels/arc_mli/depthwise_conv.cc:517:TfLiteRegistration Register_DEPTHWISE_CONV_2D() {
./kernels/xtensa_hifimini/depthwise_conv.cc:492:TfLiteRegistration Register_DEPTHWISE_CONV_2D() {
./kernels/xtensa_hifi/depthwise_conv.cc:529:TfLiteRegistration Register_DEPTHWISE_CONV_2D() {
Binary file ./kernels/xtensa_hifi/.depthwise_conv.cc.swp matches
./kernels/depthwise_conv_test.cc:50: const TfLiteRegistration registration = Register_DEPTHWISE_CONV_2D();
./kernels/micro_ops.h:35:TfLiteRegistration Register_DEPTHWISE_CONV_2D();
./kernels/cmsis-nn/depthwise_conv.cc:464:TfLiteRegistration Register_DEPTHWISE_CONV_2D() {
./kernels/vexriscv/depthwise_conv.cc:514:TfLiteRegistration Register_DEPTHWISE_CONV_2D() {
这篇关于tflite micro makefile and test的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!