xmos-ai-tools 1.1.2.dev216__py3-none-macosx_11_0_arm64.whl → 1.1.2.dev236__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +16 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +80 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quadratic_interpolation.h +23 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +15 -15
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/simple_features/model.h → signal/micro/kernels/delay_flexbuffers_generated_data.h} +7 -9
- xmos_ai_tools/runtime/include/signal/micro/kernels/energy_flexbuffers_generated_data.h +28 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/fft_flexbuffers_generated_data.h +37 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_log_flexbuffers_generated_data.h +27 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_spectral_subtraction_flexbuffers_generated_data.h +26 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/framer_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/simple_features/no_simple_features_data.h → signal/micro/kernels/irfft.h} +15 -7
- xmos_ai_tools/runtime/include/signal/micro/kernels/overlap_add_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/pcan_flexbuffers_generated_data.h +7 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/rfft.h +31 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/stacker_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/window_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/src/circular_buffer.h +118 -0
- xmos_ai_tools/runtime/include/signal/src/complex.h +29 -0
- xmos_ai_tools/runtime/include/signal/src/energy.h +38 -0
- xmos_ai_tools/runtime/include/signal/src/fft_auto_scale.h +35 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank.h +69 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank_log.h +38 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank_spectral_subtraction.h +73 -0
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/main_functions.h → signal/src/filter_bank_square_root.h} +14 -17
- xmos_ai_tools/runtime/include/signal/src/irfft.h +84 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_common.h +49 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_float.h +31 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int16.h +30 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int32.h +31 -0
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h → signal/src/log.h} +13 -6
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/python/interpreter/src/python_utils.h → signal/src/max_abs.h} +11 -11
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h → signal/src/msb.h} +15 -6
- xmos_ai_tools/runtime/include/signal/src/overlap_add.h +46 -0
- xmos_ai_tools/runtime/include/signal/src/pcan_argc_fixed.h +41 -0
- xmos_ai_tools/runtime/include/signal/src/rfft.h +85 -0
- xmos_ai_tools/runtime/include/signal/src/square_root.h +32 -0
- xmos_ai_tools/runtime/include/{tensorflow/lite/micro/python/interpreter/src/numpy_utils.h → signal/src/window.h} +13 -15
- xmos_ai_tools/runtime/include/signal/testdata/fft_test_data.h +48 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/array.h +156 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/builtin_ops.h +44 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/c/c_api_types.h +6 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/c/common.h +8 -25
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +15 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/builtin_op_data.h +92 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +61 -51
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +302 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/core/macros.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +129 -43
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +23 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +210 -151
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +9 -18
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +2 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +103 -72
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +2 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h +2 -63
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +87 -26
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +129 -80
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +42 -93
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +5 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +249 -263
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +11 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +5 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +5 -10
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +4 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +25 -14
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/op_macros.h +14 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/debug_log.h +10 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +7 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +6 -5
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +0 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +19 -20
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +8 -31
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +8 -8
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +1 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +9 -9
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +14 -9
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +9 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +119 -100
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +8 -8
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +26 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +12 -16
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +40 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +8 -7
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +5 -5
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +26 -21
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +2 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +5 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +4 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +4 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +4 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +23 -8
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_common.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +23 -65
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +15 -57
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +16 -5
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +125 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +110 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +6 -8
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +114 -32
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +6 -5
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +1 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +1 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/python_ops_resolver.h +21 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +3 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +28 -12
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +1 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +273 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +41 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +127 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +9139 -5010
- xmos_ai_tools/runtime/lib/libhost_xtflitemicro.a +0 -0
- xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
- xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.1.0.1.dylib +0 -0
- xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.dylib +0 -0
- {xmos_ai_tools-1.1.2.dev216.data → xmos_ai_tools-1.1.2.dev236.data}/data/bin/xcore-opt +0 -0
- {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/METADATA +3 -4
- {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/RECORD +128 -105
- {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/WHEEL +1 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/op_resolver.h +0 -129
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/all_ops_resolver.h +0 -38
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/audio_provider.h +0 -44
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/command_responder.h +0 -30
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/feature_provider.h +0 -50
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h +0 -30
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h +0 -43
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h +0 -29
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h +0 -29
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/recognize_commands.h +0 -151
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h +0 -29
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h +0 -29
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h +0 -43
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h +0 -29
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_simple_features_data.h +0 -23
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_string.h +0 -33
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/interpreter_wrapper.h +0 -51
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/pybind11_lib.h +0 -64
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/shared_library.h +0 -40
- {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,10 @@ limitations under the License.
|
|
15
15
|
#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_
|
16
16
|
#define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_
|
17
17
|
|
18
|
+
#include <vector>
|
19
|
+
|
18
20
|
#include "tensorflow/lite/core/c/common.h"
|
21
|
+
#include "tensorflow/lite/core/macros.h"
|
19
22
|
#include "tensorflow/lite/kernels/internal/types.h"
|
20
23
|
|
21
24
|
namespace tflite {
|
@@ -31,16 +34,8 @@ inline const T* GetTensorData(const TfLiteTensor* tensor) {
|
|
31
34
|
: nullptr;
|
32
35
|
}
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
return RuntimeShape();
|
37
|
-
}
|
38
|
-
|
39
|
-
TfLiteIntArray* dims = tensor->dims;
|
40
|
-
const int dims_size = dims->size;
|
41
|
-
const int32_t* dims_data = reinterpret_cast<const int32_t*>(dims->data);
|
42
|
-
return RuntimeShape(dims_size, dims_data);
|
43
|
-
}
|
37
|
+
TFLITE_NOINLINE RuntimeShape GetTensorShape(const TfLiteTensor* tensor);
|
38
|
+
RuntimeShape GetTensorShape(std::vector<int32_t> data);
|
44
39
|
|
45
40
|
} // namespace tflite
|
46
41
|
|
@@ -157,7 +157,8 @@ struct PerChannelQuantizationParams {
|
|
157
157
|
};
|
158
158
|
|
159
159
|
// Gets next index to iterate through a multidimensional array.
|
160
|
-
|
160
|
+
template <typename IndexType = int>
|
161
|
+
inline bool NextIndex(const int num_dims, const int* dims, IndexType* current) {
|
161
162
|
if (num_dims == 0) {
|
162
163
|
return false;
|
163
164
|
}
|
@@ -165,7 +166,7 @@ inline bool NextIndex(const int num_dims, const int* dims, int* current) {
|
|
165
166
|
TFLITE_DCHECK(current != nullptr);
|
166
167
|
int carry = 1;
|
167
168
|
for (int idx = num_dims - 1; idx >= 0; --idx) {
|
168
|
-
|
169
|
+
IndexType current_val = current[idx] + carry;
|
169
170
|
TFLITE_DCHECK_GE(dims[idx], current_val);
|
170
171
|
if (dims[idx] == current_val) {
|
171
172
|
current[idx] = 0;
|
@@ -982,6 +983,7 @@ struct StridedSliceParams {
|
|
982
983
|
uint16_t end_mask;
|
983
984
|
uint16_t new_axis_mask;
|
984
985
|
uint16_t shrink_axis_mask;
|
986
|
+
bool offset;
|
985
987
|
};
|
986
988
|
|
987
989
|
struct TanhParams {
|
@@ -24,6 +24,9 @@ limitations under the License.
|
|
24
24
|
|
25
25
|
#include "tensorflow/lite/core/c/builtin_op_data.h"
|
26
26
|
#include "tensorflow/lite/core/c/common.h"
|
27
|
+
#ifndef NDEBUG
|
28
|
+
#include "tensorflow/lite/kernels/op_macros.h"
|
29
|
+
#endif
|
27
30
|
|
28
31
|
namespace tflite {
|
29
32
|
|
@@ -165,24 +168,31 @@ inline int NumIntermediates(const TfLiteNode* node) {
|
|
165
168
|
}
|
166
169
|
#endif // TF_LITE_STATIC_MEMORY
|
167
170
|
|
168
|
-
inline int64_t NumElements(const
|
171
|
+
inline int64_t NumElements(const int* dims, int num_dims) {
|
169
172
|
int64_t count = 1;
|
170
|
-
for (int i = 0; i <
|
171
|
-
|
173
|
+
for (int i = 0; i < num_dims; ++i) {
|
174
|
+
#ifndef NDEBUG
|
175
|
+
if (count <= 0) {
|
176
|
+
break;
|
177
|
+
}
|
178
|
+
// Check that number of elements can fit in 32 bit int. Most of tflite
|
179
|
+
// assumes the result of `NumElements` is < MAX_INT and static or implicit
|
180
|
+
// casts to `int32_t` without any checks. It is more meaningful to check
|
181
|
+
// that the result fits into 32 bits than for standard overflow on 64 bit
|
182
|
+
// type.
|
183
|
+
TF_LITE_ASSERT(dims[i] < std::numeric_limits<int>::max() / count);
|
184
|
+
#endif
|
185
|
+
count *= dims[i];
|
172
186
|
}
|
173
187
|
return count;
|
174
188
|
}
|
175
189
|
|
176
|
-
inline int64_t NumElements(const
|
177
|
-
return NumElements(
|
190
|
+
inline int64_t NumElements(const TfLiteIntArray* dims) {
|
191
|
+
return NumElements(dims->data, dims->size);
|
178
192
|
}
|
179
193
|
|
180
|
-
inline int64_t NumElements(const
|
181
|
-
|
182
|
-
for (int i = 0; i < num_dims; ++i) {
|
183
|
-
count *= dims[i];
|
184
|
-
}
|
185
|
-
return count;
|
194
|
+
inline int64_t NumElements(const TfLiteTensor* t) {
|
195
|
+
return NumElements(t->dims);
|
186
196
|
}
|
187
197
|
|
188
198
|
// Determines whether tensor is constant.
|
@@ -204,22 +214,23 @@ inline bool IsConstantOrPersistentTensor(const TfLiteTensor* tensor) {
|
|
204
214
|
inline bool IsDynamicTensor(const TfLiteTensor* tensor) {
|
205
215
|
return tensor->allocation_type == kTfLiteDynamic;
|
206
216
|
}
|
207
|
-
|
217
|
+
#ifndef TF_LITE_STATIC_MEMORY
|
208
218
|
// Sets tensor to dynamic.
|
209
219
|
inline void SetTensorToDynamic(TfLiteTensor* tensor) {
|
210
220
|
if (tensor->allocation_type != kTfLiteDynamic) {
|
221
|
+
TfLiteTensorDataFree(tensor);
|
211
222
|
tensor->allocation_type = kTfLiteDynamic;
|
212
|
-
tensor->data.raw = nullptr;
|
213
223
|
}
|
214
224
|
}
|
215
225
|
|
216
226
|
// Sets tensor to persistent and read-only.
|
217
227
|
inline void SetTensorToPersistentRo(TfLiteTensor* tensor) {
|
218
228
|
if (tensor->allocation_type != kTfLitePersistentRo) {
|
229
|
+
TfLiteTensorDataFree(tensor);
|
219
230
|
tensor->allocation_type = kTfLitePersistentRo;
|
220
|
-
tensor->data.raw = nullptr;
|
221
231
|
}
|
222
232
|
}
|
233
|
+
#endif // TF_LITE_STATIC_MEMORY
|
223
234
|
|
224
235
|
// Determines whether it is a hybrid op - one that has float inputs and
|
225
236
|
// quantized weights.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Copyright
|
1
|
+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
|
2
2
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
you may not use this file except in compliance with the License.
|
@@ -15,14 +15,14 @@ limitations under the License.
|
|
15
15
|
#ifndef TENSORFLOW_LITE_KERNELS_OP_MACROS_H_
|
16
16
|
#define TENSORFLOW_LITE_KERNELS_OP_MACROS_H_
|
17
17
|
|
18
|
-
#include "tensorflow/lite/micro/
|
18
|
+
#include "tensorflow/lite/micro/micro_log.h"
|
19
19
|
|
20
20
|
#if !defined(TF_LITE_MCU_DEBUG_LOG)
|
21
21
|
#include <cstdlib>
|
22
22
|
#define TFLITE_ABORT abort()
|
23
23
|
#else
|
24
24
|
inline void AbortImpl() {
|
25
|
-
|
25
|
+
MicroPrintf("HALTED");
|
26
26
|
while (1) {
|
27
27
|
}
|
28
28
|
}
|
@@ -35,4 +35,15 @@ inline void AbortImpl() {
|
|
35
35
|
#define TFLITE_ASSERT_FALSE TFLITE_ABORT
|
36
36
|
#endif
|
37
37
|
|
38
|
+
#define TF_LITE_FATAL(msg) \
|
39
|
+
do { \
|
40
|
+
MicroPrintf("%s", (msg)); \
|
41
|
+
TFLITE_ABORT; \
|
42
|
+
} while (0)
|
43
|
+
|
44
|
+
#define TF_LITE_ASSERT(x) \
|
45
|
+
do { \
|
46
|
+
if (!(x)) TF_LITE_FATAL(#x); \
|
47
|
+
} while (0)
|
48
|
+
|
38
49
|
#endif // TENSORFLOW_LITE_KERNELS_OP_MACROS_H_
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Copyright
|
1
|
+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
|
2
2
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
you may not use this file except in compliance with the License.
|
@@ -15,14 +15,21 @@ limitations under the License.
|
|
15
15
|
#ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
|
16
16
|
#define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
|
17
17
|
|
18
|
+
#ifdef __cplusplus
|
19
|
+
#include <cstdarg>
|
20
|
+
#else
|
21
|
+
#include <stdarg.h>
|
22
|
+
#endif // __cplusplus
|
23
|
+
|
18
24
|
#ifdef __cplusplus
|
19
25
|
extern "C" {
|
20
26
|
#endif // __cplusplus
|
21
27
|
|
22
28
|
// This function should be implemented by each target platform, and provide a
|
23
29
|
// way for strings to be output to some text stream. For more information, see
|
24
|
-
// tensorflow/lite/micro/debug_log.cc.
|
25
|
-
|
30
|
+
// the tensorflow/lite/micro/debug_log.cc file. This function should support
|
31
|
+
// standard C/C++ stdio style formatting operations.
|
32
|
+
void DebugLog(const char* format, va_list args);
|
26
33
|
|
27
34
|
#ifdef __cplusplus
|
28
35
|
} // extern "C"
|
xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
|
16
|
+
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_MODEL_SETTINGS_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_MODEL_SETTINGS_H_
|
18
|
+
|
19
|
+
// The following values are derived from values used during model training.
|
20
|
+
// If you change the way you preprocess the input, update all these constants.
|
21
|
+
constexpr int kAudioSampleFrequency = 16000;
|
22
|
+
constexpr int kFeatureSize = 40;
|
23
|
+
constexpr int kFeatureCount = 49;
|
24
|
+
constexpr int kFeatureElementCount = (kFeatureSize * kFeatureCount);
|
25
|
+
constexpr int kFeatureStrideMs = 20;
|
26
|
+
constexpr int kFeatureDurationMs = 30;
|
27
|
+
|
28
|
+
// Variables for the model's output categories.
|
29
|
+
constexpr int kCategoryCount = 4;
|
30
|
+
constexpr const char* kCategoryLabels[kCategoryCount] = {
|
31
|
+
"silence",
|
32
|
+
"unknown",
|
33
|
+
"yes",
|
34
|
+
"no",
|
35
|
+
};
|
36
|
+
|
37
|
+
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_MODEL_SETTINGS_H_
|
@@ -27,6 +27,8 @@ namespace tflite {
|
|
27
27
|
|
28
28
|
class FakeMicroContext : public MicroContext {
|
29
29
|
public:
|
30
|
+
~FakeMicroContext() = default;
|
31
|
+
|
30
32
|
FakeMicroContext(TfLiteTensor* tensors, SingleArenaBufferAllocator* allocator,
|
31
33
|
MicroGraph* micro_graph);
|
32
34
|
|
@@ -44,9 +46,14 @@ class FakeMicroContext : public MicroContext {
|
|
44
46
|
|
45
47
|
TfLiteEvalTensor* GetEvalTensor(int tensor_index) override;
|
46
48
|
|
49
|
+
TfLiteStatus set_external_context(void* external_context_payload) override;
|
50
|
+
void* external_context() override;
|
51
|
+
MicroGraph& graph() override;
|
52
|
+
|
47
53
|
private:
|
48
54
|
static constexpr int kNumScratchBuffers_ = 12;
|
49
55
|
|
56
|
+
MicroGraph& graph_;
|
50
57
|
int scratch_buffer_count_ = 0;
|
51
58
|
uint8_t* scratch_buffers_[kNumScratchBuffers_];
|
52
59
|
|
@@ -20,6 +20,7 @@ limitations under the License.
|
|
20
20
|
|
21
21
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
22
22
|
#include "tensorflow/lite/c/common.h"
|
23
|
+
#include "tensorflow/lite/micro/micro_common.h"
|
23
24
|
|
24
25
|
namespace tflite {
|
25
26
|
|
@@ -60,17 +61,17 @@ TfLiteStatus CalculateOpDataAdd(TfLiteContext* context, TfLiteAddParams* params,
|
|
60
61
|
TfLiteStatus AddPrepare(TfLiteContext* context, TfLiteNode* node);
|
61
62
|
|
62
63
|
// Generic must define registration function.
|
63
|
-
|
64
|
+
TFLMRegistration Register_ADD();
|
64
65
|
|
65
66
|
#if defined(CMSIS_NN)
|
66
|
-
|
67
|
+
TFLMRegistration Register_ADD_INT8();
|
67
68
|
|
68
|
-
|
69
|
+
TFLMRegistration Register_ADD_INT16();
|
69
70
|
#else
|
70
71
|
// Fallback registration
|
71
|
-
inline
|
72
|
+
inline TFLMRegistration Register_ADD_INT8() { return Register_ADD(); }
|
72
73
|
|
73
|
-
inline
|
74
|
+
inline TFLMRegistration Register_ADD_INT16() { return Register_ADD(); }
|
74
75
|
#endif
|
75
76
|
} // namespace tflite
|
76
77
|
|
@@ -30,9 +30,6 @@ extern const int kCircularBufferOutputTensor;
|
|
30
30
|
// Elements in the vectors are ordered alphabetically by parameter name.
|
31
31
|
extern const int kCircularBufferCyclesMaxIndex; // 'cycles_max'
|
32
32
|
|
33
|
-
// TODO(b/149795762): Add this to TfLiteStatus enum.
|
34
|
-
extern const TfLiteStatus kTfLiteAbort;
|
35
|
-
|
36
33
|
// These fields control the stride period of a strided streaming model. This op
|
37
34
|
// returns kTfLiteAbort until cycles_until_run-- is zero. At this time,
|
38
35
|
// cycles_until_run is reset to cycles_max.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Copyright
|
1
|
+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
|
2
2
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
you may not use this file except in compliance with the License.
|
@@ -19,8 +19,8 @@ limitations under the License.
|
|
19
19
|
#include <cstdint>
|
20
20
|
|
21
21
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
22
|
-
#include "tensorflow/lite/c/common.h"
|
23
22
|
#include "tensorflow/lite/kernels/internal/types.h"
|
23
|
+
#include "tensorflow/lite/micro/micro_common.h"
|
24
24
|
|
25
25
|
namespace tflite {
|
26
26
|
|
@@ -74,44 +74,43 @@ TfLiteStatus CalculateOpDataConv(TfLiteContext* context, TfLiteNode* node,
|
|
74
74
|
int out_height, const TfLiteType data_type,
|
75
75
|
OpDataConv* data);
|
76
76
|
|
77
|
+
void* ConvInit(TfLiteContext* context, const char* buffer, size_t length);
|
78
|
+
|
77
79
|
TfLiteStatus ConvPrepare(TfLiteContext* context, TfLiteNode* node);
|
78
80
|
|
79
|
-
// This is the most generic
|
81
|
+
// This is the most generic TFLMRegistration. The actual supported types
|
80
82
|
// may still be target dependent. The only requirement is that every
|
81
83
|
// implementation (reference or optimized) must define this function.
|
82
|
-
|
84
|
+
TFLMRegistration Register_CONV_2D();
|
83
85
|
|
84
86
|
#if defined(XTENSA)
|
85
|
-
// Returns a
|
87
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
86
88
|
// int8 activations and int8 weights and always calls the reference
|
87
89
|
// implementation.
|
88
|
-
|
90
|
+
TFLMRegistration Register_CONV_2D_INT8REF();
|
91
|
+
|
89
92
|
#else
|
90
|
-
inline
|
93
|
+
inline TFLMRegistration Register_CONV_2D_INT8REF() {
|
91
94
|
return Register_CONV_2D();
|
92
95
|
}
|
93
|
-
#endif
|
96
|
+
#endif // defined(XTENSA)
|
94
97
|
|
95
|
-
#if defined(CMSIS_NN)
|
96
|
-
// Returns a
|
98
|
+
#if defined(CMSIS_NN) || defined(XTENSA)
|
99
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
97
100
|
// int8 activations and int8 weights and uses the latency optimized
|
98
101
|
// implementations.
|
99
|
-
|
102
|
+
TFLMRegistration Register_CONV_2D_INT8();
|
100
103
|
|
101
|
-
// Returns a
|
104
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
102
105
|
// int16 activations and int8 weights and uses the latency optimized
|
103
106
|
// implementations.
|
104
|
-
|
107
|
+
TFLMRegistration Register_CONV_2D_INT16();
|
105
108
|
|
106
109
|
#else
|
107
|
-
inline
|
108
|
-
return Register_CONV_2D();
|
109
|
-
}
|
110
|
+
inline TFLMRegistration Register_CONV_2D_INT8() { return Register_CONV_2D(); }
|
110
111
|
|
111
|
-
inline
|
112
|
-
|
113
|
-
}
|
114
|
-
#endif
|
112
|
+
inline TFLMRegistration Register_CONV_2D_INT16() { return Register_CONV_2D(); }
|
113
|
+
#endif // defined(CMSIS_NN) || defined(XTENSA)
|
115
114
|
|
116
115
|
} // namespace tflite
|
117
116
|
|
@@ -28,56 +28,33 @@ namespace testing {
|
|
28
28
|
|
29
29
|
TfLiteStatus InvokeConv(TfLiteTensor* tensors, int tensors_size,
|
30
30
|
int output_length, TfLiteConvParams* conv_params,
|
31
|
-
|
31
|
+
TFLMRegistration registration, float* output_data);
|
32
32
|
|
33
33
|
TfLiteStatus InvokeConv(TfLiteTensor* tensors, int tensors_size,
|
34
34
|
int output_length, TfLiteConvParams* conv_params,
|
35
|
-
|
36
|
-
int8_t* output_data);
|
37
|
-
|
38
|
-
TfLiteStatus InvokeConv(TfLiteTensor* tensors, int tensors_size,
|
39
|
-
int output_length, TfLiteConvParams* conv_params,
|
40
|
-
TfLiteRegistration_V1 registration,
|
41
|
-
uint8_t* output_data);
|
35
|
+
TFLMRegistration registration, int8_t* output_data);
|
42
36
|
|
43
37
|
TfLiteStatus ValidateConvGoldens(TfLiteTensor* tensors, int tensors_size,
|
44
38
|
const float* expected_output_data,
|
45
39
|
int output_length,
|
46
40
|
TfLiteConvParams* conv_params,
|
47
|
-
|
41
|
+
TFLMRegistration registration,
|
48
42
|
float* output_data, float tolerance = 1e-5);
|
49
43
|
|
50
44
|
TfLiteStatus ValidateConvGoldens(TfLiteTensor* tensors, int tensors_size,
|
51
45
|
const int8_t* expected_output_data,
|
52
46
|
int output_length,
|
53
47
|
TfLiteConvParams* conv_params,
|
54
|
-
|
48
|
+
TFLMRegistration registration,
|
55
49
|
int8_t* output_data, float tolerance = 1e-5);
|
56
50
|
|
57
|
-
TfLiteStatus ValidateConvGoldens(TfLiteTensor* tensors, int tensors_size,
|
58
|
-
const uint8_t* expected_output_data,
|
59
|
-
int output_length,
|
60
|
-
TfLiteConvParams* conv_params,
|
61
|
-
TfLiteRegistration_V1 registration,
|
62
|
-
uint8_t* output_data, float tolerance = 1e-5);
|
63
|
-
|
64
51
|
TfLiteStatus TestConvFloat(int* input_dims_data, const float* input_data,
|
65
52
|
int* filter_dims_data, const float* filter_data,
|
66
53
|
int* bias_dims_data, const float* bias_data,
|
67
54
|
int* output_dims_data,
|
68
55
|
const float* expected_output_data,
|
69
56
|
TfLiteConvParams* conv_params,
|
70
|
-
|
71
|
-
float* output_data);
|
72
|
-
|
73
|
-
TfLiteStatus TestConvQuantizedPerLayer(
|
74
|
-
int* input_dims_data, const float* input_data, uint8_t* input_quantized,
|
75
|
-
float input_scale, int* filter_dims_data, const float* filter_data,
|
76
|
-
uint8_t* filter_quantized, float filter_scale, int* bias_dims_data,
|
77
|
-
const float* bias_data, int32_t* bias_quantized, int* output_dims_data,
|
78
|
-
const float* expected_output_data, uint8_t* expected_output_quantized,
|
79
|
-
float output_scale, TfLiteConvParams* conv_params,
|
80
|
-
TfLiteRegistration_V1 registration, uint8_t* output_data);
|
57
|
+
TFLMRegistration registration, float* output_data);
|
81
58
|
|
82
59
|
TfLiteStatus TestConvQuantizedPerChannel(
|
83
60
|
int* input_dims_data, const float* input_data, int8_t* input_quantized,
|
@@ -87,7 +64,7 @@ TfLiteStatus TestConvQuantizedPerChannel(
|
|
87
64
|
float* bias_scales, int* bias_zero_points, int* output_dims_data,
|
88
65
|
const float* expected_output_data, int8_t* expected_output_data_quantized,
|
89
66
|
float output_scale, int output_zero_point, TfLiteConvParams* conv_params,
|
90
|
-
|
67
|
+
TFLMRegistration registration, int8_t* output_data,
|
91
68
|
TfLiteType tensor_weight_type = kTfLiteNoType);
|
92
69
|
|
93
70
|
TfLiteStatus TestConvQuantizedPerChannel(
|
@@ -99,7 +76,7 @@ TfLiteStatus TestConvQuantizedPerChannel(
|
|
99
76
|
int* bias_zero_points, int* output_dims_data,
|
100
77
|
const float* expected_output_data, int16_t* expected_output_data_quantized,
|
101
78
|
float output_scale, int output_zero_point, TfLiteConvParams* conv_params,
|
102
|
-
|
79
|
+
TFLMRegistration registration, int16_t* output_data);
|
103
80
|
|
104
81
|
TfLiteStatus TestConvQuantizedPerChannel(
|
105
82
|
int* input_dims_data, const float* input_data, int16_t* input_quantized,
|
@@ -109,7 +86,7 @@ TfLiteStatus TestConvQuantizedPerChannel(
|
|
109
86
|
float* bias_scales, int* bias_zero_points, int* output_dims_data,
|
110
87
|
const float* expected_output_data, int16_t* expected_output_data_quantized,
|
111
88
|
float output_scale, int output_zero_point, TfLiteConvParams* conv_params,
|
112
|
-
|
89
|
+
TFLMRegistration registration, int16_t* output_data);
|
113
90
|
|
114
91
|
} // namespace testing
|
115
92
|
} // namespace tflite
|
@@ -49,28 +49,28 @@ TfLiteStatus CalculateOpDataDepthwiseConv(
|
|
49
49
|
|
50
50
|
TfLiteStatus DepthwiseConvPrepare(TfLiteContext* context, TfLiteNode* node);
|
51
51
|
|
52
|
-
// This is the most generic
|
52
|
+
// This is the most generic TFLMRegistration. The actual supported types
|
53
53
|
// may still be target dependent. The only requirement is that every
|
54
54
|
// implementation (reference or optimized) must define this function.
|
55
|
-
|
55
|
+
TFLMRegistration Register_DEPTHWISE_CONV_2D();
|
56
56
|
|
57
57
|
#if defined(CMSIS_NN)
|
58
|
-
// Returns a
|
58
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
59
59
|
// int8 activations and int8 weights and uses the latency optimized
|
60
60
|
// implementations.
|
61
|
-
|
61
|
+
TFLMRegistration Register_DEPTHWISE_CONV_2D_INT8();
|
62
62
|
|
63
|
-
// Returns a
|
63
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
64
64
|
// int16 activations and int8 weights and uses the latency optimized
|
65
65
|
// implementations.
|
66
|
-
|
66
|
+
TFLMRegistration Register_DEPTHWISE_CONV_2D_INT16();
|
67
67
|
|
68
68
|
#else
|
69
|
-
inline
|
69
|
+
inline TFLMRegistration Register_DEPTHWISE_CONV_2D_INT8() {
|
70
70
|
return Register_DEPTHWISE_CONV_2D();
|
71
71
|
}
|
72
72
|
|
73
|
-
inline
|
73
|
+
inline TFLMRegistration Register_DEPTHWISE_CONV_2D_INT16() {
|
74
74
|
return Register_DEPTHWISE_CONV_2D();
|
75
75
|
}
|
76
76
|
#endif
|
@@ -18,8 +18,8 @@ limitations under the License.
|
|
18
18
|
#include <cstdint>
|
19
19
|
|
20
20
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
21
|
-
#include "tensorflow/lite/c/common.h"
|
22
21
|
#include "tensorflow/lite/kernels/internal/types.h"
|
22
|
+
#include "tensorflow/lite/micro/micro_common.h"
|
23
23
|
|
24
24
|
namespace tflite {
|
25
25
|
|
@@ -68,15 +68,15 @@ TfLiteStatus CalculateOpDataFullyConnected(
|
|
68
68
|
TfLiteType data_type, const TfLiteTensor* input, const TfLiteTensor* filter,
|
69
69
|
const TfLiteTensor* bias, TfLiteTensor* output, OpDataFullyConnected* data);
|
70
70
|
|
71
|
-
// This is the most generic
|
71
|
+
// This is the most generic TFLMRegistration. The actual supported types
|
72
72
|
// may still be target dependent. The only requirement is that every
|
73
73
|
// implementation (reference or optimized) must define this function.
|
74
|
-
|
74
|
+
TFLMRegistration Register_FULLY_CONNECTED();
|
75
75
|
|
76
76
|
#if defined(CMSIS_NN) || defined(HEXAGON) || defined(XTENSA)
|
77
|
-
// Returns a
|
77
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
78
78
|
// int8.
|
79
|
-
|
79
|
+
TFLMRegistration Register_FULLY_CONNECTED_INT8();
|
80
80
|
|
81
81
|
#else
|
82
82
|
// Note that while this block gets used for both reference and optimized kernels
|
@@ -84,16 +84,16 @@ TfLiteRegistration_V1 Register_FULLY_CONNECTED_INT8();
|
|
84
84
|
// define fallback implementation that allow reference kernels to still be used
|
85
85
|
// from applications that call a more specific kernel variant.
|
86
86
|
|
87
|
-
inline
|
87
|
+
inline TFLMRegistration Register_FULLY_CONNECTED_INT8() {
|
88
88
|
return Register_FULLY_CONNECTED();
|
89
89
|
}
|
90
90
|
|
91
91
|
#endif
|
92
92
|
|
93
93
|
#if defined(CMSIS_NN)
|
94
|
-
// Returns a
|
94
|
+
// Returns a TFLMRegistration struct for kernel variant that only supports
|
95
95
|
// int16.
|
96
|
-
|
96
|
+
TFLMRegistration Register_FULLY_CONNECTED_INT16();
|
97
97
|
|
98
98
|
#else
|
99
99
|
// Note that while this block gets used for both reference and optimized kernels
|
@@ -101,7 +101,7 @@ TfLiteRegistration_V1 Register_FULLY_CONNECTED_INT16();
|
|
101
101
|
// define fallback implementation that allow reference kernels to still be used
|
102
102
|
// from applications that call a more specific kernel variant.
|
103
103
|
|
104
|
-
inline
|
104
|
+
inline TFLMRegistration Register_FULLY_CONNECTED_INT16() {
|
105
105
|
return Register_FULLY_CONNECTED();
|
106
106
|
}
|
107
107
|
|
@@ -25,7 +25,7 @@ limitations under the License.
|
|
25
25
|
namespace tflite {
|
26
26
|
namespace micro {
|
27
27
|
|
28
|
-
// Helper class to perform a simulated kernel (i.e.
|
28
|
+
// Helper class to perform a simulated kernel (i.e. TFLMRegistration)
|
29
29
|
// lifecycle (init, prepare, invoke). All internal allocations are handled by
|
30
30
|
// this class. Simply pass in the registration, list of required tensors, inputs
|
31
31
|
// array, outputs array, and any pre-builtin data. Calling Invoke() will
|
@@ -33,26 +33,31 @@ namespace micro {
|
|
33
33
|
// output provided during construction.
|
34
34
|
class KernelRunner {
|
35
35
|
public:
|
36
|
-
KernelRunner(const
|
36
|
+
KernelRunner(const TFLMRegistration& registration, TfLiteTensor* tensors,
|
37
37
|
int tensors_size, TfLiteIntArray* inputs,
|
38
|
-
TfLiteIntArray* outputs, void* builtin_data,
|
38
|
+
TfLiteIntArray* outputs, const void* builtin_data,
|
39
39
|
TfLiteIntArray* intermediates = nullptr);
|
40
40
|
|
41
|
-
// Calls init and prepare on the kernel (i.e.
|
41
|
+
// Calls init and prepare on the kernel (i.e. TFLMRegistration) struct.
|
42
42
|
// Any exceptions will be DebugLog'd and returned as a status code.
|
43
43
|
TfLiteStatus InitAndPrepare(const char* init_data = nullptr,
|
44
44
|
size_t length = 0);
|
45
45
|
|
46
|
-
// Calls
|
47
|
-
//
|
48
|
-
//
|
46
|
+
// Calls invoke on a given TFLMRegistration pointer. After successful
|
47
|
+
// invoke, results will be available in the output tensor as passed into the
|
48
|
+
// constructor of this class.
|
49
49
|
TfLiteStatus Invoke();
|
50
50
|
|
51
|
-
// Calls Free on a given
|
51
|
+
// Calls Free on a given TFLMRegistration pointer(if it's implemented).
|
52
52
|
// After successful Free, kTfLiteOk status will be returned. If Free is not
|
53
53
|
// implemented for a given kernel kTfLiteError will be returned.
|
54
54
|
TfLiteStatus Free();
|
55
55
|
|
56
|
+
// Calls Reset on a given TFLMRegistration pointer(if it's implemented).
|
57
|
+
// After successful Reset, kTfLiteOk status will be returned. If Free is not
|
58
|
+
// implemented for a given kernel kTfLiteError will be returned.
|
59
|
+
TfLiteStatus Reset();
|
60
|
+
|
56
61
|
// Returns a pointer to the internal MockMicroGraph which KernelRunner uses
|
57
62
|
// to stub out MicroGraph methods and track invocations on each subgraph.
|
58
63
|
MockMicroGraph* GetMockGraph() { return &mock_micro_graph_; }
|
@@ -68,7 +73,7 @@ class KernelRunner {
|
|
68
73
|
|
69
74
|
TfLiteContext context_ = {};
|
70
75
|
TfLiteNode node_ = {};
|
71
|
-
const
|
76
|
+
const TFLMRegistration& registration_;
|
72
77
|
|
73
78
|
SingleArenaBufferAllocator* allocator_;
|
74
79
|
MockMicroGraph mock_micro_graph_;
|