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.
Files changed (147) hide show
  1. xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +16 -0
  2. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +80 -0
  3. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_interpolation.h +23 -0
  4. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +15 -15
  5. 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
  6. xmos_ai_tools/runtime/include/signal/micro/kernels/energy_flexbuffers_generated_data.h +28 -0
  7. xmos_ai_tools/runtime/include/signal/micro/kernels/fft_flexbuffers_generated_data.h +37 -0
  8. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_flexbuffers_generated_data.h +25 -0
  9. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_log_flexbuffers_generated_data.h +27 -0
  10. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_spectral_subtraction_flexbuffers_generated_data.h +26 -0
  11. xmos_ai_tools/runtime/include/signal/micro/kernels/framer_flexbuffers_generated_data.h +25 -0
  12. 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
  13. xmos_ai_tools/runtime/include/signal/micro/kernels/overlap_add_flexbuffers_generated_data.h +25 -0
  14. xmos_ai_tools/runtime/include/signal/micro/kernels/pcan_flexbuffers_generated_data.h +7 -0
  15. xmos_ai_tools/runtime/include/signal/micro/kernels/rfft.h +31 -0
  16. xmos_ai_tools/runtime/include/signal/micro/kernels/stacker_flexbuffers_generated_data.h +25 -0
  17. xmos_ai_tools/runtime/include/signal/micro/kernels/window_flexbuffers_generated_data.h +25 -0
  18. xmos_ai_tools/runtime/include/signal/src/circular_buffer.h +118 -0
  19. xmos_ai_tools/runtime/include/signal/src/complex.h +29 -0
  20. xmos_ai_tools/runtime/include/signal/src/energy.h +38 -0
  21. xmos_ai_tools/runtime/include/signal/src/fft_auto_scale.h +35 -0
  22. xmos_ai_tools/runtime/include/signal/src/filter_bank.h +69 -0
  23. xmos_ai_tools/runtime/include/signal/src/filter_bank_log.h +38 -0
  24. xmos_ai_tools/runtime/include/signal/src/filter_bank_spectral_subtraction.h +73 -0
  25. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/main_functions.h → signal/src/filter_bank_square_root.h} +14 -17
  26. xmos_ai_tools/runtime/include/signal/src/irfft.h +84 -0
  27. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_common.h +49 -0
  28. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_float.h +31 -0
  29. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int16.h +30 -0
  30. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int32.h +31 -0
  31. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h → signal/src/log.h} +13 -6
  32. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/python/interpreter/src/python_utils.h → signal/src/max_abs.h} +11 -11
  33. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h → signal/src/msb.h} +15 -6
  34. xmos_ai_tools/runtime/include/signal/src/overlap_add.h +46 -0
  35. xmos_ai_tools/runtime/include/signal/src/pcan_argc_fixed.h +41 -0
  36. xmos_ai_tools/runtime/include/signal/src/rfft.h +85 -0
  37. xmos_ai_tools/runtime/include/signal/src/square_root.h +32 -0
  38. xmos_ai_tools/runtime/include/{tensorflow/lite/micro/python/interpreter/src/numpy_utils.h → signal/src/window.h} +13 -15
  39. xmos_ai_tools/runtime/include/signal/testdata/fft_test_data.h +48 -0
  40. xmos_ai_tools/runtime/include/tensorflow/lite/array.h +156 -0
  41. xmos_ai_tools/runtime/include/tensorflow/lite/builtin_ops.h +44 -0
  42. xmos_ai_tools/runtime/include/tensorflow/lite/c/c_api_types.h +6 -0
  43. xmos_ai_tools/runtime/include/tensorflow/lite/c/common.h +8 -25
  44. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +3 -3
  45. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +15 -0
  46. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/builtin_op_data.h +92 -3
  47. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +61 -51
  48. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +302 -1
  49. xmos_ai_tools/runtime/include/tensorflow/lite/core/macros.h +78 -0
  50. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +129 -43
  51. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +2 -2
  52. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +23 -4
  53. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +210 -151
  54. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +9 -18
  55. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +2 -0
  56. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +103 -72
  57. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +2 -0
  58. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h +2 -63
  59. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +87 -26
  60. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +129 -80
  61. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +42 -93
  62. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +5 -0
  63. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +249 -263
  64. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +11 -1
  65. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +5 -1
  66. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +5 -10
  67. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +4 -2
  68. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +25 -14
  69. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/op_macros.h +14 -3
  70. xmos_ai_tools/runtime/include/tensorflow/lite/micro/debug_log.h +10 -3
  71. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h +37 -0
  72. xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +7 -0
  73. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +6 -5
  74. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +0 -3
  75. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +19 -20
  76. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +8 -31
  77. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +8 -8
  78. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +1 -1
  79. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +9 -9
  80. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +14 -9
  81. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +9 -4
  82. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +119 -100
  83. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +4 -4
  84. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +8 -8
  85. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +4 -4
  86. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +26 -0
  87. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +12 -16
  88. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +40 -0
  89. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +8 -7
  90. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +5 -5
  91. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa.h +2 -2
  92. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +26 -21
  93. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +4 -4
  94. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +2 -4
  95. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +2 -2
  96. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +5 -0
  97. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +4 -0
  98. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +4 -0
  99. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +4 -0
  100. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +23 -8
  101. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_common.h +38 -0
  102. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +23 -65
  103. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +15 -57
  104. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +16 -5
  105. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +125 -0
  106. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +110 -0
  107. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +6 -8
  108. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +114 -32
  109. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +6 -5
  110. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +1 -1
  111. xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +1 -1
  112. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/python_ops_resolver.h +21 -0
  113. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +3 -4
  114. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +28 -12
  115. xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +1 -0
  116. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +273 -0
  117. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +41 -0
  118. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +127 -0
  119. xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +9139 -5010
  120. xmos_ai_tools/runtime/lib/libhost_xtflitemicro.a +0 -0
  121. xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
  122. xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.1.0.1.dylib +0 -0
  123. xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.dylib +0 -0
  124. {xmos_ai_tools-1.1.2.dev216.data → xmos_ai_tools-1.1.2.dev236.data}/data/bin/xcore-opt +0 -0
  125. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/METADATA +3 -4
  126. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/RECORD +128 -105
  127. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/WHEEL +1 -1
  128. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/op_resolver.h +0 -129
  129. xmos_ai_tools/runtime/include/tensorflow/lite/micro/all_ops_resolver.h +0 -38
  130. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/audio_provider.h +0 -44
  131. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/command_responder.h +0 -30
  132. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/feature_provider.h +0 -50
  133. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h +0 -30
  134. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h +0 -43
  135. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h +0 -29
  136. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h +0 -29
  137. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/recognize_commands.h +0 -151
  138. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h +0 -29
  139. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h +0 -29
  140. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h +0 -43
  141. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h +0 -29
  142. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_simple_features_data.h +0 -23
  143. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_string.h +0 -33
  144. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/interpreter_wrapper.h +0 -51
  145. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/pybind11_lib.h +0 -64
  146. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/shared_library.h +0 -40
  147. {xmos_ai_tools-1.1.2.dev216.dist-info → xmos_ai_tools-1.1.2.dev236.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,125 @@
1
+ /* Copyright 2021 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_MICRO_INTERPRETER_CONTEXT_H_
17
+ #define TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_CONTEXT_H_
18
+
19
+ #include "tensorflow/lite/c/common.h"
20
+ #include "tensorflow/lite/micro/micro_allocator.h"
21
+ #include "tensorflow/lite/micro/micro_context.h"
22
+ #include "tensorflow/lite/micro/micro_interpreter_graph.h"
23
+ #include "tensorflow/lite/micro/micro_log.h"
24
+
25
+ namespace tflite {
26
+
27
+ // A full implementation of the MicroContext, to be used by the
28
+ // MicroInterpreter. Kernels should not depend on this directly. Instead they
29
+ // should only depend on the MicroContext.
30
+ class MicroInterpreterContext : public MicroContext {
31
+ public:
32
+ // Enum that allows MicroContext to keep track of the stages different memory
33
+ // planning APIs are available to kernels.
34
+ enum class InterpreterState {
35
+ kInit,
36
+ kPrepare,
37
+ kMemoryPlanning,
38
+ kInvoke,
39
+ };
40
+
41
+ // Does not take any ownership, and all pointers must refer to valid objects
42
+ // that outlive the one constructed.
43
+ MicroInterpreterContext(MicroAllocator* allocator, const Model* model,
44
+ MicroInterpreterGraph* graph);
45
+ virtual ~MicroInterpreterContext();
46
+
47
+ // Allocate persistent buffer which has the same life time as the interpreter.
48
+ // Returns nullptr on failure.
49
+ // The memory is allocated from the tail.
50
+ // This method is only available in Init or Prepare stage.
51
+ // Virtual so that it can be faked for kernel tests.
52
+ virtual void* AllocatePersistentBuffer(size_t bytes) override;
53
+
54
+ // Request a scratch buffer in the arena through static memory planning.
55
+ // This method is only available in Prepare stage and the buffer is allocated
56
+ // by the interpreter between Prepare and Eval stage. In Eval stage,
57
+ // GetScratchBuffer API can be used to fetch the address.
58
+ // Virtual so that it can be faked for kernel tests.
59
+ virtual TfLiteStatus RequestScratchBufferInArena(size_t bytes,
60
+ int* buffer_idx) override;
61
+
62
+ // Get the scratch buffer pointer.
63
+ // This method is only available in Eval stage.
64
+ // Virtual so that it can be faked for kernel tests.
65
+ virtual void* GetScratchBuffer(int buffer_idx) override;
66
+
67
+ // Returns a temporary TfLiteTensor struct for a given index.
68
+ // Virtual so that it can be faked for kernel tests.
69
+ virtual TfLiteTensor* AllocateTempTfLiteTensor(int tensor_idx) override;
70
+ virtual TfLiteTensor* AllocateTempTfLiteTensor(int tensor_idx, int sg) override;
71
+
72
+ // Deallocates a temp TfLiteTensor.
73
+ // Virtual so that it can be faked for kernel tests.
74
+ virtual void DeallocateTempTfLiteTensor(TfLiteTensor* tensor) override;
75
+
76
+ // Returns a pointer to a temporary buffer (from the arena).
77
+ // This API is only valid from the kernel's Prepare function and
78
+ // the buffer's lifetime is also that of the Prepare function.
79
+ // Virtual so that it can be faked for kernel tests.
80
+ virtual uint8_t* AllocateTempBuffer(size_t size, size_t alignment) override;
81
+
82
+ // Signals that the temporary buffer is no longer needed.
83
+ // Virtual so that it can be faked for kernel tests.
84
+ virtual void DeallocateTempBuffer(uint8_t* buffer) override;
85
+
86
+ // Returns a TfLiteEvalTensor struct for a given index.
87
+ // Virtual so that it can be faked for kernel tests.
88
+ virtual TfLiteEvalTensor* GetEvalTensor(int tensor_idx) override;
89
+ virtual TfLiteEvalTensor* GetEvalTensor(int tensor_idx, int sg) override;
90
+
91
+ // Sets the State of MemoryPlanning MicroInterpreterContext
92
+ void SetInterpreterState(InterpreterState state);
93
+
94
+ // Sets the State of MemoryPlanning MicroInterpreterContext
95
+ InterpreterState GetInterpreterState() const;
96
+
97
+ // Does not take ownership of the pointer and the pointer must refer to valid
98
+ // an object that outlive this class instance.
99
+ // This can only be called once to set one external context.
100
+ TfLiteStatus set_external_context(void* external_context_payload) override;
101
+
102
+ void* external_context() override { return external_context_payload_; }
103
+
104
+ MicroGraph& graph() override { return graph_; }
105
+
106
+ // Sets the pointer to a list of ScratchBufferHandle instances.
107
+ // Not API between TFLM and kernels. Primarily used by the framework for
108
+ // housekeeping in MicroInterpreterContext.
109
+ void SetScratchBufferHandles(ScratchBufferHandle* scratch_buffer_handles);
110
+
111
+ private:
112
+ MicroAllocator& allocator_;
113
+ MicroInterpreterGraph& graph_;
114
+ const Model* model_;
115
+ InterpreterState state_;
116
+
117
+ ScratchBufferHandle* scratch_buffer_handles_ = nullptr;
118
+ void* external_context_payload_ = nullptr;
119
+
120
+ TF_LITE_REMOVE_VIRTUAL_DELETE
121
+ };
122
+
123
+ } // namespace tflite
124
+
125
+ #endif // TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_CONTEXT_H_
@@ -0,0 +1,110 @@
1
+ /* Copyright 2021 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_MICRO_INTERPRETER_GRAPH_H_
17
+ #define TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_GRAPH_H_
18
+
19
+ #include "tensorflow/lite/micro/micro_allocator.h"
20
+ #include "tensorflow/lite/micro/micro_common.h"
21
+ #include "tensorflow/lite/micro/micro_graph.h"
22
+ #include "tensorflow/lite/micro/micro_resource_variable.h"
23
+ #include "tensorflow/lite/schema/schema_generated.h"
24
+
25
+ namespace tflite {
26
+
27
+ // Abstracts the details of interacting with the tflite::Model.
28
+ //
29
+ // Provides methods to access, initialize, prepare, invoke and free any
30
+ // subgraph in the tflite::Graph.
31
+ class MicroInterpreterGraph : public MicroGraph {
32
+ public:
33
+ // The lifetime of the context, model, allocator and resource_variables must
34
+ // be at least as long as that of the graph object, since the this class may
35
+ // need to access them at any time. If resource_variables is a nullptr,
36
+ // GetResourceVariables will return a nullptr.
37
+ MicroInterpreterGraph(TfLiteContext* context, const Model* model,
38
+ MicroAllocator* allocator,
39
+ MicroResourceVariables* resource_variables);
40
+ virtual ~MicroInterpreterGraph();
41
+
42
+ // Sets up builtin data and calls TFLMRegistration->Init for every
43
+ // operator in every subgraph in the model.
44
+ virtual TfLiteStatus InitSubgraphs();
45
+
46
+ // Calls TFLMRegistration->Prepare for every operator in every subgraph
47
+ // in the model.
48
+ virtual TfLiteStatus PrepareSubgraphs();
49
+
50
+ // Calls TFLMRegistration->Reset for every operator in every subgraph in
51
+ // the model.
52
+ virtual TfLiteStatus ResetSubgraphs();
53
+
54
+ // Calls TFLMRegistration->Free for every operator in every subgraph in
55
+ // the model.
56
+ virtual TfLiteStatus FreeSubgraphs();
57
+
58
+ // Calls TFLMRegistration->Invoke for every operator in a single subgraph
59
+ // in the model.
60
+ virtual TfLiteStatus InvokeSubgraph(int subgraph_idx);
61
+
62
+ // Zeros out all variable tensors in all subgraphs in the model.
63
+ virtual TfLiteStatus ResetVariableTensors();
64
+
65
+ // Number of tensor inputs to a specified subgraph in the model.
66
+ virtual size_t NumSubgraphInputs(int subgraph_idx);
67
+
68
+ // Get the specified input tensor of a specified subgraph in the model.
69
+ virtual TfLiteEvalTensor* GetSubgraphInput(int subgraph_idx, int input_idx);
70
+
71
+ // Number of tensor outputs from a specified subgraph in the model.
72
+ virtual size_t NumSubgraphOutputs(int subgraph_idx);
73
+
74
+ // Get the specified output tensor of a specified subgraph in the model.
75
+ virtual TfLiteEvalTensor* GetSubgraphOutput(int subgraph_idx, int output_idx);
76
+
77
+ // Number of subgraphs in the model.
78
+ virtual int NumSubgraphs();
79
+
80
+ // Hook to pass in subgraph allocations tracked within the interpreter,
81
+ // allowing MicroInterpreterGraph to init / prepare / invoke subgraphs in the
82
+ // model.
83
+ void SetSubgraphAllocations(SubgraphAllocations* subgraph_allocations);
84
+
85
+ // Get the current subgraph index. Within an on operator, this is guaranteed
86
+ // to be the subgraph of that operator.
87
+ int GetCurrentSubgraphIndex() { return current_subgraph_index_; }
88
+
89
+ // Gets the list of alloctions for each subgraph. This is the source of truth
90
+ // for all per-subgraph allocation data.
91
+ SubgraphAllocations* GetAllocations() { return subgraph_allocations_; }
92
+
93
+ // Get the resource variables for this TFLM graph.
94
+ MicroResourceVariables* GetResourceVariables() { return resource_variables_; }
95
+
96
+ private:
97
+ TfLiteContext* context_;
98
+ const Model* model_;
99
+ MicroAllocator* allocator_;
100
+ SubgraphAllocations* subgraph_allocations_ = nullptr;
101
+ int current_subgraph_index_;
102
+ MicroResourceVariables* resource_variables_;
103
+ const flatbuffers::Vector<flatbuffers::Offset<SubGraph>>* subgraphs_;
104
+
105
+ TF_LITE_REMOVE_VIRTUAL_DELETE
106
+ };
107
+
108
+ } // namespace tflite
109
+
110
+ #endif // TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_GRAPH_H_
@@ -1,4 +1,4 @@
1
- /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
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,20 +15,17 @@ limitations under the License.
15
15
  #ifndef TENSORFLOW_LITE_MICRO_MICRO_LOG_H_
16
16
  #define TENSORFLOW_LITE_MICRO_MICRO_LOG_H_
17
17
 
18
- #include <cstdarg>
19
-
20
- // This is a free function used to perform the actual logging.
21
- // This function will be used by MicroPrintf and MicroErrorReporter::Report()
22
- void Log(const char* format, va_list args);
23
-
24
18
  #if !defined(TF_LITE_STRIP_ERROR_STRINGS)
25
- // This function can be used independent of the MicroErrorReporter to get
19
+ #include <cstdarg>
20
+ // These functions can be used independent of the MicroErrorReporter to get
26
21
  // printf-like functionalitys and are common to all target platforms.
27
22
  void MicroPrintf(const char* format, ...);
23
+ void VMicroPrintf(const char* format, va_list args);
28
24
  #else
29
25
  // We use a #define to ensure that the strings are completely stripped, to
30
26
  // prevent an unnecessary increase in the binary size.
31
27
  #define MicroPrintf(...) tflite::Unused(__VA_ARGS__)
28
+ #define VMicroPrintf(...) tflite::Unused(__VA_ARGS__)
32
29
  #endif
33
30
 
34
31
  namespace tflite {
@@ -39,6 +36,7 @@ template <typename... Args>
39
36
  void Unused(Args&&... args) {
40
37
  (void)(sizeof...(args));
41
38
  }
39
+
42
40
  } // namespace tflite
43
41
 
44
42
  #endif // TENSORFLOW_LITE_MICRO_MICRO_LOG_H_
@@ -37,7 +37,7 @@ limitations under the License.
37
37
  #include "tensorflow/lite/schema/schema_generated.h"
38
38
 
39
39
  namespace tflite {
40
- TfLiteRegistration_V1* Register_DETECTION_POSTPROCESS();
40
+ TFLMRegistration* Register_DETECTION_POSTPROCESS();
41
41
 
42
42
  template <unsigned int tOpCount>
43
43
  class MicroMutableOpResolver : public MicroOpResolver {
@@ -46,12 +46,11 @@ class MicroMutableOpResolver : public MicroOpResolver {
46
46
 
47
47
  explicit MicroMutableOpResolver() {}
48
48
 
49
- const TfLiteRegistration_V1* FindOp(
50
- tflite::BuiltinOperator op) const override {
49
+ const TFLMRegistration* FindOp(tflite::BuiltinOperator op) const override {
51
50
  if (op == BuiltinOperator_CUSTOM) return nullptr;
52
51
 
53
52
  for (unsigned int i = 0; i < registrations_len_; ++i) {
54
- const TfLiteRegistration_V1& registration = registrations_[i];
53
+ const TFLMRegistration& registration = registrations_[i];
55
54
  if (registration.builtin_code == op) {
56
55
  return &registration;
57
56
  }
@@ -59,9 +58,9 @@ class MicroMutableOpResolver : public MicroOpResolver {
59
58
  return nullptr;
60
59
  }
61
60
 
62
- const TfLiteRegistration_V1* FindOp(const char* op) const override {
61
+ const TFLMRegistration* FindOp(const char* op) const override {
63
62
  for (unsigned int i = 0; i < registrations_len_; ++i) {
64
- const TfLiteRegistration_V1& registration = registrations_[i];
63
+ const TFLMRegistration& registration = registrations_[i];
65
64
  if ((registration.builtin_code == BuiltinOperator_CUSTOM) &&
66
65
  (strcmp(registration.custom_name, op) == 0)) {
67
66
  return &registration;
@@ -86,7 +85,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
86
85
  // MicroOpResolver will be unchanged and this function will return
87
86
  // kTfLiteError.
88
87
  TfLiteStatus AddCustom(const char* name,
89
- TfLiteRegistration_V1* registration) {
88
+ const TFLMRegistration* registration) {
90
89
  if (registrations_len_ >= tOpCount) {
91
90
  MicroPrintf(
92
91
  "Couldn't register custom op '%s', resolver size is too"
@@ -101,8 +100,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
101
100
  return kTfLiteError;
102
101
  }
103
102
 
104
- TfLiteRegistration_V1* new_registration =
105
- &registrations_[registrations_len_];
103
+ TFLMRegistration* new_registration = &registrations_[registrations_len_];
106
104
  registrations_len_ += 1;
107
105
 
108
106
  *new_registration = *registration;
@@ -118,8 +116,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
118
116
  return AddBuiltin(BuiltinOperator_ABS, Register_ABS(), ParseAbs);
119
117
  }
120
118
 
121
- TfLiteStatus AddAdd(
122
- const TfLiteRegistration_V1& registration = Register_ADD()) {
119
+ TfLiteStatus AddAdd(const TFLMRegistration& registration = Register_ADD()) {
123
120
  return AddBuiltin(BuiltinOperator_ADD, registration, ParseAdd);
124
121
  }
125
122
 
@@ -142,10 +139,15 @@ class MicroMutableOpResolver : public MicroOpResolver {
142
139
  }
143
140
 
144
141
  TfLiteStatus AddAveragePool2D(
145
- const TfLiteRegistration_V1& registration = Register_AVERAGE_POOL_2D()) {
142
+ const TFLMRegistration& registration = Register_AVERAGE_POOL_2D()) {
146
143
  return AddBuiltin(BuiltinOperator_AVERAGE_POOL_2D, registration, ParsePool);
147
144
  }
148
145
 
146
+ TfLiteStatus AddBatchMatMul() {
147
+ return AddBuiltin(BuiltinOperator_BATCH_MATMUL,
148
+ tflite::Register_BATCH_MATMUL(), ParseBatchMatMul);
149
+ }
150
+
149
151
  TfLiteStatus AddBatchToSpaceNd() {
150
152
  return AddBuiltin(BuiltinOperator_BATCH_TO_SPACE_ND,
151
153
  Register_BATCH_TO_SPACE_ND(), ParseBatchToSpaceNd);
@@ -184,7 +186,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
184
186
  }
185
187
 
186
188
  TfLiteStatus AddConv2D(
187
- const TfLiteRegistration_V1& registration = Register_CONV_2D()) {
189
+ const TFLMRegistration& registration = Register_CONV_2D()) {
188
190
  return AddBuiltin(BuiltinOperator_CONV_2D, registration, ParseConv2D);
189
191
  }
190
192
 
@@ -197,13 +199,18 @@ class MicroMutableOpResolver : public MicroOpResolver {
197
199
  ParseCumsum);
198
200
  }
199
201
 
202
+ TfLiteStatus AddDelay() {
203
+ // TODO(b/286250473): change back name to "Delay" and remove namespace
204
+ return AddCustom("SignalDelay", tflite::tflm_signal::Register_DELAY());
205
+ }
206
+
200
207
  TfLiteStatus AddDepthToSpace() {
201
208
  return AddBuiltin(BuiltinOperator_DEPTH_TO_SPACE,
202
209
  tflite::Register_DEPTH_TO_SPACE(), ParseDepthToSpace);
203
210
  }
204
211
 
205
- TfLiteStatus AddDepthwiseConv2D(const TfLiteRegistration_V1& registration =
206
- Register_DEPTHWISE_CONV_2D()) {
212
+ TfLiteStatus AddDepthwiseConv2D(
213
+ const TFLMRegistration& registration = Register_DEPTHWISE_CONV_2D()) {
207
214
  return AddBuiltin(BuiltinOperator_DEPTHWISE_CONV_2D, registration,
208
215
  ParseDepthwiseConv2D);
209
216
  }
@@ -222,6 +229,16 @@ class MicroMutableOpResolver : public MicroOpResolver {
222
229
  return AddBuiltin(BuiltinOperator_DIV, tflite::Register_DIV(), ParseDiv);
223
230
  }
224
231
 
232
+ TfLiteStatus AddEmbeddingLookup() {
233
+ return AddBuiltin(BuiltinOperator_EMBEDDING_LOOKUP,
234
+ Register_EMBEDDING_LOOKUP(), ParseEmbeddingLookup);
235
+ }
236
+
237
+ TfLiteStatus AddEnergy() {
238
+ // TODO(b/286250473): change back name to "Energy" and remove namespace
239
+ return AddCustom("SignalEnergy", tflite::tflm_signal::Register_ENERGY());
240
+ }
241
+
225
242
  TfLiteStatus AddElu() {
226
243
  return AddBuiltin(BuiltinOperator_ELU, tflite::Register_ELU(), ParseElu);
227
244
  }
@@ -231,7 +248,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
231
248
  }
232
249
 
233
250
  TfLiteStatus AddEthosU() {
234
- TfLiteRegistration_V1* registration = tflite::Register_ETHOSU();
251
+ TFLMRegistration* registration = tflite::Register_ETHOSU();
235
252
  if (registration) {
236
253
  return AddCustom(tflite::GetString_ETHOSU(), registration);
237
254
  }
@@ -247,10 +264,41 @@ class MicroMutableOpResolver : public MicroOpResolver {
247
264
  ParseExpandDims);
248
265
  }
249
266
 
267
+ TfLiteStatus AddFftAutoScale() {
268
+ // TODO(b/286250473): change back name and remove namespace
269
+ return AddCustom("SignalFftAutoScale",
270
+ tflite::tflm_signal::Register_FFT_AUTO_SCALE());
271
+ }
272
+
250
273
  TfLiteStatus AddFill() {
251
274
  return AddBuiltin(BuiltinOperator_FILL, tflite::Register_FILL(), ParseFill);
252
275
  }
253
276
 
277
+ TfLiteStatus AddFilterBank() {
278
+ // TODO(b/286250473): change back name to "FilterBank" and remove namespace
279
+ return AddCustom("SignalFilterBank",
280
+ tflite::tflm_signal::Register_FILTER_BANK());
281
+ }
282
+ TfLiteStatus AddFilterBankLog() {
283
+ // TODO(b/286250473): change back name to "FilterBankLog" and remove
284
+ // namespace
285
+ return AddCustom("SignalFilterBankLog",
286
+ tflite::tflm_signal::Register_FILTER_BANK_LOG());
287
+ }
288
+ TfLiteStatus AddFilterBankSquareRoot() {
289
+ // TODO(b/286250473): change back name to "FilterBankSquareRoot" and remove
290
+ // namespace
291
+ return AddCustom("SignalFilterBankSquareRoot",
292
+ tflite::tflm_signal::Register_FILTER_BANK_SQUARE_ROOT());
293
+ }
294
+ TfLiteStatus AddFilterBankSpectralSubtraction() {
295
+ // TODO(b/286250473): change back name to "FilterBankSpectralSubtraction"
296
+ // and remove namespace
297
+ return AddCustom(
298
+ "SignalFilterBankSpectralSubtraction",
299
+ tflite::tflm_signal::Register_FILTER_BANK_SPECTRAL_SUBTRACTION());
300
+ }
301
+
254
302
  TfLiteStatus AddFloor() {
255
303
  return AddBuiltin(BuiltinOperator_FLOOR, Register_FLOOR(), ParseFloor);
256
304
  }
@@ -265,8 +313,13 @@ class MicroMutableOpResolver : public MicroOpResolver {
265
313
  ParseFloorMod);
266
314
  }
267
315
 
316
+ TfLiteStatus AddFramer() {
317
+ // TODO(b/286250473): change back name to "Framer" and remove namespace
318
+ return AddCustom("SignalFramer", tflite::tflm_signal::Register_FRAMER());
319
+ }
320
+
268
321
  TfLiteStatus AddFullyConnected(
269
- const TfLiteRegistration_V1& registration = Register_FULLY_CONNECTED()) {
322
+ const TFLMRegistration& registration = Register_FULLY_CONNECTED()) {
270
323
  return AddBuiltin(BuiltinOperator_FULLY_CONNECTED, registration,
271
324
  ParseFullyConnected);
272
325
  }
@@ -300,6 +353,12 @@ class MicroMutableOpResolver : public MicroOpResolver {
300
353
  return AddBuiltin(BuiltinOperator_IF, tflite::Register_IF(), ParseIf);
301
354
  }
302
355
 
356
+ TfLiteStatus AddIrfft(const TFLMRegistration* registration =
357
+ tflite::tflm_signal::Register_IRFFT()) {
358
+ // TODO(b/286250473): change back name and remove namespace
359
+ return AddCustom("SignalIrfft", registration);
360
+ }
361
+
303
362
  TfLiteStatus AddL2Normalization() {
304
363
  return AddBuiltin(BuiltinOperator_L2_NORMALIZATION,
305
364
  Register_L2_NORMALIZATION(), ParseL2Normalization);
@@ -359,7 +418,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
359
418
  }
360
419
 
361
420
  TfLiteStatus AddMaxPool2D(
362
- const TfLiteRegistration_V1& registration = Register_MAX_POOL_2D()) {
421
+ const TFLMRegistration& registration = Register_MAX_POOL_2D()) {
363
422
  return AddBuiltin(BuiltinOperator_MAX_POOL_2D, registration, ParsePool);
364
423
  }
365
424
 
@@ -377,8 +436,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
377
436
  ParseMinimum);
378
437
  }
379
438
 
380
- TfLiteStatus AddMul(
381
- const TfLiteRegistration_V1& registration = Register_MUL()) {
439
+ TfLiteStatus AddMul(const TFLMRegistration& registration = Register_MUL()) {
382
440
  return AddBuiltin(BuiltinOperator_MUL, registration, ParseMul);
383
441
  }
384
442
 
@@ -391,12 +449,17 @@ class MicroMutableOpResolver : public MicroOpResolver {
391
449
  ParseNotEqual);
392
450
  }
393
451
 
452
+ TfLiteStatus AddOverlapAdd() {
453
+ // TODO(b/286250473): change back name to "OverlapAdd" and remove namespace
454
+ return AddCustom("SignalOverlapAdd",
455
+ tflite::tflm_signal::Register_OVERLAP_ADD());
456
+ }
457
+
394
458
  TfLiteStatus AddPack() {
395
459
  return AddBuiltin(BuiltinOperator_PACK, Register_PACK(), ParsePack);
396
460
  }
397
461
 
398
- TfLiteStatus AddPad(
399
- const TfLiteRegistration_V1& registration = Register_PAD()) {
462
+ TfLiteStatus AddPad(const TFLMRegistration& registration = Register_PAD()) {
400
463
  return AddBuiltin(BuiltinOperator_PAD, registration, ParsePad);
401
464
  }
402
465
 
@@ -404,6 +467,11 @@ class MicroMutableOpResolver : public MicroOpResolver {
404
467
  return AddBuiltin(BuiltinOperator_PADV2, Register_PADV2(), ParsePadV2);
405
468
  }
406
469
 
470
+ TfLiteStatus AddPCAN() {
471
+ // TODO(b/286250473): change back name to "PCAN" and remove namespace
472
+ return AddCustom("SignalPCAN", tflite::tflm_signal::Register_PCAN());
473
+ }
474
+
407
475
  TfLiteStatus AddPrelu() {
408
476
  return AddBuiltin(BuiltinOperator_PRELU, tflite::Register_PRELU(),
409
477
  ParsePrelu);
@@ -434,8 +502,8 @@ class MicroMutableOpResolver : public MicroOpResolver {
434
502
  }
435
503
 
436
504
  TfLiteStatus AddReshape() {
437
- return AddBuiltin(BuiltinOperator_RESHAPE,
438
- tflite::ops::micro::Register_RESHAPE(), ParseReshape);
505
+ return AddBuiltin(BuiltinOperator_RESHAPE, Register_RESHAPE(),
506
+ ParseReshape);
439
507
  }
440
508
 
441
509
  TfLiteStatus AddResizeBilinear() {
@@ -449,9 +517,14 @@ class MicroMutableOpResolver : public MicroOpResolver {
449
517
  ParseResizeNearestNeighbor);
450
518
  }
451
519
 
520
+ TfLiteStatus AddRfft(const TFLMRegistration* registration =
521
+ tflite::tflm_signal::Register_RFFT()) {
522
+ // TODO(b/286250473): change back name and remove namespace
523
+ return AddCustom("SignalRfft", registration);
524
+ }
525
+
452
526
  TfLiteStatus AddRound() {
453
- return AddBuiltin(BuiltinOperator_ROUND,
454
- tflite::ops::micro::Register_ROUND(), ParseRound);
527
+ return AddBuiltin(BuiltinOperator_ROUND, Register_ROUND(), ParseRound);
455
528
  }
456
529
 
457
530
  TfLiteStatus AddRsqrt() {
@@ -476,7 +549,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
476
549
  }
477
550
 
478
551
  TfLiteStatus AddSoftmax(
479
- const TfLiteRegistration_V1& registration = Register_SOFTMAX()) {
552
+ const TFLMRegistration& registration = Register_SOFTMAX()) {
480
553
  return AddBuiltin(BuiltinOperator_SOFTMAX, registration, ParseSoftmax);
481
554
  }
482
555
 
@@ -522,6 +595,11 @@ class MicroMutableOpResolver : public MicroOpResolver {
522
595
  ParseStridedSlice);
523
596
  }
524
597
 
598
+ TfLiteStatus AddStacker() {
599
+ // TODO(b/286250473): change back name to "Stacker" and remove namespace
600
+ return AddCustom("SignalStacker", tflite::tflm_signal::Register_STACKER());
601
+ }
602
+
525
603
  TfLiteStatus AddSub() {
526
604
  return AddBuiltin(BuiltinOperator_SUB, tflite::Register_SUB(), ParseSub);
527
605
  }
@@ -530,8 +608,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
530
608
  return AddBuiltin(BuiltinOperator_SUM, Register_SUM(), ParseReducer);
531
609
  }
532
610
 
533
- TfLiteStatus AddSvdf(
534
- const TfLiteRegistration_V1& registration = Register_SVDF()) {
611
+ TfLiteStatus AddSvdf(const TFLMRegistration& registration = Register_SVDF()) {
535
612
  return AddBuiltin(BuiltinOperator_SVDF, registration, ParseSvdf);
536
613
  }
537
614
 
@@ -554,7 +631,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
554
631
  }
555
632
 
556
633
  TfLiteStatus AddUnidirectionalSequenceLSTM(
557
- const TfLiteRegistration_V1& registration =
634
+ const TFLMRegistration& registration =
558
635
  Register_UNIDIRECTIONAL_SEQUENCE_LSTM()) {
559
636
  return AddBuiltin(BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_LSTM,
560
637
  registration, ParseUnidirectionalSequenceLSTM);
@@ -569,6 +646,11 @@ class MicroMutableOpResolver : public MicroOpResolver {
569
646
  return AddBuiltin(BuiltinOperator_WHILE, Register_WHILE(), ParseWhile);
570
647
  }
571
648
 
649
+ TfLiteStatus AddWindow() {
650
+ // TODO(b/286250473): change back name to "Window" and remove namespace
651
+ return AddCustom("SignalWindow", tflite::tflm_signal::Register_WINDOW());
652
+ }
653
+
572
654
  TfLiteStatus AddZerosLike() {
573
655
  return AddBuiltin(BuiltinOperator_ZEROS_LIKE, Register_ZEROS_LIKE(),
574
656
  ParseZerosLike);
@@ -578,7 +660,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
578
660
 
579
661
  private:
580
662
  TfLiteStatus AddBuiltin(tflite::BuiltinOperator op,
581
- const TfLiteRegistration_V1& registration,
663
+ const TFLMRegistration& registration,
582
664
  TfLiteBridgeBuiltinParseFunction parser) {
583
665
  if (op == BuiltinOperator_CUSTOM) {
584
666
  MicroPrintf("Invalid parameter BuiltinOperator_CUSTOM to the ");
@@ -611,7 +693,7 @@ class MicroMutableOpResolver : public MicroOpResolver {
611
693
  return kTfLiteOk;
612
694
  }
613
695
 
614
- TfLiteRegistration_V1 registrations_[tOpCount];
696
+ TFLMRegistration registrations_[tOpCount];
615
697
  unsigned int registrations_len_ = 0;
616
698
 
617
699
  // Arrays (and counter) to store the builtin codes and their corresponding
@@ -16,6 +16,7 @@ limitations under the License.
16
16
  #define TENSORFLOW_LITE_MICRO_MICRO_OP_RESOLVER_H_
17
17
 
18
18
  #include "tensorflow/lite/c/common.h"
19
+ #include "tensorflow/lite/micro/micro_common.h"
19
20
  #include "tensorflow/lite/micro/tflite_bridge/flatbuffer_conversions_bridge.h"
20
21
  #include "tensorflow/lite/schema/schema_generated.h"
21
22
 
@@ -35,11 +36,11 @@ class MicroOpResolver {
35
36
  // Returns the Op registration struct corresponding to the enum code from the
36
37
  // flatbuffer schema. Returns nullptr if the op is not found or if op ==
37
38
  // BuiltinOperator_CUSTOM.
38
- virtual const TfLiteRegistration_V1* FindOp(BuiltinOperator op) const = 0;
39
+ virtual const TFLMRegistration* FindOp(BuiltinOperator op) const = 0;
39
40
 
40
41
  // Returns the Op registration struct corresponding to the custom operator by
41
42
  // name.
42
- virtual const TfLiteRegistration_V1* FindOp(const char* op) const = 0;
43
+ virtual const TFLMRegistration* FindOp(const char* op) const = 0;
43
44
 
44
45
  // Returns the operator specific parsing function for the OpData for a
45
46
  // BuiltinOperator (if registered), else nullptr.
@@ -52,9 +53,9 @@ class MicroOpResolver {
52
53
  // Handles the logic for converting between an OperatorCode structure extracted
53
54
  // from a flatbuffer and information about a registered operator
54
55
  // implementation.
55
- TfLiteStatus GetRegistrationFromOpCode(
56
- const OperatorCode* opcode, const MicroOpResolver& op_resolver,
57
- const TfLiteRegistration_V1** registration);
56
+ TfLiteStatus GetRegistrationFromOpCode(const OperatorCode* opcode,
57
+ const MicroOpResolver& op_resolver,
58
+ const TFLMRegistration** registration);
58
59
 
59
60
  } // namespace tflite
60
61
 
@@ -87,7 +87,7 @@ class MicroProfiler : public MicroProfilerInterface {
87
87
 
88
88
  int FindExistingOrNextPosition(const char* tag_name);
89
89
 
90
- TF_LITE_REMOVE_VIRTUAL_DELETE;
90
+ TF_LITE_REMOVE_VIRTUAL_DELETE
91
91
  };
92
92
 
93
93
  #if defined(TF_LITE_STRIP_ERROR_STRINGS)
@@ -30,13 +30,13 @@ class MockMicroGraph : public MicroGraph {
30
30
  public:
31
31
  explicit MockMicroGraph(SingleArenaBufferAllocator* allocator);
32
32
  TfLiteStatus InvokeSubgraph(int subgraph_idx) override;
33
- TfLiteStatus ResetVariableTensors() override;
34
33
  size_t NumSubgraphInputs(int subgraph_idx) override;
35
34
  TfLiteEvalTensor* GetSubgraphInput(int subgraph_idx, int tensor_idx) override;
36
35
  size_t NumSubgraphOutputs(int subgraph_idx) override;
37
36
  TfLiteEvalTensor* GetSubgraphOutput(int subgraph_idx,
38
37
  int tensor_idx) override;
39
38
  int NumSubgraphs() override;
39
+ MicroResourceVariables* GetResourceVariables() override;
40
40
  int get_init_count() const { return init_count_; }
41
41
  int get_prepare_count() const { return prepare_count_; }
42
42
  int get_free_count() const { return free_count_; }