aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2022-11-21 13:39:45 +0100
committerKristofer Jonsson <kristofer.jonsson@arm.com>2022-11-23 09:46:12 +0100
commit1fed1d5f4c42486dd7429fe8e7acfaf4e85e3772 (patch)
tree7d18feec7453e9b1256368b0da417749432e54b0
parenteb1d711bf6e01fd3744b4eddc272d626716d48ca (diff)
downloadethos-u-core-software-1fed1d5f4c42486dd7429fe8e7acfaf4e85e3772.tar.gz
Use Tensorflow MicroPrintf
Change-Id: I01bbafc45ca2a56759d7d5afbbbacefb40fd9a26
-rw-r--r--applications/inference_process/src/inference_process.cpp10
-rw-r--r--lib/arm_profiler/include/arm_profiler.hpp1
-rw-r--r--lib/arm_profiler/src/arm_profiler.cpp9
-rw-r--r--lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp2
-rw-r--r--lib/layer_by_layer_profiler/src/layer_by_layer_profiler.cpp4
-rw-r--r--tflite_micro.cmake4
6 files changed, 12 insertions, 18 deletions
diff --git a/applications/inference_process/src/inference_process.cpp b/applications/inference_process/src/inference_process.cpp
index 9c740ab..71a3128 100644
--- a/applications/inference_process/src/inference_process.cpp
+++ b/applications/inference_process/src/inference_process.cpp
@@ -18,24 +18,16 @@
#include "tensorflow/lite/micro/all_ops_resolver.h"
#include "tensorflow/lite/micro/cortex_m_generic/debug_log_callback.h"
-#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_time.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "arm_profiler.hpp"
-#ifdef LAYER_BY_LAYER_PROFILER
-#include "layer_by_layer_profiler.hpp"
-#endif
-
+#include "cmsis_compiler.h"
#include "crc.hpp"
-
#include "ethosu_log.h"
-
#include "inference_process.hpp"
-#include "cmsis_compiler.h"
-
#include <inttypes.h>
using namespace std;
diff --git a/lib/arm_profiler/include/arm_profiler.hpp b/lib/arm_profiler/include/arm_profiler.hpp
index 3a487bd..9c7b5f3 100644
--- a/lib/arm_profiler/include/arm_profiler.hpp
+++ b/lib/arm_profiler/include/arm_profiler.hpp
@@ -19,6 +19,7 @@
#ifndef ARM_PROFILER_H
#define ARM_PROFILER_H
+#include "tensorflow/lite/micro/compatibility.h"
#include "tensorflow/lite/micro/micro_profiler_interface.h"
#include <memory>
diff --git a/lib/arm_profiler/src/arm_profiler.cpp b/lib/arm_profiler/src/arm_profiler.cpp
index 7648584..2977474 100644
--- a/lib/arm_profiler/src/arm_profiler.cpp
+++ b/lib/arm_profiler/src/arm_profiler.cpp
@@ -17,7 +17,7 @@
*/
#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/micro/micro_error_reporter.h"
+#include "tensorflow/lite/micro/micro_log.h"
#include "tensorflow/lite/micro/micro_time.h"
#include <string.h>
@@ -36,7 +36,7 @@ ArmProfiler::ArmProfiler(size_t max_events) : max_events_(max_events), num_event
uint32_t ArmProfiler::BeginEvent(const char *tag) {
if (num_events_ == max_events_) {
- tflite::GetMicroErrorReporter()->Report("Profiling event overflow, max: %u events", max_events_);
+ MicroPrintf("Profiling event overflow, max: %u events", max_events_);
num_events_ = 0;
}
@@ -63,10 +63,9 @@ uint64_t ArmProfiler::GetTotalTicks() const {
}
void ArmProfiler::ReportResults() const {
- tflite::GetMicroErrorReporter()->Report("Profiler report, CPU cycles per operator:");
+ MicroPrintf("Profiler report, CPU cycles per operator:");
for (size_t i = 0; i < num_events_; ++i) {
- tflite::GetMicroErrorReporter()->Report(
- "%s : cycle_cnt : %u cycles", tags_[i], end_ticks_[i] - start_ticks_[i]);
+ MicroPrintf("%s : cycle_cnt : %u cycles", tags_[i], end_ticks_[i] - start_ticks_[i]);
}
}
diff --git a/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp b/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
index 649cfb5..a76ac41 100644
--- a/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
+++ b/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
@@ -20,7 +20,7 @@
#define LAYER_BY_LAYER_PROFILER_H
#include "EventRecorder.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
+#include "tensorflow/lite/micro/compatibility.h"
#include "tensorflow/lite/micro/micro_profiler_interface.h"
#include <memory>
#include <vector>
diff --git a/lib/layer_by_layer_profiler/src/layer_by_layer_profiler.cpp b/lib/layer_by_layer_profiler/src/layer_by_layer_profiler.cpp
index 4f525ee..927587f 100644
--- a/lib/layer_by_layer_profiler/src/layer_by_layer_profiler.cpp
+++ b/lib/layer_by_layer_profiler/src/layer_by_layer_profiler.cpp
@@ -17,7 +17,7 @@
*/
#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/micro/micro_error_reporter.h"
+#include "tensorflow/lite/micro/micro_log.h"
#include "tensorflow/lite/micro/micro_profiler.h"
#include "tensorflow/lite/micro/micro_time.h"
@@ -41,7 +41,7 @@ LayerByLayerProfiler::LayerByLayerProfiler(size_t max_events, Backend _backend,
// NOTE: THIS PROFILER ONLY WORKS ON SYSTEMS WITH 1 NPU
uint32_t LayerByLayerProfiler::BeginEvent(const char *tag) {
if (num_events_ == max_events_) {
- tflite::GetMicroErrorReporter()->Report("Profiling event overflow, max: %u events", max_events_);
+ MicroPrintf("Profiling event overflow, max: %u events", max_events_);
num_events_ = 0;
}
diff --git a/tflite_micro.cmake b/tflite_micro.cmake
index 2d5bc3b..ef30fa8 100644
--- a/tflite_micro.cmake
+++ b/tflite_micro.cmake
@@ -186,11 +186,13 @@ tensorflow_target_sources_glob(tflu GLOB TRUE
${TFLU_PATH}/*.cc
${TFLU_PATH}/arena_allocator/*.cc
${TFLU_PATH}/memory_planner/*.cc
- ${TFLU_PATH}/kernels/*.cc)
+ ${TFLU_PATH}/kernels/*.cc
+ ${TFLU_PATH}/tflite_bridge/*.cc)
tensorflow_target_sources_glob(tflu GLOB_RECURSE FALSE
${TFLU_PATH}/../c/*.cc
${TFLU_PATH}/../core/*.cc
+ ${TFLU_PATH}/../core/api/*.cc
${TFLU_PATH}/../kernels/*.cc
${TFLU_PATH}/../schema/*.cc)