xmos-ai-tools 1.3.2.dev80__py3-none-macosx_10_15_universal2.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 (395) hide show
  1. xmos_ai_tools/__init__.py +7 -0
  2. xmos_ai_tools/io_server/__init__.py +151 -0
  3. xmos_ai_tools/runtime/__init__.py +0 -0
  4. xmos_ai_tools/runtime/buildfiles/aitoolslib.cmake +13 -0
  5. xmos_ai_tools/runtime/buildfiles/aitoolslib.make +8 -0
  6. xmos_ai_tools/runtime/include/flash_server.h +74 -0
  7. xmos_ai_tools/runtime/include/flatbuffers/allocator.h +68 -0
  8. xmos_ai_tools/runtime/include/flatbuffers/array.h +243 -0
  9. xmos_ai_tools/runtime/include/flatbuffers/base.h +474 -0
  10. xmos_ai_tools/runtime/include/flatbuffers/bfbs_generator.h +43 -0
  11. xmos_ai_tools/runtime/include/flatbuffers/buffer.h +142 -0
  12. xmos_ai_tools/runtime/include/flatbuffers/buffer_ref.h +53 -0
  13. xmos_ai_tools/runtime/include/flatbuffers/code_generators.h +235 -0
  14. xmos_ai_tools/runtime/include/flatbuffers/default_allocator.h +64 -0
  15. xmos_ai_tools/runtime/include/flatbuffers/detached_buffer.h +114 -0
  16. xmos_ai_tools/runtime/include/flatbuffers/flatbuffer_builder.h +1197 -0
  17. xmos_ai_tools/runtime/include/flatbuffers/flatbuffers.h +270 -0
  18. xmos_ai_tools/runtime/include/flatbuffers/flatc.h +111 -0
  19. xmos_ai_tools/runtime/include/flatbuffers/flexbuffers.h +1897 -0
  20. xmos_ai_tools/runtime/include/flatbuffers/grpc.h +300 -0
  21. xmos_ai_tools/runtime/include/flatbuffers/hash.h +127 -0
  22. xmos_ai_tools/runtime/include/flatbuffers/idl.h +1232 -0
  23. xmos_ai_tools/runtime/include/flatbuffers/minireflect.h +419 -0
  24. xmos_ai_tools/runtime/include/flatbuffers/pch/flatc_pch.h +39 -0
  25. xmos_ai_tools/runtime/include/flatbuffers/pch/pch.h +38 -0
  26. xmos_ai_tools/runtime/include/flatbuffers/reflection.h +502 -0
  27. xmos_ai_tools/runtime/include/flatbuffers/reflection_generated.h +1449 -0
  28. xmos_ai_tools/runtime/include/flatbuffers/registry.h +128 -0
  29. xmos_ai_tools/runtime/include/flatbuffers/stl_emulation.h +509 -0
  30. xmos_ai_tools/runtime/include/flatbuffers/string.h +64 -0
  31. xmos_ai_tools/runtime/include/flatbuffers/struct.h +53 -0
  32. xmos_ai_tools/runtime/include/flatbuffers/table.h +168 -0
  33. xmos_ai_tools/runtime/include/flatbuffers/util.h +690 -0
  34. xmos_ai_tools/runtime/include/flatbuffers/vector.h +370 -0
  35. xmos_ai_tools/runtime/include/flatbuffers/vector_downward.h +271 -0
  36. xmos_ai_tools/runtime/include/flatbuffers/verifier.h +283 -0
  37. xmos_ai_tools/runtime/include/ioserver.h +44 -0
  38. xmos_ai_tools/runtime/include/lib_nn/api/TransposeConv.h +24 -0
  39. xmos_ai_tools/runtime/include/lib_nn/api/add_int16.h +27 -0
  40. xmos_ai_tools/runtime/include/lib_nn/api/add_int16_transform.h +42 -0
  41. xmos_ai_tools/runtime/include/lib_nn/api/dequantize_int16.h +22 -0
  42. xmos_ai_tools/runtime/include/lib_nn/api/dequantize_int16_transform.h +34 -0
  43. xmos_ai_tools/runtime/include/lib_nn/api/expand_8_to_16.h +8 -0
  44. xmos_ai_tools/runtime/include/lib_nn/api/multiply_int16.h +42 -0
  45. xmos_ai_tools/runtime/include/lib_nn/api/multiply_int16_transform.h +71 -0
  46. xmos_ai_tools/runtime/include/lib_nn/api/nn_api.h +15 -0
  47. xmos_ai_tools/runtime/include/lib_nn/api/nn_bin_types.h +14 -0
  48. xmos_ai_tools/runtime/include/lib_nn/api/nn_config.h +287 -0
  49. xmos_ai_tools/runtime/include/lib_nn/api/nn_conv2d_structs.h +72 -0
  50. xmos_ai_tools/runtime/include/lib_nn/api/nn_image.h +26 -0
  51. xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +303 -0
  52. xmos_ai_tools/runtime/include/lib_nn/api/nn_op_helper.h +132 -0
  53. xmos_ai_tools/runtime/include/lib_nn/api/nn_op_utils.h +150 -0
  54. xmos_ai_tools/runtime/include/lib_nn/api/nn_operator.h +18 -0
  55. xmos_ai_tools/runtime/include/lib_nn/api/nn_pooling.h +551 -0
  56. xmos_ai_tools/runtime/include/lib_nn/api/nn_types.h +83 -0
  57. xmos_ai_tools/runtime/include/lib_nn/api/nn_window_params.h +55 -0
  58. xmos_ai_tools/runtime/include/lib_nn/api/output_transform_fn_int16.h +54 -0
  59. xmos_ai_tools/runtime/include/lib_nn/api/output_transform_fn_int16_kernel_transform.h +37 -0
  60. xmos_ai_tools/runtime/include/lib_nn/api/output_transform_fn_int16_mappings.h +13 -0
  61. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +82 -0
  62. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_interpolation.h +23 -0
  63. xmos_ai_tools/runtime/include/lib_nn/api/quantize_int16.h +22 -0
  64. xmos_ai_tools/runtime/include/lib_nn/api/quantize_int16_transform.h +33 -0
  65. xmos_ai_tools/runtime/include/lib_nn/api/version.h +13 -0
  66. xmos_ai_tools/runtime/include/lib_nn/api/vpu_memmove_word_aligned.h +15 -0
  67. xmos_ai_tools/runtime/include/lib_nn/api/vpu_memset_256.h +55 -0
  68. xmos_ai_tools/runtime/include/lib_nn/api/vpu_sim.h +118 -0
  69. xmos_ai_tools/runtime/include/lib_nn/api/xs3_vpu.h +216 -0
  70. xmos_ai_tools/runtime/include/lib_nn/api/xs3a_registers.h +2869 -0
  71. xmos_ai_tools/runtime/include/lib_nn/src/asm/asm_constants.h +41 -0
  72. xmos_ai_tools/runtime/include/lib_nn/src/asm/window_op_plan.h +25 -0
  73. xmos_ai_tools/runtime/include/lib_tflite_micro/api/fast_flash.h +47 -0
  74. xmos_ai_tools/runtime/include/lib_tflite_micro/api/inference_engine.h +218 -0
  75. xmos_ai_tools/runtime/include/lib_tflite_micro/api/memory_parallel_transport.h +52 -0
  76. xmos_ai_tools/runtime/include/lib_tflite_micro/api/version.h +13 -0
  77. xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_config.h +17 -0
  78. xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_device_memory.h +62 -0
  79. xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_shared_config.h +31 -0
  80. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/conv2d_float.h +155 -0
  81. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_common.h +19 -0
  82. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_custom_options.h +28 -0
  83. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_error_reporter.h +32 -0
  84. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_interpreter.h +49 -0
  85. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +71 -0
  86. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_profiler.h +49 -0
  87. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.h +160 -0
  88. xmos_ai_tools/runtime/include/lib_tflite_micro/src/thread_call.h +119 -0
  89. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_defs.h +4 -0
  90. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_device.h +4 -0
  91. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_std_descriptors.h +4 -0
  92. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_std_requests.h +4 -0
  93. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud.h +518 -0
  94. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_conf_default.h +11 -0
  95. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_device.h +87 -0
  96. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_std_descriptors.h +191 -0
  97. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_std_requests.h +120 -0
  98. xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/XUD_USB_Defines.h +70 -0
  99. xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/hid.h +23 -0
  100. xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/usbaudio10.h +30 -0
  101. xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/usbaudio20.h +357 -0
  102. xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/usbaudiocommon.h +168 -0
  103. xmos_ai_tools/runtime/include/signal/micro/kernels/delay_flexbuffers_generated_data.h +25 -0
  104. xmos_ai_tools/runtime/include/signal/micro/kernels/energy_flexbuffers_generated_data.h +28 -0
  105. xmos_ai_tools/runtime/include/signal/micro/kernels/fft_flexbuffers_generated_data.h +37 -0
  106. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_flexbuffers_generated_data.h +25 -0
  107. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_log_flexbuffers_generated_data.h +27 -0
  108. xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_spectral_subtraction_flexbuffers_generated_data.h +26 -0
  109. xmos_ai_tools/runtime/include/signal/micro/kernels/framer_flexbuffers_generated_data.h +25 -0
  110. xmos_ai_tools/runtime/include/signal/micro/kernels/irfft.h +31 -0
  111. xmos_ai_tools/runtime/include/signal/micro/kernels/overlap_add_flexbuffers_generated_data.h +25 -0
  112. xmos_ai_tools/runtime/include/signal/micro/kernels/pcan_flexbuffers_generated_data.h +7 -0
  113. xmos_ai_tools/runtime/include/signal/micro/kernels/rfft.h +31 -0
  114. xmos_ai_tools/runtime/include/signal/micro/kernels/stacker_flexbuffers_generated_data.h +25 -0
  115. xmos_ai_tools/runtime/include/signal/micro/kernels/window_flexbuffers_generated_data.h +25 -0
  116. xmos_ai_tools/runtime/include/signal/src/circular_buffer.h +118 -0
  117. xmos_ai_tools/runtime/include/signal/src/complex.h +29 -0
  118. xmos_ai_tools/runtime/include/signal/src/energy.h +38 -0
  119. xmos_ai_tools/runtime/include/signal/src/fft_auto_scale.h +35 -0
  120. xmos_ai_tools/runtime/include/signal/src/filter_bank.h +69 -0
  121. xmos_ai_tools/runtime/include/signal/src/filter_bank_log.h +38 -0
  122. xmos_ai_tools/runtime/include/signal/src/filter_bank_spectral_subtraction.h +73 -0
  123. xmos_ai_tools/runtime/include/signal/src/filter_bank_square_root.h +34 -0
  124. xmos_ai_tools/runtime/include/signal/src/irfft.h +84 -0
  125. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_common.h +49 -0
  126. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_float.h +31 -0
  127. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int16.h +30 -0
  128. xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int32.h +31 -0
  129. xmos_ai_tools/runtime/include/signal/src/log.h +30 -0
  130. xmos_ai_tools/runtime/include/signal/src/max_abs.h +31 -0
  131. xmos_ai_tools/runtime/include/signal/src/msb.h +32 -0
  132. xmos_ai_tools/runtime/include/signal/src/overlap_add.h +46 -0
  133. xmos_ai_tools/runtime/include/signal/src/pcan_argc_fixed.h +41 -0
  134. xmos_ai_tools/runtime/include/signal/src/rfft.h +85 -0
  135. xmos_ai_tools/runtime/include/signal/src/square_root.h +32 -0
  136. xmos_ai_tools/runtime/include/signal/src/window.h +31 -0
  137. xmos_ai_tools/runtime/include/signal/testdata/fft_test_data.h +48 -0
  138. xmos_ai_tools/runtime/include/tensorflow/lite/array.h +156 -0
  139. xmos_ai_tools/runtime/include/tensorflow/lite/builtin_op_data.h +22 -0
  140. xmos_ai_tools/runtime/include/tensorflow/lite/builtin_ops.h +241 -0
  141. xmos_ai_tools/runtime/include/tensorflow/lite/c/builtin_op_data.h +20 -0
  142. xmos_ai_tools/runtime/include/tensorflow/lite/c/c_api_types.h +26 -0
  143. xmos_ai_tools/runtime/include/tensorflow/lite/c/common.h +30 -0
  144. xmos_ai_tools/runtime/include/tensorflow/lite/context_util.h +54 -0
  145. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +72 -0
  146. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +440 -0
  147. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/tensor_utils.h +28 -0
  148. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/builtin_op_data.h +626 -0
  149. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +178 -0
  150. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +1496 -0
  151. xmos_ai_tools/runtime/include/tensorflow/lite/core/macros.h +78 -0
  152. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/bits.h +102 -0
  153. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/fft.h +50 -0
  154. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/fft_io.h +34 -0
  155. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/fft_util.h +34 -0
  156. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/filterbank.h +63 -0
  157. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/filterbank_io.h +35 -0
  158. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h +50 -0
  159. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/frontend.h +64 -0
  160. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/frontend_io.h +31 -0
  161. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/frontend_util.h +52 -0
  162. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/kiss_fft_common.h +48 -0
  163. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/kiss_fft_int16.h +33 -0
  164. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_lut.h +40 -0
  165. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_scale.h +39 -0
  166. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_scale_io.h +33 -0
  167. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h +45 -0
  168. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/noise_reduction.h +46 -0
  169. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_io.h +36 -0
  170. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h +50 -0
  171. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.h +47 -0
  172. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h +57 -0
  173. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/window.h +49 -0
  174. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/window_io.h +34 -0
  175. xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/window_util.h +45 -0
  176. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +1358 -0
  177. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/compatibility.h +122 -0
  178. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +40 -0
  179. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/max.h +35 -0
  180. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/min.h +35 -0
  181. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/optimized/neon_check.h +20 -0
  182. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +141 -0
  183. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor_utils.h +623 -0
  184. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/quantization_util.h +292 -0
  185. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +561 -0
  186. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add_n.h +86 -0
  187. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/arg_min_max.h +88 -0
  188. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_matmul.h +275 -0
  189. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_to_space_nd.h +101 -0
  190. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/binary_function.h +91 -0
  191. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_args.h +56 -0
  192. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_to.h +97 -0
  193. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/ceil.h +37 -0
  194. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +271 -0
  195. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/concatenation.h +141 -0
  196. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +289 -0
  197. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/cumsum.h +175 -0
  198. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depth_to_space.h +79 -0
  199. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h +100 -0
  200. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h +319 -0
  201. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/dequantize.h +78 -0
  202. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/div.h +247 -0
  203. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/elu.h +37 -0
  204. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/exp.h +38 -0
  205. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fill.h +38 -0
  206. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor.h +39 -0
  207. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_div.h +35 -0
  208. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_mod.h +44 -0
  209. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fully_connected.h +323 -0
  210. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/hard_swish.h +168 -0
  211. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +250 -0
  212. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +241 -0
  213. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h +291 -0
  214. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h +126 -0
  215. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h +67 -0
  216. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h +121 -0
  217. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h +18 -0
  218. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +194 -0
  219. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h +264 -0
  220. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h +117 -0
  221. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h +224 -0
  222. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/l2normalization.h +90 -0
  223. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/leaky_relu.h +69 -0
  224. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/log_softmax.h +256 -0
  225. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/logistic.h +132 -0
  226. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/lstm_cell.h +422 -0
  227. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/maximum_minimum.h +64 -0
  228. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +267 -0
  229. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/neg.h +37 -0
  230. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pad.h +169 -0
  231. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pooling.h +303 -0
  232. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h +333 -0
  233. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h +244 -0
  234. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/prelu.h +111 -0
  235. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h +140 -0
  236. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/quantize.h +89 -0
  237. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +491 -0
  238. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/requantize.h +70 -0
  239. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +233 -0
  240. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h +102 -0
  241. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/round.h +51 -0
  242. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/select.h +151 -0
  243. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/slice.h +80 -0
  244. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/softmax.h +233 -0
  245. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_batch_nd.h +109 -0
  246. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_depth.h +80 -0
  247. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/strided_slice.h +147 -0
  248. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +465 -0
  249. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/tanh.h +129 -0
  250. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose.h +203 -0
  251. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose_conv.h +225 -0
  252. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +168 -0
  253. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +278 -0
  254. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +42 -0
  255. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +1096 -0
  256. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +341 -0
  257. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/op_macros.h +49 -0
  258. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/padding.h +115 -0
  259. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h +100 -0
  260. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/non_persistent_arena_buffer_allocator.h +104 -0
  261. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/persistent_arena_buffer_allocator.h +58 -0
  262. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/recording_single_arena_buffer_allocator.h +63 -0
  263. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.h +144 -0
  264. xmos_ai_tools/runtime/include/tensorflow/lite/micro/benchmarks/micro_benchmark.h +95 -0
  265. xmos_ai_tools/runtime/include/tensorflow/lite/micro/compatibility.h +32 -0
  266. xmos_ai_tools/runtime/include/tensorflow/lite/micro/cortex_m_generic/debug_log_callback.h +49 -0
  267. xmos_ai_tools/runtime/include/tensorflow/lite/micro/debug_log.h +38 -0
  268. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h +37 -0
  269. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/expected_output_data.h +47 -0
  270. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/input_data.h +108 -0
  271. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/network_model.h +166 -0
  272. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/detection_responder.h +32 -0
  273. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/image_provider.h +38 -0
  274. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/main_functions.h +37 -0
  275. xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/model_settings.h +35 -0
  276. xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +70 -0
  277. xmos_ai_tools/runtime/include/tensorflow/lite/micro/flatbuffer_utils.h +65 -0
  278. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activation_utils.h +57 -0
  279. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activations.h +64 -0
  280. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +78 -0
  281. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h +141 -0
  282. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h +75 -0
  283. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h +56 -0
  284. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h +310 -0
  285. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h +145 -0
  286. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h +78 -0
  287. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/ceva_common.h +24 -0
  288. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/ceva_tflm_lib.h +613 -0
  289. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/mcps_macros.h +115 -0
  290. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/types.h +1286 -0
  291. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +45 -0
  292. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer_flexbuffers_generated_data.h +22 -0
  293. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +117 -0
  294. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +94 -0
  295. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +80 -0
  296. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/dequantize.h +38 -0
  297. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/detection_postprocess_flexbuffers_generated_data.h +25 -0
  298. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +28 -0
  299. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +112 -0
  300. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/hard_swish.h +30 -0
  301. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +86 -0
  302. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +150 -0
  303. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/leaky_relu.h +43 -0
  304. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logical.h +35 -0
  305. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logistic.h +42 -0
  306. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval.h +541 -0
  307. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval_test.h +817 -0
  308. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_shared.h +150 -0
  309. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +158 -0
  310. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_tensor_utils.h +56 -0
  311. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +74 -0
  312. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pad.h +27 -0
  313. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +142 -0
  314. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/prelu.h +39 -0
  315. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/quantize.h +37 -0
  316. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +65 -0
  317. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +26 -0
  318. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +67 -0
  319. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +40 -0
  320. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/sub.h +60 -0
  321. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +100 -0
  322. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/conv_test_data.h +37 -0
  323. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/lstm_test_data.h +579 -0
  324. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +47 -0
  325. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/hifimini/fixedpoint_utils.h +139 -0
  326. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_eval.h +216 -0
  327. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_shared.h +78 -0
  328. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa.h +38 -0
  329. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_add.h +48 -0
  330. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +89 -0
  331. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +74 -0
  332. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_fully_connected.h +78 -0
  333. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pad.h +49 -0
  334. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pooling.h +76 -0
  335. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reduce.h +47 -0
  336. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +44 -0
  337. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +58 -0
  338. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_svdf.h +39 -0
  339. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_helpers.h +64 -0
  340. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +170 -0
  341. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +53 -0
  342. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/memory_plan_struct.h +73 -0
  343. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +95 -0
  344. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +133 -0
  345. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocation_info.h +138 -0
  346. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +351 -0
  347. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_arena_constants.h +28 -0
  348. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_common.h +38 -0
  349. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +176 -0
  350. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +79 -0
  351. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +189 -0
  352. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +125 -0
  353. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +110 -0
  354. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +42 -0
  355. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +708 -0
  356. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +62 -0
  357. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +140 -0
  358. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler_interface.h +38 -0
  359. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_resource_variable.h +89 -0
  360. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_time.h +36 -0
  361. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_utils.h +162 -0
  362. xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +60 -0
  363. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/python_ops_resolver.h +21 -0
  364. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size.h +30 -0
  365. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.h +33 -0
  366. xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_allocator.h +125 -0
  367. xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_interpreter.h +69 -0
  368. xmos_ai_tools/runtime/include/tensorflow/lite/micro/system_setup.h +27 -0
  369. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +49 -0
  370. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +334 -0
  371. xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +267 -0
  372. xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/test_conv_model.h +23 -0
  373. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/flatbuffer_conversions_bridge.h +45 -0
  374. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.h +36 -0
  375. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +273 -0
  376. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +41 -0
  377. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +127 -0
  378. xmos_ai_tools/runtime/include/tensorflow/lite/portable_type_to_tflitetype.h +75 -0
  379. xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +24644 -0
  380. xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_utils.h +33 -0
  381. xmos_ai_tools/runtime/include/tile_ram_server.h +38 -0
  382. xmos_ai_tools/runtime/lib/libhost_xtflitemicro.a +0 -0
  383. xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
  384. xmos_ai_tools/xformer/__init__.py +60 -0
  385. xmos_ai_tools/xformer/flash.py +190 -0
  386. xmos_ai_tools/xinterpreters/__init__.py +1 -0
  387. xmos_ai_tools/xinterpreters/exceptions.py +38 -0
  388. xmos_ai_tools/xinterpreters/host_interpreter.py +652 -0
  389. xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.1.0.1.dylib +0 -0
  390. xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.dylib +0 -0
  391. xmos_ai_tools-1.3.2.dev80.data/data/bin/xcore-opt +0 -0
  392. xmos_ai_tools-1.3.2.dev80.dist-info/METADATA +33 -0
  393. xmos_ai_tools-1.3.2.dev80.dist-info/RECORD +395 -0
  394. xmos_ai_tools-1.3.2.dev80.dist-info/WHEEL +5 -0
  395. xmos_ai_tools-1.3.2.dev80.dist-info/top_level.txt +1 -0
@@ -0,0 +1,267 @@
1
+ /* Copyright 2018 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
+ // An ultra-lightweight testing framework designed for use with microcontroller
17
+ // applications. This is designed to be usable even
18
+ // when no standard C or C++ libraries are available, and without any dynamic
19
+ // memory allocation or reliance on global constructors.
20
+ //
21
+ // To build a test, you use syntax similar to gunit, but with some extra
22
+ // decoration to create a hidden 'main' function containing each of the tests to
23
+ // be run. Your code should look something like:
24
+ // ----------------------------------------------------------------------------
25
+ // #include "path/to/this/header"
26
+ //
27
+ // TF_LITE_MICRO_TESTS_BEGIN
28
+ //
29
+ // TF_LITE_MICRO_TEST(SomeTest) {
30
+ // TF_LITE_LOG_EXPECT_EQ(true, true);
31
+ // }
32
+ //
33
+ // TF_LITE_MICRO_TESTS_END
34
+ // ----------------------------------------------------------------------------
35
+ // If you compile this for your platform, you'll get a normal binary that you
36
+ // should be able to run. Executing it will output logging information like this
37
+ // to stderr:
38
+ // ----------------------------------------------------------------------------
39
+ // Testing SomeTest
40
+ // 1/1 tests passed
41
+ // ~~~ALL TESTS PASSED~~~
42
+ // ----------------------------------------------------------------------------
43
+ // This is designed to be human-readable, so you can just run tests manually,
44
+ // but the string "~~~ALL TESTS PASSED~~~" should only appear if all of the
45
+ // tests do pass. This makes it possible to integrate with automated test
46
+ // systems by scanning the output logs and looking for that magic value.
47
+ //
48
+ // This framework is intended to be a rudimentary alternative to no testing at
49
+ // all on systems that struggle to run more conventional approaches, so use with
50
+ // caution!
51
+
52
+ #ifndef TENSORFLOW_LITE_MICRO_TESTING_MICRO_TEST_H_
53
+ #define TENSORFLOW_LITE_MICRO_TESTING_MICRO_TEST_H_
54
+ #include <limits>
55
+ #include <type_traits>
56
+
57
+ #include "tensorflow/lite/c/common.h"
58
+ #include "tensorflow/lite/micro/micro_log.h"
59
+ #include "tensorflow/lite/micro/system_setup.h"
60
+
61
+ namespace micro_test {
62
+ extern int tests_passed;
63
+ extern int tests_failed;
64
+ extern bool is_test_complete;
65
+ extern bool did_test_fail;
66
+ } // namespace micro_test
67
+
68
+ namespace tflite_micro {
69
+
70
+ // This additional helper function is used (instead of directly calling
71
+ // tflite_micro::InitializeTarget from the TF_LITE_MICRO_TESTS_BEGIN macro) to avoid
72
+ // adding a dependency from every bazel test target to micro:system_setp (which
73
+ // is the target that implements InitializeTarget().
74
+ //
75
+ // The underlying issue here is that the use of the macros results in
76
+ // dependencies that can be containted within the micro/testing:micro_test
77
+ // target bleeding on to all the tests.
78
+ inline void InitializeTest() { InitializeTarget(); }
79
+ } // namespace tflite_micro
80
+
81
+ #define TF_LITE_MICRO_TESTS_BEGIN \
82
+ namespace micro_test { \
83
+ int tests_passed; \
84
+ int tests_failed; \
85
+ bool is_test_complete; \
86
+ bool did_test_fail; \
87
+ } \
88
+ \
89
+ int main(int argc, char** argv) { \
90
+ micro_test::tests_passed = 0; \
91
+ micro_test::tests_failed = 0; \
92
+ tflite_micro::InitializeTest();
93
+
94
+ #define TF_LITE_MICRO_TESTS_END \
95
+ MicroPrintf("%d/%d tests passed", micro_test::tests_passed, \
96
+ (micro_test::tests_failed + micro_test::tests_passed)); \
97
+ if (micro_test::tests_failed == 0) { \
98
+ MicroPrintf("~~~ALL TESTS PASSED~~~\n"); \
99
+ return kTfLiteOk; \
100
+ } else { \
101
+ MicroPrintf("~~~SOME TESTS FAILED~~~\n"); \
102
+ return kTfLiteError; \
103
+ } \
104
+ }
105
+
106
+ // TODO(petewarden): I'm going to hell for what I'm doing to this poor for loop.
107
+ #define TF_LITE_MICRO_TEST(name) \
108
+ MicroPrintf("Testing " #name); \
109
+ for (micro_test::is_test_complete = false, \
110
+ micro_test::did_test_fail = false; \
111
+ !micro_test::is_test_complete; micro_test::is_test_complete = true, \
112
+ micro_test::tests_passed += (micro_test::did_test_fail) ? 0 : 1, \
113
+ micro_test::tests_failed += (micro_test::did_test_fail) ? 1 : 0)
114
+
115
+ #define TF_LITE_MICRO_EXPECT(x) \
116
+ do { \
117
+ if (!(x)) { \
118
+ MicroPrintf(#x " failed at %s:%d", __FILE__, __LINE__); \
119
+ micro_test::did_test_fail = true; \
120
+ } \
121
+ } while (false)
122
+
123
+ #define TF_LITE_MICRO_EXPECT_EQ(x, y) \
124
+ do { \
125
+ auto vx = x; \
126
+ auto vy = y; \
127
+ bool isFloatingX = (std::is_floating_point<decltype(vx)>::value); \
128
+ bool isFloatingY = (std::is_floating_point<decltype(vy)>::value); \
129
+ if (isFloatingX && isFloatingY) { \
130
+ auto delta = ((vx) > (vy)) ? ((vx) - (vy)) : ((vy) - (vx)); \
131
+ if (delta > std::numeric_limits<decltype(delta)>::epsilon()) { \
132
+ MicroPrintf(#x " == " #y " failed at %s:%d (%f vs %f)", __FILE__, \
133
+ __LINE__, static_cast<double>(vx), \
134
+ static_cast<double>(vy)); \
135
+ micro_test::did_test_fail = true; \
136
+ } \
137
+ } else if ((vx) != (vy)) { \
138
+ MicroPrintf(#x " == " #y " failed at %s:%d (%d vs %d)", __FILE__, \
139
+ __LINE__, static_cast<int>(vx), static_cast<int>(vy)); \
140
+ if (isFloatingX || isFloatingY) { \
141
+ MicroPrintf("-----------WARNING-----------"); \
142
+ MicroPrintf("Only one of the values is floating point value."); \
143
+ } \
144
+ micro_test::did_test_fail = true; \
145
+ } \
146
+ } while (false)
147
+
148
+ #define TF_LITE_MICRO_EXPECT_NE(x, y) \
149
+ do { \
150
+ auto vx = x; \
151
+ auto vy = y; \
152
+ bool isFloatingX = (std::is_floating_point<decltype(vx)>::value); \
153
+ bool isFloatingY = (std::is_floating_point<decltype(vy)>::value); \
154
+ if (isFloatingX && isFloatingY) { \
155
+ auto delta = ((vx) > (vy)) ? ((vx) - (vy)) : ((vy) - (vx)); \
156
+ if (delta <= std::numeric_limits<decltype(delta)>::epsilon()) { \
157
+ MicroPrintf(#x " != " #y " failed at %s:%d", __FILE__, __LINE__); \
158
+ micro_test::did_test_fail = true; \
159
+ } \
160
+ } else if ((vx) == (vy)) { \
161
+ MicroPrintf(#x " != " #y " failed at %s:%d", __FILE__, __LINE__); \
162
+ if (isFloatingX || isFloatingY) { \
163
+ MicroPrintf("-----------WARNING-----------"); \
164
+ MicroPrintf("Only one of the values is floating point value."); \
165
+ } \
166
+ micro_test::did_test_fail = true; \
167
+ } \
168
+ } while (false)
169
+
170
+ // TODO(wangtz): Making it more generic once needed.
171
+ #define TF_LITE_MICRO_ARRAY_ELEMENT_EXPECT_NEAR(arr1, idx1, arr2, idx2, \
172
+ epsilon) \
173
+ do { \
174
+ auto delta = ((arr1)[(idx1)] > (arr2)[(idx2)]) \
175
+ ? ((arr1)[(idx1)] - (arr2)[(idx2)]) \
176
+ : ((arr2)[(idx2)] - (arr1)[(idx1)]); \
177
+ if (delta > epsilon) { \
178
+ MicroPrintf(#arr1 "[%d] (%f) near " #arr2 "[%d] (%f) failed at %s:%d", \
179
+ static_cast<int>(idx1), static_cast<float>((arr1)[(idx1)]), \
180
+ static_cast<int>(idx2), static_cast<float>((arr2)[(idx2)]), \
181
+ __FILE__, __LINE__); \
182
+ micro_test::did_test_fail = true; \
183
+ } \
184
+ } while (false)
185
+
186
+ // The check vx != vy is needed to properly handle the case where both
187
+ // x and y evaluate to infinity. See #46960 for more details.
188
+ #define TF_LITE_MICRO_EXPECT_NEAR(x, y, epsilon) \
189
+ do { \
190
+ auto vx = (x); \
191
+ auto vy = (y); \
192
+ auto delta = ((vx) > (vy)) ? ((vx) - (vy)) : ((vy) - (vx)); \
193
+ if (vx != vy && delta > epsilon) { \
194
+ MicroPrintf(#x " (%f) near " #y " (%f) failed at %s:%d", \
195
+ static_cast<double>(vx), static_cast<double>(vy), __FILE__, \
196
+ __LINE__); \
197
+ micro_test::did_test_fail = true; \
198
+ } \
199
+ } while (false)
200
+
201
+ #define TF_LITE_MICRO_EXPECT_GT(x, y) \
202
+ do { \
203
+ if ((x) <= (y)) { \
204
+ MicroPrintf(#x " > " #y " failed at %s:%d", __FILE__, __LINE__); \
205
+ micro_test::did_test_fail = true; \
206
+ } \
207
+ } while (false)
208
+
209
+ #define TF_LITE_MICRO_EXPECT_LT(x, y) \
210
+ do { \
211
+ if ((x) >= (y)) { \
212
+ MicroPrintf(#x " < " #y " failed at %s:%d", __FILE__, __LINE__); \
213
+ micro_test::did_test_fail = true; \
214
+ } \
215
+ } while (false)
216
+
217
+ #define TF_LITE_MICRO_EXPECT_GE(x, y) \
218
+ do { \
219
+ if ((x) < (y)) { \
220
+ MicroPrintf(#x " >= " #y " failed at %s:%d", __FILE__, __LINE__); \
221
+ micro_test::did_test_fail = true; \
222
+ } \
223
+ } while (false)
224
+
225
+ #define TF_LITE_MICRO_EXPECT_LE(x, y) \
226
+ do { \
227
+ if ((x) > (y)) { \
228
+ MicroPrintf(#x " <= " #y " failed at %s:%d", __FILE__, __LINE__); \
229
+ micro_test::did_test_fail = true; \
230
+ } \
231
+ } while (false)
232
+
233
+ #define TF_LITE_MICRO_EXPECT_TRUE(x) \
234
+ do { \
235
+ if (!(x)) { \
236
+ MicroPrintf(#x " was not true failed at %s:%d", __FILE__, __LINE__); \
237
+ micro_test::did_test_fail = true; \
238
+ } \
239
+ } while (false)
240
+
241
+ #define TF_LITE_MICRO_EXPECT_FALSE(x) \
242
+ do { \
243
+ if (x) { \
244
+ MicroPrintf(#x " was not false failed at %s:%d", __FILE__, __LINE__); \
245
+ micro_test::did_test_fail = true; \
246
+ } \
247
+ } while (false)
248
+
249
+ #define TF_LITE_MICRO_FAIL(msg) \
250
+ do { \
251
+ MicroPrintf("FAIL: %s", msg, __FILE__, __LINE__); \
252
+ micro_test::did_test_fail = true; \
253
+ } while (false)
254
+
255
+ #define TF_LITE_MICRO_EXPECT_STRING_EQ(string1, string2) \
256
+ do { \
257
+ for (int i = 0; string1[i] != '\0' && string2[i] != '\0'; i++) { \
258
+ if (string1[i] != string2[i]) { \
259
+ MicroPrintf("FAIL: %s did not match %s", string1, string2, __FILE__, \
260
+ __LINE__); \
261
+ micro_test::did_test_fail = true; \
262
+ break; \
263
+ } \
264
+ } \
265
+ } while (false)
266
+
267
+ #endif // TENSORFLOW_LITE_MICRO_TESTING_MICRO_TEST_H_
@@ -0,0 +1,23 @@
1
+ /* Copyright 2020 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_TESTING_TEST_CONV_MODEL_H_
17
+ #define TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_
18
+
19
+ // See generate_test_models.py for updating the contents of this model:
20
+ extern const unsigned char kTestConvModelData[];
21
+ extern const unsigned int kTestConvModelDataSize;
22
+
23
+ #endif // TENSORFLOW_LITE_MICRO_TESTING_TEST_CONV_MODEL_H_
@@ -0,0 +1,45 @@
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
+ #ifndef TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_FLATBUFFER_CONVERSIONS_BRIDGE_H_
16
+ #define TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_FLATBUFFER_CONVERSIONS_BRIDGE_H_
17
+
18
+ #include "tensorflow/lite/c/c_api_types.h"
19
+ #include "tensorflow/lite/core/api/flatbuffer_conversions.h"
20
+ #include "tensorflow/lite/schema/schema_generated.h"
21
+
22
+ namespace tflite_micro {
23
+
24
+ // Forward declaration of the ErrorReporter class to hide it from the TFLM code.
25
+ class ErrorReporter;
26
+
27
+ using TfLiteBridgeBuiltinDataAllocator = BuiltinDataAllocator;
28
+
29
+ using TfLiteBridgeBuiltinParseFunction =
30
+ TfLiteStatus (*)(const Operator* op, ErrorReporter* error_reporter,
31
+ BuiltinDataAllocator* allocator, void** builtin_data);
32
+
33
+ // Converts the tensor data type used in the flatbuffer to the representation
34
+ // used by the runtime.
35
+ TfLiteStatus ConvertTensorType(TensorType tensor_type, TfLiteType* type);
36
+
37
+ // CallBuiltinParseFunction is a wrapper function to wrap the parser function
38
+ // calls to Call parser(op, allocator, builtin_data)
39
+ TfLiteStatus CallBuiltinParseFunction(TfLiteBridgeBuiltinParseFunction parser,
40
+ const Operator* op,
41
+ BuiltinDataAllocator* allocator,
42
+ void** builtin_data);
43
+ } // namespace tflite_micro
44
+
45
+ #endif // TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_FLATBUFFER_CONVERSIONS_BRIDGE_H_
@@ -0,0 +1,36 @@
1
+ /* Copyright 2018 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
+ #ifndef TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_MICRO_ERROR_REPORTER_H_
16
+ #define TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_MICRO_ERROR_REPORTER_H_
17
+
18
+ #include <cstdarg>
19
+
20
+ #include "tensorflow/lite/core/api/error_reporter.h"
21
+ #include "tensorflow/lite/micro/compatibility.h"
22
+
23
+ namespace tflite_micro {
24
+ // Get a pointer to a singleton global error reporter.
25
+ ErrorReporter* GetMicroErrorReporter();
26
+ class MicroErrorReporter : public ErrorReporter {
27
+ public:
28
+ ~MicroErrorReporter() override {}
29
+ int Report(const char* format, va_list args) override;
30
+
31
+ TF_LITE_REMOVE_VIRTUAL_DELETE
32
+ };
33
+
34
+ } // namespace tflite_micro
35
+
36
+ #endif // TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_MICRO_ERROR_REPORTER_H_
@@ -0,0 +1,273 @@
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 TFLM_BENCHMARK_INTERNAL_LOG_UTILS_H_
17
+ #define TFLM_BENCHMARK_INTERNAL_LOG_UTILS_H_
18
+
19
+ #include <algorithm>
20
+ #include <cstdarg>
21
+ #include <cstdint>
22
+ #include <cstring>
23
+
24
+ #include "tensorflow/lite/micro/micro_log.h"
25
+
26
+ namespace tflite_micro {
27
+
28
+ // The maxmimum length of a string.
29
+ static constexpr int kMaxStringLength = 32;
30
+
31
+ // The maximum length of a table row, applies to the header as well.
32
+ static constexpr int kMaxRowLength = 100;
33
+
34
+ // The default padding between columns in a table.
35
+ static constexpr int kDefaultColumnPadding = 4;
36
+
37
+ // Defines how formatted data is printed to stdout.
38
+ enum class PrettyPrintType {
39
+ // Prints as a CSV file.
40
+ kCsv,
41
+ // Prints as a formatted table.
42
+ kTable,
43
+ };
44
+
45
+ // Returns the length of the longest string in an array.
46
+ // Args:
47
+ // - strings: An array of strings.
48
+ // - count: The number of strings in the array.
49
+ int GetLongestStringLength(const char strings[][kMaxStringLength], int count);
50
+
51
+ // Adds padding between two columns in a table.
52
+ // ex) "hello" is being inserted into a column. The largest value in that column
53
+ // is 10, and there's a global padding of 4 spaces. Therefore, 9 spaces (10
54
+ // - 5 + 4) are added as padding.
55
+ // Args:
56
+ // - string: The input padding string.
57
+ // - size: The size of the string that's being inserted into a column.
58
+ // - max_size: The size of the largest string in the column.
59
+ // - padding: The amount of padding to add to each column regardless of its
60
+ // size.
61
+ void FillColumnPadding(char* string, int size, int max_size,
62
+ int padding = kDefaultColumnPadding);
63
+
64
+ // Fills a string with a specified value.
65
+ // Args:
66
+ // - string: The input string. This is filled in with the specified value.
67
+ // - size: The size of the string after being filled in. This must be less than
68
+ // the allocated space for the string.
69
+ // - buffer_size: The size of the string's buffer.
70
+ // - value: The value to insert into the string. Defaults to a space.
71
+ void FillString(char* string, int size, int buffer_size, char value = ' ');
72
+
73
+ // Concatenates the input string onto the first.
74
+ // Args:
75
+ // - output: The destination string for where to append input.
76
+ // - input: The input string to concatenate.
77
+ // - size: The number of characters to concatenate from the first string. If
78
+ // negative, the whole input string will be concatenated.
79
+ void MicroStrcat(char* output, const char* input, int size = -1);
80
+
81
+ // Copies the input string into the output.
82
+ void MicroStrcpy(char* output, const char* input);
83
+
84
+ // Formats a division operation to have a specified number of decimal places.
85
+ // Args:
86
+ // - output: The output string to be formatted.
87
+ // - numerator: The numerator in the division operation.
88
+ // - denominator: The denominator in the division operation.
89
+ // - decimal places: The number of decimal places to print to.
90
+ void FormatIntegerDivide(char* output, int64_t numerator, int64_t denominator,
91
+ int decimal_places);
92
+
93
+ // Formats a division operation as a percentage.
94
+ // Args:
95
+ // - output: The output string to be formatted.
96
+ // - numerator: The numerator in the division operation.
97
+ // - denominator: The denominator in the division operation.
98
+ // - decimal places: The number of decimal places to print to.
99
+ void FormatAsPercentage(char* output, int64_t numerator, int64_t denominator,
100
+ int decimal_places);
101
+
102
+ void PrettyPrintTableHeader(PrettyPrintType type, const char* table_name);
103
+
104
+ // Formats a number as a string.
105
+ // Args:
106
+ // - output: The location of where to write the formatted number.
107
+ // - value: The value to write to a string.
108
+ template <typename T>
109
+ void FormatNumber(char* output, T value);
110
+
111
+ // Pretty prints a table to stdout.
112
+ // Note: kMaxRows and kColumns should describe the allocated size of the table,
113
+ // not the amount of data that is populated. It is required that all
114
+ // columns are filled out, but not all rows.
115
+ //
116
+ // ex) PrintTable<3, 25>(headers, data, 4);
117
+ // This will print a table with 3 columns and 4 rows. In this example, it
118
+ // is required that data is defined as char[3][25][kMaxStringLength] to
119
+ // properly print.
120
+ //
121
+ // op cycles cpu %
122
+ // -------------------------
123
+ // foo | 1000 | 10
124
+ // bar | 2500 | 25
125
+ // baz | 1000 | 10
126
+ // lorem | 2000 | 20
127
+ //
128
+ // Args:
129
+ // - headers: A 1D array of strings containing the headers of the table. This
130
+ // must be equal in size to kColumns.
131
+ // - data: A 2D array of string data organized in [columns, rows]. As stated
132
+ // above, it is required that all columns are populated, but not all rows.
133
+ // - rows: The number of populated rows in `data`.
134
+ template <int kMaxRows, int kColumns>
135
+ void PrintTable(const char headers[kColumns][kMaxStringLength],
136
+ const char data[kColumns][kMaxRows][kMaxStringLength],
137
+ const int rows) {
138
+ // Get the maximum width for each column in the table.
139
+ int max_column_width[kColumns];
140
+ for (int i = 0; i < kColumns; ++i) {
141
+ max_column_width[i] = std::max(GetLongestStringLength(data[i], rows),
142
+ static_cast<int>(strlen(headers[i])));
143
+ }
144
+
145
+ // Add padding between each item in the header so it can be printed on one
146
+ // line.
147
+ char header_spaces[kColumns][kMaxStringLength];
148
+ for (int i = 0; i < kColumns; ++i) {
149
+ FillColumnPadding(header_spaces[i], strlen(headers[i]), max_column_width[i],
150
+ kDefaultColumnPadding + 2);
151
+ }
152
+
153
+ // Print the header.
154
+ char header[kMaxRowLength];
155
+ memset(header, 0, kMaxRowLength);
156
+ for (int i = 0; i < kColumns; ++i) {
157
+ MicroStrcat(header, headers[i]);
158
+ MicroStrcat(header, header_spaces[i]);
159
+ }
160
+ MicroPrintf("%s", header);
161
+
162
+ // Print a separator to separate the header from the data.
163
+ char separator[kMaxRowLength];
164
+ FillString(separator, strlen(header) - 1, kMaxRowLength, '-');
165
+ MicroPrintf("%s", separator);
166
+
167
+ for (int i = 0; i < rows; ++i) {
168
+ char spaces[kColumns][kMaxStringLength];
169
+ for (int j = 0; j < kColumns; ++j) {
170
+ FillColumnPadding(spaces[j], strlen(data[j][i]), max_column_width[j]);
171
+ }
172
+
173
+ char row[kMaxRowLength];
174
+ memset(row, 0, kMaxRowLength);
175
+
176
+ // Concatenate each column in a row with the format "[data][padding]| "
177
+ for (int j = 0; j < kColumns; ++j) {
178
+ MicroStrcat(row, data[j][i]);
179
+ MicroStrcat(row, spaces[j]);
180
+ MicroStrcat(row, "| ");
181
+ }
182
+
183
+ MicroPrintf("%s", row);
184
+ }
185
+
186
+ MicroPrintf(separator);
187
+ MicroPrintf("");
188
+ }
189
+
190
+ // Pretty prints a csv to stdout.
191
+ // Note: kMaxRows and kColumns should describe the allocated size of the table,
192
+ // not the amount of data that is populated. It is required that all
193
+ // columns are filled out, but not all rows.
194
+ //
195
+ // ex)
196
+ // op,cycles,%cpu
197
+ // foo,1000,10
198
+ // bar,2500,25
199
+ // baz,1000,10
200
+ //
201
+ // Args:
202
+ // - headers: A 1D array of strings containing the headers of the table. This
203
+ // must be equal in size to kColumns.
204
+ // - data: A 2D array of string data organized in [columns, rows]. As stated
205
+ // above, it is required that all columns are populated, but not all rows.
206
+ // - rows: The number of populated rows in `data`.
207
+ template <int kMaxRows, int kColumns>
208
+ void PrintCsv(const char headers[kColumns][kMaxStringLength],
209
+ const char data[kColumns][kMaxRows][kMaxStringLength],
210
+ const int rows) {
211
+ char header[kMaxRowLength];
212
+ memset(header, 0, kMaxRowLength);
213
+ for (int i = 0; i < kColumns; ++i) {
214
+ MicroStrcat(header, headers[i]);
215
+ if (i < kColumns - 1) {
216
+ MicroStrcat(header, ",");
217
+ }
218
+ }
219
+
220
+ MicroPrintf("%s", header);
221
+
222
+ char row[kMaxRowLength];
223
+ for (int i = 0; i < rows; ++i) {
224
+ memset(row, 0, kMaxRowLength);
225
+ for (int j = 0; j < kColumns; ++j) {
226
+ MicroStrcat(row, data[j][i]);
227
+ if (j < kColumns - 1) {
228
+ MicroStrcat(row, ",");
229
+ }
230
+ }
231
+
232
+ MicroPrintf("%s", row);
233
+ }
234
+
235
+ MicroPrintf(""); // Serves as a new line.
236
+ }
237
+
238
+ // Prints a 2D array of strings in a formatted manner along with a table name
239
+ // that includes the table type.
240
+ //
241
+ // Note: kMaxRows and kColumns should describe the allocated size of the table,
242
+ // not the amount of data that is populated. It is required that all
243
+ // columns are filled out, but not all rows.
244
+ //
245
+ // ex) PrettyPrint::kCsv will print a csv with a [[ CSV ]]: table_name header.
246
+ //
247
+ // Args:
248
+ // - headers: A 1D array of strings containing the headers of the table. This
249
+ // must be equal in size to kColumns.
250
+ // - data: A 2D array of string data organized in [columns, rows]. As stated
251
+ // above, it is required that all columns are populated, but not all rows.
252
+ // - rows: The number of populated rows in `data`.
253
+ // - type: The format type that should be used to pretty print.
254
+ // - table_name: The name of the table to be printed alongside the format type.
255
+ template <int kMaxRows, int kColumns>
256
+ void PrintFormattedData(const char headers[kColumns][kMaxStringLength],
257
+ const char data[kColumns][kMaxRows][kMaxStringLength],
258
+ const int rows, const PrettyPrintType type,
259
+ const char* table_name) {
260
+ PrettyPrintTableHeader(type, table_name);
261
+ switch (type) {
262
+ case PrettyPrintType::kCsv:
263
+ PrintCsv<kMaxRows, kColumns>(headers, data, rows);
264
+ break;
265
+ case PrettyPrintType::kTable:
266
+ PrintTable<kMaxRows, kColumns>(headers, data, rows);
267
+ break;
268
+ }
269
+ }
270
+
271
+ } // namespace tflite_micro
272
+
273
+ #endif // TFLM_BENCHMARK_INTERNAL_LOG_UTILS_H_