xmos-ai-tools 1.2.1.dev20__py3-none-win_amd64.whl → 1.3.2.dev180__py3-none-win_amd64.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 (229) hide show
  1. xmos_ai_tools/__init__.py +7 -7
  2. xmos_ai_tools/io_server/__init__.py +151 -151
  3. xmos_ai_tools/runtime/buildfiles/aitoolslib.cmake +13 -13
  4. xmos_ai_tools/runtime/buildfiles/aitoolslib.make +8 -8
  5. xmos_ai_tools/runtime/include/flash_server.h +2 -3
  6. xmos_ai_tools/runtime/include/lib_nn/api/add_int16_transform.h +2 -1
  7. xmos_ai_tools/runtime/include/lib_nn/api/dequantize_int16_transform.h +2 -1
  8. xmos_ai_tools/runtime/include/lib_nn/api/multiply_int16_transform.h +4 -2
  9. xmos_ai_tools/runtime/include/lib_nn/api/nn_api.h +2 -0
  10. xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +11 -51
  11. xmos_ai_tools/runtime/include/lib_nn/api/nn_op_utils.h +3 -0
  12. xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +1 -0
  13. xmos_ai_tools/runtime/include/lib_nn/api/version.h +2 -2
  14. xmos_ai_tools/runtime/include/lib_nn/api/vpu_memmove_word_aligned.h +15 -0
  15. xmos_ai_tools/runtime/include/lib_nn/api/vpu_memset_256.h +55 -0
  16. xmos_ai_tools/runtime/include/lib_tflite_micro/api/fast_flash.h +6 -0
  17. xmos_ai_tools/runtime/include/lib_tflite_micro/api/inference_engine.h +13 -13
  18. xmos_ai_tools/runtime/include/lib_tflite_micro/api/load_weights.h +64 -0
  19. xmos_ai_tools/runtime/include/lib_tflite_micro/api/version.h +1 -1
  20. xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_config.h +1 -1
  21. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_custom_options.h +2 -2
  22. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_error_reporter.h +3 -3
  23. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_interpreter.h +8 -8
  24. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +21 -7
  25. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_profiler.h +4 -4
  26. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.h +5 -5
  27. xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud.h +3 -3
  28. xmos_ai_tools/runtime/include/tensorflow/lite/array.h +4 -4
  29. xmos_ai_tools/runtime/include/tensorflow/lite/context_util.h +2 -2
  30. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +3 -3
  31. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +2 -2
  32. xmos_ai_tools/runtime/include/tensorflow/lite/core/api/tensor_utils.h +2 -2
  33. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +3 -3
  34. xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +17 -17
  35. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +2 -2
  36. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +2 -2
  37. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/max.h +2 -2
  38. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/min.h +2 -2
  39. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +2 -2
  40. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor_utils.h +2 -2
  41. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/quantization_util.h +2 -2
  42. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +3 -3
  43. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add_n.h +2 -2
  44. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/arg_min_max.h +2 -2
  45. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_matmul.h +2 -2
  46. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_to_space_nd.h +2 -2
  47. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/binary_function.h +2 -2
  48. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_args.h +2 -2
  49. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_to.h +2 -2
  50. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/ceil.h +2 -2
  51. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +2 -2
  52. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/concatenation.h +3 -3
  53. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +2 -2
  54. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/cumsum.h +2 -2
  55. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depth_to_space.h +3 -3
  56. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h +1 -1
  57. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h +1 -1
  58. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/dequantize.h +4 -4
  59. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/div.h +2 -2
  60. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/elu.h +2 -2
  61. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/exp.h +2 -2
  62. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fill.h +2 -2
  63. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor.h +2 -2
  64. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_div.h +2 -2
  65. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_mod.h +2 -2
  66. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fully_connected.h +2 -2
  67. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/hard_swish.h +2 -2
  68. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +2 -2
  69. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +2 -2
  70. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h +2 -2
  71. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h +2 -2
  72. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h +2 -2
  73. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h +2 -2
  74. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +2 -2
  75. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h +2 -2
  76. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h +2 -2
  77. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h +2 -2
  78. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/l2normalization.h +4 -4
  79. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/leaky_relu.h +3 -3
  80. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/log_softmax.h +2 -2
  81. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/logistic.h +2 -2
  82. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/lstm_cell.h +5 -5
  83. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/maximum_minimum.h +2 -2
  84. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +2 -2
  85. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/neg.h +2 -2
  86. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pad.h +8 -8
  87. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pooling.h +2 -2
  88. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h +2 -2
  89. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h +2 -2
  90. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/prelu.h +2 -2
  91. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h +3 -3
  92. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/quantize.h +4 -4
  93. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +3 -3
  94. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/requantize.h +2 -2
  95. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +4 -4
  96. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h +3 -3
  97. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/round.h +2 -2
  98. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/select.h +2 -2
  99. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/slice.h +5 -5
  100. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/softmax.h +2 -2
  101. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_batch_nd.h +2 -2
  102. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_depth.h +3 -3
  103. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/strided_slice.h +6 -6
  104. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +2 -2
  105. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/tanh.h +2 -2
  106. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose.h +2 -2
  107. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose_conv.h +2 -2
  108. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +2 -2
  109. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +9 -9
  110. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +2 -2
  111. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +2 -2
  112. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +2 -2
  113. xmos_ai_tools/runtime/include/tensorflow/lite/kernels/padding.h +2 -2
  114. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h +2 -2
  115. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/non_persistent_arena_buffer_allocator.h +2 -2
  116. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/persistent_arena_buffer_allocator.h +2 -2
  117. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/recording_single_arena_buffer_allocator.h +2 -2
  118. xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.h +2 -2
  119. xmos_ai_tools/runtime/include/tensorflow/lite/micro/benchmarks/micro_benchmark.h +7 -7
  120. xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +2 -2
  121. xmos_ai_tools/runtime/include/tensorflow/lite/micro/flatbuffer_utils.h +2 -2
  122. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activation_utils.h +2 -2
  123. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activations.h +6 -2
  124. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +2 -2
  125. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h +2 -2
  126. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h +2 -2
  127. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h +2 -2
  128. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h +4 -4
  129. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h +2 -2
  130. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h +2 -2
  131. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/types.h +6 -6
  132. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +2 -2
  133. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +2 -2
  134. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +2 -2
  135. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +2 -2
  136. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/dequantize.h +3 -3
  137. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +2 -2
  138. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +2 -2
  139. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/hard_swish.h +2 -2
  140. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +2 -2
  141. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +2 -2
  142. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/leaky_relu.h +2 -2
  143. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logical.h +2 -2
  144. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logistic.h +2 -2
  145. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval.h +48 -48
  146. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval_test.h +57 -57
  147. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_shared.h +2 -2
  148. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +2 -2
  149. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_tensor_utils.h +2 -2
  150. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +2 -2
  151. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pad.h +2 -2
  152. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +15 -15
  153. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/prelu.h +2 -2
  154. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/quantize.h +3 -3
  155. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +2 -2
  156. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +2 -2
  157. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +2 -2
  158. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +2 -2
  159. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/sub.h +2 -2
  160. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +2 -2
  161. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/conv_test_data.h +2 -2
  162. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/lstm_test_data.h +7 -7
  163. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +2 -2
  164. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/hifimini/fixedpoint_utils.h +2 -2
  165. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_eval.h +2 -2
  166. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_shared.h +2 -2
  167. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_add.h +2 -2
  168. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +2 -2
  169. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +2 -2
  170. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_fully_connected.h +2 -2
  171. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pad.h +2 -2
  172. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pooling.h +2 -2
  173. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reduce.h +2 -2
  174. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +2 -2
  175. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +2 -2
  176. xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_svdf.h +2 -2
  177. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_helpers.h +3 -3
  178. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +2 -2
  179. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +2 -2
  180. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/memory_plan_struct.h +2 -2
  181. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +2 -2
  182. xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +2 -2
  183. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocation_info.h +3 -3
  184. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +3 -3
  185. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_arena_constants.h +2 -2
  186. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +3 -3
  187. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +4 -4
  188. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +2 -2
  189. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +2 -2
  190. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +4 -4
  191. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +4 -4
  192. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +50 -50
  193. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +2 -2
  194. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +2 -2
  195. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler_interface.h +2 -2
  196. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_resource_variable.h +2 -2
  197. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_time.h +2 -2
  198. xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_utils.h +2 -2
  199. xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +2 -2
  200. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size.h +2 -2
  201. xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.h +2 -2
  202. xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_allocator.h +2 -2
  203. xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_interpreter.h +2 -2
  204. xmos_ai_tools/runtime/include/tensorflow/lite/micro/system_setup.h +2 -2
  205. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +2 -2
  206. xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +6 -6
  207. xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +4 -4
  208. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/flatbuffer_conversions_bridge.h +2 -2
  209. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.h +2 -2
  210. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +2 -2
  211. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +3 -3
  212. xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +3 -3
  213. xmos_ai_tools/runtime/include/tensorflow/lite/portable_type_to_tflitetype.h +2 -2
  214. xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +2731 -2731
  215. xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_utils.h +2 -2
  216. xmos_ai_tools/runtime/lib/host_xtflitemicro.lib +0 -0
  217. xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
  218. xmos_ai_tools/xformer/__init__.py +64 -60
  219. xmos_ai_tools/xformer/flash.py +190 -190
  220. xmos_ai_tools/xinterpreters/__init__.py +1 -1
  221. xmos_ai_tools/xinterpreters/exceptions.py +38 -38
  222. xmos_ai_tools/xinterpreters/host_interpreter.py +651 -652
  223. xmos_ai_tools/xinterpreters/libs/windows/xtflm_python.dll +0 -0
  224. {xmos_ai_tools-1.2.1.dev20.data → xmos_ai_tools-1.3.2.dev180.data}/data/Scripts/xcore-opt.exe +0 -0
  225. {xmos_ai_tools-1.2.1.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/METADATA +5 -7
  226. {xmos_ai_tools-1.2.1.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/RECORD +228 -226
  227. {xmos_ai_tools-1.2.1.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/WHEEL +1 -1
  228. xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_common.h +0 -19
  229. {xmos_ai_tools-1.2.1.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,7 @@ limitations under the License.
18
18
  #include "flatbuffers/flatbuffers.h"
19
19
  #include "tensorflow/lite/schema/schema_generated.h"
20
20
 
21
- namespace tflite {
21
+ namespace tflite_micro {
22
22
 
23
23
  // The following methods are introduced to resolve op builtin code shortage
24
24
  // problem. The new builtin operator will be assigned to the extended builtin
@@ -28,6 +28,6 @@ BuiltinOperator GetBuiltinCode(const OperatorCode *op_code);
28
28
 
29
29
  BuiltinOperator GetBuiltinCode(const OperatorCodeT *op_code);
30
30
 
31
- } // namespace tflite
31
+ } // namespace tflite_micro
32
32
 
33
33
  #endif // TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_
Binary file
@@ -1,60 +1,64 @@
1
- import subprocess
2
- import typing
3
- from pathlib import Path
4
- from typing import Union, List, Optional
5
- from .flash import generate_flash
6
- import re
7
-
8
- __compilation_output = ""
9
- __arena_size = 0
10
-
11
-
12
- def convert(
13
- filename: Union[str, Path],
14
- outfile: Union[str, Path],
15
- params: Optional[typing.Dict[str, Optional[str]]],
16
- ) -> int:
17
- args: List[str] = ["xcore-opt", "-o", str(outfile)]
18
-
19
- if params is not None:
20
- for key, val in params.items():
21
- if len(key) > 1:
22
- flag: str = "--" + str(key)
23
- else:
24
- flag = "-" + str(key)
25
- if str(val) == "" or val is None:
26
- args.append(flag)
27
- else:
28
- args.append(f"{flag}={val}")
29
-
30
- args.append(str(filename))
31
-
32
- process_call: subprocess.CompletedProcess = subprocess.run(
33
- [arg for arg in args],
34
- stdout=subprocess.PIPE,
35
- stderr=subprocess.STDOUT,
36
- check=True,
37
- )
38
-
39
- global __compilation_output, __arena_size
40
- __compilation_output = process_call.stdout.decode("utf-8")
41
- size_str = re.sub("((.|\n|\r)*)Tensor arena size :", "", __compilation_output)
42
- size_str = re.sub("(\n|\r)((.|\n|\r)*)", "", size_str)
43
- __arena_size = int(size_str.strip())
44
-
45
- return process_call.returncode
46
-
47
-
48
- def tensor_arena_size() -> int:
49
- return __arena_size
50
-
51
-
52
- def print_optimization_report():
53
- print(__compilation_output)
54
-
55
-
56
- def print_help(show_hidden: Optional[bool] = False) -> int:
57
- if show_hidden:
58
- return subprocess.run(["xcore-opt", "--help-list-hidden"]).returncode
59
-
60
- return subprocess.run(["xcore-opt", "--help-list"]).returncode
1
+ import subprocess
2
+ import typing
3
+ from pathlib import Path
4
+ from typing import Union, List, Optional, Tuple
5
+ from .flash import generate_flash
6
+ import re
7
+
8
+ __compilation_stdout = ""
9
+ __compilation_stderr = ""
10
+ __arena_size = 0
11
+
12
+
13
+ def convert(
14
+ filename: Union[str, Path],
15
+ outfile: Union[str, Path],
16
+ params: Optional[List[Tuple[str, Optional[str]]]],
17
+ ) -> int:
18
+ args: List[str] = ["xcore-opt", "-o", str(outfile)]
19
+
20
+ if params is not None:
21
+ for key, val in params:
22
+ if len(key) > 1:
23
+ flag: str = "--" + str(key)
24
+ else:
25
+ flag = "-" + str(key)
26
+ if str(val) == "" or val is None:
27
+ args.append(flag)
28
+ else:
29
+ args.append(f"{flag}={val}")
30
+
31
+ args.append(str(filename))
32
+
33
+ try:
34
+ process_call: subprocess.CompletedProcess = subprocess.run(
35
+ [arg for arg in args],
36
+ check=True, text=True, capture_output=True,
37
+ )
38
+ global __compilation_stdout, __compilation_stderr, __arena_size
39
+ __compilation_stdout = process_call.stdout
40
+ __compilation_stderr = process_call.stderr
41
+ size_str = re.sub("((.|\n|\r)*)Tensor arena size :", "", __compilation_stdout)
42
+ size_str = re.sub("(\n|\r)((.|\n|\r)*)", "", size_str)
43
+ __arena_size = int(size_str.strip())
44
+ return process_call.returncode
45
+ except subprocess.CalledProcessError as e:
46
+ print(e)
47
+ print("Return code:", e.returncode)
48
+ print("Error output:", e.stderr)
49
+
50
+
51
+ def tensor_arena_size() -> int:
52
+ return __arena_size
53
+
54
+
55
+ def print_optimization_report():
56
+ print(__compilation_stderr)
57
+ print(__compilation_stdout)
58
+
59
+
60
+ def print_help(show_hidden: Optional[bool] = False) -> int:
61
+ if show_hidden:
62
+ return subprocess.run(["xcore-opt", "--help-list-hidden"]).returncode
63
+
64
+ return subprocess.run(["xcore-opt", "--help-list"]).returncode
@@ -1,190 +1,190 @@
1
- BYTES_FOR_MAGIC_PATTERN = 32
2
- BYTES_FOR_VERSION = 4
3
- BYTES_PER_ENGINE_HEADER = 16
4
- VERSION_MAJOR = 1
5
- VERSION_MINOR = 2
6
-
7
-
8
- class FlashBuilder:
9
- class Header:
10
- """
11
- Class that stores a header for a flash file system
12
- The header comprises the addresses of the model, parameters, and operators
13
- relative to the start address
14
- """
15
-
16
- def __init__(self, model_bytes, params_bytes, ops_bytes, xip_bytes, start):
17
- self.model_start = start
18
- self.parameters_start = self.model_start + model_bytes + 4 # len
19
- self.operators_start = self.parameters_start + params_bytes # no len
20
- self.xip_start = self.operators_start + ops_bytes # no len
21
- new_start = self.xip_start + xip_bytes # no len
22
- self.length = new_start - start
23
-
24
- def __init__(self, engines=1):
25
- self.engines = engines
26
- self.models = [bytes([])] * engines
27
- self.params = [bytes([])] * engines
28
- self.ops = [bytes([])] * engines
29
- self.xips = [bytes([])] * engines
30
-
31
- @staticmethod
32
- def read_whole_binary_file(filename):
33
- """
34
- Reads a whole binary file in and returns bytes(). If the file to be read is called '-'
35
- then an empty bytes is returned.
36
- """
37
- if filename == "-":
38
- return bytes([])
39
- try:
40
- with open(filename, "rb") as input_fd:
41
- contents = input_fd.read()
42
- return contents
43
- except:
44
- print('File "%s" is not a readable file' % (filename))
45
- return None
46
-
47
- @staticmethod
48
- def create_params_image(params=None, filename=None):
49
- if params is None:
50
- params = FlashBuilder.read_whole_binary_file(filename)
51
- return params
52
-
53
- @staticmethod
54
- def create_model_image(model=None, filename=None):
55
- if model is None:
56
- model = FlashBuilder.read_whole_binary_file(filename)
57
- return model
58
-
59
- @staticmethod
60
- def create_params_file(params_filename, params=None, input_filename=None):
61
- image = FlashBuilder.create_params_image(params=params, filename=input_filename)
62
- with open(params_filename, "wb") as output_fd:
63
- output_fd.write(image)
64
-
65
- @staticmethod
66
- def tobytes(integr):
67
- """Converts an int to a LSB first quad of bytes"""
68
- data = []
69
- for i in range(4):
70
- data.append((integr >> (8 * i)) & 0xFF)
71
- return bytes(data)
72
-
73
- @staticmethod
74
- def swap_nibbles(x):
75
- return (x & 0x0F) << 4 | (x & 0xF0) >> 4
76
-
77
- def add_params(self, engine, params=None, filename=None):
78
- image = FlashBuilder.create_params_image(params, filename)
79
- self.params[engine] = image
80
-
81
- def add_model(self, engine, model=None, filename=None):
82
- image = FlashBuilder.create_model_image(model, filename)
83
- self.models[engine] = image
84
-
85
- def flash_image(self):
86
- """
87
- Builds a flash image out of a collection of models and parameter blobs.
88
- This function returns a bytes comprising the header, models, parameters, etc.
89
- The whole thing should be written as is to flash
90
- """
91
- headers = [None] * self.engines
92
- start = (
93
- BYTES_FOR_MAGIC_PATTERN
94
- + BYTES_FOR_VERSION
95
- + BYTES_PER_ENGINE_HEADER * self.engines
96
- )
97
- for i in range(self.engines):
98
- headers[i] = FlashBuilder.Header(
99
- len(self.models[i]),
100
- len(self.params[i]),
101
- len(self.ops[i]),
102
- len(self.xips[i]),
103
- start,
104
- )
105
- start += headers[i].length
106
-
107
- # We add the magic fast flash pattern of 32 bytes at the very beginning
108
- # After that comes the version
109
- output = bytes(
110
- [
111
- 0xFF,
112
- 0x00,
113
- 0x0F,
114
- 0x0F,
115
- 0x0F,
116
- 0x0F,
117
- 0x0F,
118
- 0x0F,
119
- 0xFF,
120
- 0x00,
121
- 0xFF,
122
- 0x00,
123
- 0xFF,
124
- 0x00,
125
- 0xFF,
126
- 0x00,
127
- 0x31,
128
- 0xF7,
129
- 0xCE,
130
- 0x08,
131
- 0x31,
132
- 0xF7,
133
- 0xCE,
134
- 0x08,
135
- 0x9C,
136
- 0x63,
137
- 0x9C,
138
- 0x63,
139
- 0x9C,
140
- 0x63,
141
- 0x9C,
142
- 0x63,
143
- ]
144
- )
145
-
146
- output += bytes(
147
- [VERSION_MAJOR, VERSION_MINOR, 0xFF ^ VERSION_MAJOR, 0xFF ^ VERSION_MINOR]
148
- )
149
-
150
- for i in range(self.engines):
151
- output += FlashBuilder.tobytes(
152
- headers[i].model_start
153
- ) # encode start of model
154
- output += FlashBuilder.tobytes(
155
- headers[i].parameters_start
156
- ) # encode start of params
157
- output += FlashBuilder.tobytes(
158
- headers[i].operators_start
159
- ) # encode start of ops
160
- output += FlashBuilder.tobytes(headers[i].xip_start) # encode start of xip
161
-
162
- for i in range(self.engines):
163
- output += FlashBuilder.tobytes(len(self.models[i])) # encode len of model
164
- output += self.models[i] # add model image
165
- output += self.params[i] # add params image
166
- output += self.ops[i] # add operators image
167
- output += self.xips[i] # add exec in place image
168
- return output
169
-
170
- def flash_file(self, filename):
171
- """
172
- Builds a file for the host system that comprises a single parameter blob.
173
- """
174
- output = self.flash_image()
175
- # swap nibbles around
176
- swapped_output = bytes([FlashBuilder.swap_nibbles(byte) for byte in output])
177
- with open(filename, "wb") as output_fd:
178
- output_fd.write(swapped_output)
179
-
180
-
181
- def generate_flash(*, output_file, model_files, param_files):
182
- assert len(model_files) == len(
183
- param_files
184
- ), "The number of provided model files must match the number of param files!"
185
- num_of_engines = len(model_files)
186
- fb = FlashBuilder(engines=num_of_engines)
187
- for i in range(num_of_engines):
188
- fb.add_model(i, filename=model_files[i])
189
- fb.add_params(i, filename=param_files[i])
190
- fb.flash_file(output_file)
1
+ BYTES_FOR_MAGIC_PATTERN = 32
2
+ BYTES_FOR_VERSION = 4
3
+ BYTES_PER_ENGINE_HEADER = 16
4
+ VERSION_MAJOR = 1
5
+ VERSION_MINOR = 2
6
+
7
+
8
+ class FlashBuilder:
9
+ class Header:
10
+ """
11
+ Class that stores a header for a flash file system
12
+ The header comprises the addresses of the model, parameters, and operators
13
+ relative to the start address
14
+ """
15
+
16
+ def __init__(self, model_bytes, params_bytes, ops_bytes, xip_bytes, start):
17
+ self.model_start = start
18
+ self.parameters_start = self.model_start + model_bytes + 4 # len
19
+ self.operators_start = self.parameters_start + params_bytes # no len
20
+ self.xip_start = self.operators_start + ops_bytes # no len
21
+ new_start = self.xip_start + xip_bytes # no len
22
+ self.length = new_start - start
23
+
24
+ def __init__(self, engines=1):
25
+ self.engines = engines
26
+ self.models = [bytes([])] * engines
27
+ self.params = [bytes([])] * engines
28
+ self.ops = [bytes([])] * engines
29
+ self.xips = [bytes([])] * engines
30
+
31
+ @staticmethod
32
+ def read_whole_binary_file(filename):
33
+ """
34
+ Reads a whole binary file in and returns bytes(). If the file to be read is called '-'
35
+ then an empty bytes is returned.
36
+ """
37
+ if filename == "-":
38
+ return bytes([])
39
+ try:
40
+ with open(filename, "rb") as input_fd:
41
+ contents = input_fd.read()
42
+ return contents
43
+ except:
44
+ print('File "%s" is not a readable file' % (filename))
45
+ return None
46
+
47
+ @staticmethod
48
+ def create_params_image(params=None, filename=None):
49
+ if params is None:
50
+ params = FlashBuilder.read_whole_binary_file(filename)
51
+ return params
52
+
53
+ @staticmethod
54
+ def create_model_image(model=None, filename=None):
55
+ if model is None:
56
+ model = FlashBuilder.read_whole_binary_file(filename)
57
+ return model
58
+
59
+ @staticmethod
60
+ def create_params_file(params_filename, params=None, input_filename=None):
61
+ image = FlashBuilder.create_params_image(params=params, filename=input_filename)
62
+ with open(params_filename, "wb") as output_fd:
63
+ output_fd.write(image)
64
+
65
+ @staticmethod
66
+ def tobytes(integr):
67
+ """Converts an int to a LSB first quad of bytes"""
68
+ data = []
69
+ for i in range(4):
70
+ data.append((integr >> (8 * i)) & 0xFF)
71
+ return bytes(data)
72
+
73
+ @staticmethod
74
+ def swap_nibbles(x):
75
+ return (x & 0x0F) << 4 | (x & 0xF0) >> 4
76
+
77
+ def add_params(self, engine, params=None, filename=None):
78
+ image = FlashBuilder.create_params_image(params, filename)
79
+ self.params[engine] = image
80
+
81
+ def add_model(self, engine, model=None, filename=None):
82
+ image = FlashBuilder.create_model_image(model, filename)
83
+ self.models[engine] = image
84
+
85
+ def flash_image(self):
86
+ """
87
+ Builds a flash image out of a collection of models and parameter blobs.
88
+ This function returns a bytes comprising the header, models, parameters, etc.
89
+ The whole thing should be written as is to flash
90
+ """
91
+ headers = [None] * self.engines
92
+ start = (
93
+ BYTES_FOR_MAGIC_PATTERN
94
+ + BYTES_FOR_VERSION
95
+ + BYTES_PER_ENGINE_HEADER * self.engines
96
+ )
97
+ for i in range(self.engines):
98
+ headers[i] = FlashBuilder.Header(
99
+ len(self.models[i]),
100
+ len(self.params[i]),
101
+ len(self.ops[i]),
102
+ len(self.xips[i]),
103
+ start,
104
+ )
105
+ start += headers[i].length
106
+
107
+ # We add the magic fast flash pattern of 32 bytes at the very beginning
108
+ # After that comes the version
109
+ output = bytes(
110
+ [
111
+ 0xFF,
112
+ 0x00,
113
+ 0x0F,
114
+ 0x0F,
115
+ 0x0F,
116
+ 0x0F,
117
+ 0x0F,
118
+ 0x0F,
119
+ 0xFF,
120
+ 0x00,
121
+ 0xFF,
122
+ 0x00,
123
+ 0xFF,
124
+ 0x00,
125
+ 0xFF,
126
+ 0x00,
127
+ 0x31,
128
+ 0xF7,
129
+ 0xCE,
130
+ 0x08,
131
+ 0x31,
132
+ 0xF7,
133
+ 0xCE,
134
+ 0x08,
135
+ 0x9C,
136
+ 0x63,
137
+ 0x9C,
138
+ 0x63,
139
+ 0x9C,
140
+ 0x63,
141
+ 0x9C,
142
+ 0x63,
143
+ ]
144
+ )
145
+
146
+ output += bytes(
147
+ [VERSION_MAJOR, VERSION_MINOR, 0xFF ^ VERSION_MAJOR, 0xFF ^ VERSION_MINOR]
148
+ )
149
+
150
+ for i in range(self.engines):
151
+ output += FlashBuilder.tobytes(
152
+ headers[i].model_start
153
+ ) # encode start of model
154
+ output += FlashBuilder.tobytes(
155
+ headers[i].parameters_start
156
+ ) # encode start of params
157
+ output += FlashBuilder.tobytes(
158
+ headers[i].operators_start
159
+ ) # encode start of ops
160
+ output += FlashBuilder.tobytes(headers[i].xip_start) # encode start of xip
161
+
162
+ for i in range(self.engines):
163
+ output += FlashBuilder.tobytes(len(self.models[i])) # encode len of model
164
+ output += self.models[i] # add model image
165
+ output += self.params[i] # add params image
166
+ output += self.ops[i] # add operators image
167
+ output += self.xips[i] # add exec in place image
168
+ return output
169
+
170
+ def flash_file(self, filename):
171
+ """
172
+ Builds a file for the host system that comprises a single parameter blob.
173
+ """
174
+ output = self.flash_image()
175
+ # swap nibbles around
176
+ swapped_output = bytes([FlashBuilder.swap_nibbles(byte) for byte in output])
177
+ with open(filename, "wb") as output_fd:
178
+ output_fd.write(swapped_output)
179
+
180
+
181
+ def generate_flash(*, output_file, model_files, param_files):
182
+ assert len(model_files) == len(
183
+ param_files
184
+ ), "The number of provided model files must match the number of param files!"
185
+ num_of_engines = len(model_files)
186
+ fb = FlashBuilder(engines=num_of_engines)
187
+ for i in range(num_of_engines):
188
+ fb.add_model(i, filename=model_files[i])
189
+ fb.add_params(i, filename=param_files[i])
190
+ fb.flash_file(output_file)
@@ -1 +1 @@
1
- from .host_interpreter import TFLMHostInterpreter
1
+ from .host_interpreter import TFLMHostInterpreter
@@ -1,38 +1,38 @@
1
- # Copyright 2021 XMOS LIMITED. This Software is subject to the terms of the
2
- # XMOS Public License: Version 1
3
-
4
-
5
- class InterpreterError(Exception):
6
- pass
7
-
8
-
9
- class AllocateTensorsError(InterpreterError):
10
- pass
11
-
12
-
13
- class InvokeError(InterpreterError):
14
- pass
15
-
16
-
17
- class SetTensorError(InterpreterError):
18
- pass
19
-
20
-
21
- class GetTensorError(InterpreterError):
22
- pass
23
-
24
-
25
- class ModelSizeError(InterpreterError):
26
- pass
27
-
28
-
29
- class ArenaSizeError(InterpreterError):
30
- pass
31
-
32
-
33
- class DeviceTimeoutError(InterpreterError):
34
- pass
35
-
36
-
37
- class GetProfilerTimesError(InterpreterError):
38
- pass
1
+ # Copyright 2021 XMOS LIMITED. This Software is subject to the terms of the
2
+ # XMOS Public License: Version 1
3
+
4
+
5
+ class InterpreterError(Exception):
6
+ pass
7
+
8
+
9
+ class AllocateTensorsError(InterpreterError):
10
+ pass
11
+
12
+
13
+ class InvokeError(InterpreterError):
14
+ pass
15
+
16
+
17
+ class SetTensorError(InterpreterError):
18
+ pass
19
+
20
+
21
+ class GetTensorError(InterpreterError):
22
+ pass
23
+
24
+
25
+ class ModelSizeError(InterpreterError):
26
+ pass
27
+
28
+
29
+ class ArenaSizeError(InterpreterError):
30
+ pass
31
+
32
+
33
+ class DeviceTimeoutError(InterpreterError):
34
+ pass
35
+
36
+
37
+ class GetProfilerTimesError(InterpreterError):
38
+ pass