You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the error "Internal: Unsupported data type in custom op handler" when I try to build an Edge-TPU-Interpreter using the c++ API. I am using the model from official model zoo here. My code passes the compilation without any issue.
I think it might be a compatibility issue with the edge runtime and tensorflow-lite C++ API. I have following observations:
The same model and hardware works well with python API.
C++ code running tflite-model on the CPU works well.
The error occurs when they all come together.
hardware: Ubuntu 18 desktop with a USB accelerator
edge tpu runtime: version 14.0
libtensorflow-lite: build from source (cloned on 2020.06.08)
code to buid the Edge-TPU-Interpreter:
std::unique_ptr<tflite::Interpreter> BuildEdgeTpuInterpreter(
const tflite::FlatBufferModel& model,
edgetpu::EdgeTpuContext* edgetpu_context) {
tflite::ops::builtin::BuiltinOpResolver resolver;
resolver.AddCustom(edgetpu::kCustomOp, edgetpu::RegisterCustomOp());
std::unique_ptr<tflite::Interpreter> interpreter;
if (tflite::InterpreterBuilder(model, resolver)(&interpreter) != kTfLiteOk) {
std::cerr << "Failed to build interpreter." << std::endl;
}
// Bind given context with interpreter.
interpreter->SetExternalContext(kTfLiteEdgeTpuContext, edgetpu_context);
interpreter->SetNumThreads(1);
if (interpreter->AllocateTensors() != kTfLiteOk) {
std::cerr << "Failed to allocate tensors." << std::endl;
}
return interpreter;
}
The error is caused by interpreter->AllocateTensors() since I got the info "Failed to allocate tensors."
The text was updated successfully, but these errors were encountered:
thank you the information and nice repo! I've tried it on my PC and it works like a charm!
Just one more small thing: the CMakeList.txt has cmake_minimum_required(VERSION 3.11). The version might be too high for Ubuntu-users because for Ubuntu 18 the newest version from apt ist 3.10.2. I change the minimum required version to 3.10 and the build still works. So making the requirement lower seems harmless.
@lilanxiao sounds good :)
I think I just make that the requirements solely because that was the version I had at the time and haven't tested it on older versions haha
Hi,
I got the error "Internal: Unsupported data type in custom op handler" when I try to build an Edge-TPU-Interpreter using the c++ API. I am using the model from official model zoo here. My code passes the compilation without any issue.
I think it might be a compatibility issue with the edge runtime and tensorflow-lite C++ API. I have following observations:
The error is caused by
interpreter->AllocateTensors()
since I got the info "Failed to allocate tensors."The text was updated successfully, but these errors were encountered: