3
3
// Configure FFT to output 16 bit fixed point.
4
4
#define FIXED_POINT 16
5
5
6
+ // #include <MicroTFLite.h>
6
7
#include < TensorFlowLite.h>
7
8
#include < cmath>
8
9
#include < cstdint>
13
14
#include " tensorflow/lite/experimental/microfrontend/lib/frontend_util.h"
14
15
#include " tensorflow/lite/micro/all_ops_resolver.h"
15
16
#include " tensorflow/lite/micro/kernels/micro_ops.h"
16
- #include " tensorflow/lite/micro/micro_error_reporter.h"
17
17
#include " tensorflow/lite/micro/micro_interpreter.h"
18
18
#include " tensorflow/lite/micro/micro_mutable_op_resolver.h"
19
19
#include " tensorflow/lite/micro/system_setup.h"
@@ -55,25 +55,6 @@ class TfLiteWriter {
55
55
virtual bool begin (TfLiteAudioStreamBase *parent) = 0;
56
56
virtual bool write (const int16_t sample) = 0;
57
57
};
58
- /* *
59
- * @brief Error Reporter using the Audio Tools Logger
60
- * @ingroup tflite
61
- * @author Phil Schatzmann
62
- * @copyright GPLv3
63
- */
64
- class TfLiteAudioErrorReporter : public tflite ::ErrorReporter {
65
- public:
66
- virtual ~TfLiteAudioErrorReporter () {}
67
- virtual int Report (const char * format, va_list args) override {
68
- int result = snprintf (msg, 200 , format, args);
69
- LOGE (msg);
70
- return result;
71
- }
72
-
73
- protected:
74
- char msg[200 ];
75
- } my_error_reporter;
76
- tflite::ErrorReporter* error_reporter = &my_error_reporter;
77
58
78
59
/* *
79
60
* @brief Configuration settings for TfLiteAudioStream
@@ -96,7 +77,7 @@ struct TfLiteConfig {
96
77
// Create an area of memory to use for input, output, and intermediate arrays.
97
78
// The size of this will depend on the model you’re using, and may need to be
98
79
// determined by experimentation.
99
- int kTensorArenaSize = 10 * 1024 ;
80
+ size_t kTensorArenaSize = 10 * 1024 ;
100
81
101
82
// Keeping these as constant expressions allow us to allocate fixed-sized
102
83
// arrays on the stack for our working memory.
@@ -980,14 +961,12 @@ class TfLiteAudioStream : public TfLiteAudioStreamBase {
980
961
TRACEI ();
981
962
if (cfg.useAllOpsResolver ) {
982
963
tflite::AllOpsResolver resolver;
983
- static tflite::MicroInterpreter static_interpreter (
984
- p_model, resolver, p_tensor_arena, cfg.kTensorArenaSize ,
985
- error_reporter);
964
+ static tflite::MicroInterpreter static_interpreter{
965
+ p_model, resolver, p_tensor_arena, cfg.kTensorArenaSize };
986
966
p_interpreter = &static_interpreter;
987
967
} else {
988
968
// NOLINTNEXTLINE(runtime-global-variables)
989
- static tflite::MicroMutableOpResolver<4 > micro_op_resolver (
990
- error_reporter);
969
+ static tflite::MicroMutableOpResolver<4 > micro_op_resolver{};
991
970
if (micro_op_resolver.AddDepthwiseConv2D () != kTfLiteOk ) {
992
971
return false ;
993
972
}
@@ -1001,9 +980,8 @@ class TfLiteAudioStream : public TfLiteAudioStreamBase {
1001
980
return false ;
1002
981
}
1003
982
// Build an p_interpreter to run the model with.
1004
- static tflite::MicroInterpreter static_interpreter (
1005
- p_model, micro_op_resolver, p_tensor_arena, cfg.kTensorArenaSize ,
1006
- error_reporter);
983
+ static tflite::MicroInterpreter static_interpreter{
984
+ p_model, micro_op_resolver, p_tensor_arena, cfg.kTensorArenaSize };
1007
985
p_interpreter = &static_interpreter;
1008
986
}
1009
987
}
0 commit comments