When assign assign interpreter->outputs() to another variable, it crashed. Same code works fine on Linux.
#include <tensorflow/lite/kernels/register.h>
using namespace tflite;
int main() {
std::unique_ptr<tflite::Interpreter> interpreter;
auto model = tflite::FlatBufferModel::BuildFromFile("D:/test.tflite");
if (model == nullptr) {
printf("Error1\n");
}
tflite::ops::builtin::BuiltinOpResolver resolver;
if (InterpreterBuilder(*model, resolver)(&interpreter) != kTfLiteOk) {
printf("Error2\n");
}
if (interpreter->AllocateTensors() != kTfLiteOk) {
printf("Error3\n");
}
interpreter->outputs(); // This line will work
//auto outs = interpreter->outputs(); // This line will crash
printf("Done\n");
return 0;
}
The crash is in <vector> line 559
const pointer _Rightfirst = _Right_data._Myfirst;
The exception is
Exception thrown: read access violation.
_Right_data was 0xFFFFFFFFFFFFFFF7.