mirror of
https://github.com/vee1e/tflite-micro.git
synced 2026-09-01 09:51:22 +00:00
Fix benchmark tool alternate profiler (#3629)
@tensorflow/micro Set the alternate profiler in the benchmark tool prior to the `Prepare` phase (before calling `MicroInterpreter::AllocateTensors`). This is because the DECODE operator requires the alternate `MicroProfilerInterface` to already be initialized during the `Prepare` phase. Previously the alternate profiler was only required during the `Eval` phase with the legacy compression code. This fix does not change the functionality of the benchmark tool with respect to the legacy compression. bug=#3628
This commit is contained in:
parent
35b20c5c74
commit
0965635467
1 changed files with 9 additions and 8 deletions
|
|
@ -259,6 +259,15 @@ int Benchmark(const uint8_t* model_data, tflite::PrettyPrintType print_type) {
|
|||
profiler.EndEvent(event_handle);
|
||||
#endif // USE_ALT_DECOMPRESSION_MEM
|
||||
|
||||
if (using_compression) {
|
||||
MicroPrintf("profiler2 %p", &profiler2);
|
||||
status = interpreter.SetAlternateProfiler(&profiler2);
|
||||
if (status != kTfLiteOk) {
|
||||
MicroPrintf("tflite::MicroInterpreter::SetAlternateProfiler failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
event_handle =
|
||||
profiler.BeginEvent("tflite::MicroInterpreter::AllocateTensors");
|
||||
status = interpreter.AllocateTensors();
|
||||
|
|
@ -271,14 +280,6 @@ int Benchmark(const uint8_t* model_data, tflite::PrettyPrintType print_type) {
|
|||
profiler.LogTicksPerTagCsv();
|
||||
profiler.ClearEvents();
|
||||
|
||||
if (using_compression) {
|
||||
status = interpreter.SetAlternateProfiler(&profiler2);
|
||||
if (status != kTfLiteOk) {
|
||||
MicroPrintf("tflite::MicroInterpreter::SetAlternateProfiler failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
MicroPrintf(""); // null MicroPrintf serves as a newline.
|
||||
|
||||
// For streaming models, the interpreter will return kTfLiteAbort if the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue