Hello, I have some issues in compiling my project with arduino tensorflow lite library.
I can define some of the variables, but if I try to call class methos, or create class instance it just won’t compile.
Here is my code:
#undef min
#undef max
#include "TensorFlowLite.h"
#include "tensorflow/lite/experimental/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/experimental/micro/kernels/micro_ops.h"
#include "tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/experimental/micro/testing/micro_test.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"
#include "sine_model_data.h"
//#include "constants.h"
namespace {
tflite::ErrorReporter* error_reporter = nullptr;
const tflite::Model* model = nullptr;
tflite::MicroInterpreter* interpreter = nullptr;
TfLiteTensor* input = nullptr;
TfLiteTensor* output = nullptr;
int inference_count = 0;
constexpr int kTensorArenaSize = 2 * 1024;
uint8_t tensor_arena[kTensorArenaSize];
}
void setup() {
tflite::MicroErrorReporter mreporter;
error_reporter = &mreporter;
model = tflite::GetModel(g_sine_model_data);
if(model->version() != TFLITE_SCHEMA_VERSION){
error_reporter->Report("Error"); //this line is couse to error somehow
}
static tflite::MicroMutableOpResolver micro_mutable_resolver; //this line is couse to error somehow
resolver.AddBuiltin(tflite::BuiltinOperator_ADD, tflite::ops::micro::Register_ADD()); //this line is couse to error somehow
}
Build output:
c:/users/1/appdata/local/arduino15/packages/maixduino/tools/riscv64-unknown-elf-gcc/8.2.0_20190409/bin/…/lib/gcc/riscv64-unknown-elf/8.2.0/…/…/…/…/riscv64-unknown-elf/bin/ld.exe: sketch\constants.h.cpp.o: in function `setup’:
c:\Users\1\Documents\PlatformIO\Projects\ff\src/main.ino:31: undefined reference to `vtable for tflite::MicroErrorReporter’
c:/users/1/appdata/local/arduino15/packages/maixduino/tools/riscv64-unknown-elf-gcc/8.2.0_20190409/bin/…/lib/gcc/riscv64-unknown-elf/8.2.0/…/…/…/…/riscv64-unknown-elf/bin/ld.exe: c:\Users\1\Documents\PlatformIO\Projects\ff\src/main.ino:36: undefined reference to `tflite::ErrorReporter::Report(char const*, …)’
c:/users/1/appdata/local/arduino15/packages/maixduino/tools/riscv64-unknown-elf-gcc/8.2.0_20190409/bin/…/lib/gcc/riscv64-unknown-elf/8.2.0/…/…/…/…/riscv64-unknown-elf/bin/ld.exe: sketch\constants.h.cpp.o: in function `_GLOBAL__sub_I_kInferencesPerCycle’:
C:\Users\1\Documents\Arduino\libraries\Arduino_TensorFlowLite\src/tensorflow/lite/experimental/micro/micro_mutable_op_resolver.h:27: undefined reference to `vtable for
tflite::MicroMutableOpResolver’
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for “TensorFlowLite.h”