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.
- xmos_ai_tools/__init__.py +7 -0
- xmos_ai_tools/io_server/__init__.py +151 -0
- xmos_ai_tools/runtime/__init__.py +0 -0
- xmos_ai_tools/runtime/buildfiles/aitoolslib.cmake +13 -0
- xmos_ai_tools/runtime/buildfiles/aitoolslib.make +8 -0
- xmos_ai_tools/runtime/include/flash_server.h +74 -0
- xmos_ai_tools/runtime/include/flatbuffers/allocator.h +68 -0
- xmos_ai_tools/runtime/include/flatbuffers/array.h +243 -0
- xmos_ai_tools/runtime/include/flatbuffers/base.h +474 -0
- xmos_ai_tools/runtime/include/flatbuffers/bfbs_generator.h +43 -0
- xmos_ai_tools/runtime/include/flatbuffers/buffer.h +142 -0
- xmos_ai_tools/runtime/include/flatbuffers/buffer_ref.h +53 -0
- xmos_ai_tools/runtime/include/flatbuffers/code_generators.h +235 -0
- xmos_ai_tools/runtime/include/flatbuffers/default_allocator.h +64 -0
- xmos_ai_tools/runtime/include/flatbuffers/detached_buffer.h +114 -0
- xmos_ai_tools/runtime/include/flatbuffers/flatbuffer_builder.h +1197 -0
- xmos_ai_tools/runtime/include/flatbuffers/flatbuffers.h +270 -0
- xmos_ai_tools/runtime/include/flatbuffers/flatc.h +111 -0
- xmos_ai_tools/runtime/include/flatbuffers/flexbuffers.h +1897 -0
- xmos_ai_tools/runtime/include/flatbuffers/grpc.h +300 -0
- xmos_ai_tools/runtime/include/flatbuffers/hash.h +127 -0
- xmos_ai_tools/runtime/include/flatbuffers/idl.h +1232 -0
- xmos_ai_tools/runtime/include/flatbuffers/minireflect.h +419 -0
- xmos_ai_tools/runtime/include/flatbuffers/pch/flatc_pch.h +39 -0
- xmos_ai_tools/runtime/include/flatbuffers/pch/pch.h +38 -0
- xmos_ai_tools/runtime/include/flatbuffers/reflection.h +502 -0
- xmos_ai_tools/runtime/include/flatbuffers/reflection_generated.h +1449 -0
- xmos_ai_tools/runtime/include/flatbuffers/registry.h +128 -0
- xmos_ai_tools/runtime/include/flatbuffers/stl_emulation.h +509 -0
- xmos_ai_tools/runtime/include/flatbuffers/string.h +64 -0
- xmos_ai_tools/runtime/include/flatbuffers/struct.h +53 -0
- xmos_ai_tools/runtime/include/flatbuffers/table.h +168 -0
- xmos_ai_tools/runtime/include/flatbuffers/util.h +690 -0
- xmos_ai_tools/runtime/include/flatbuffers/vector.h +370 -0
- xmos_ai_tools/runtime/include/flatbuffers/vector_downward.h +271 -0
- xmos_ai_tools/runtime/include/flatbuffers/verifier.h +283 -0
- xmos_ai_tools/runtime/include/ioserver.h +44 -0
- xmos_ai_tools/runtime/include/lib_nn/api/TransposeConv.h +24 -0
- xmos_ai_tools/runtime/include/lib_nn/api/add_int16.h +27 -0
- xmos_ai_tools/runtime/include/lib_nn/api/add_int16_transform.h +42 -0
- xmos_ai_tools/runtime/include/lib_nn/api/dequantize_int16.h +22 -0
- xmos_ai_tools/runtime/include/lib_nn/api/dequantize_int16_transform.h +34 -0
- xmos_ai_tools/runtime/include/lib_nn/api/expand_8_to_16.h +8 -0
- xmos_ai_tools/runtime/include/lib_nn/api/multiply_int16.h +42 -0
- xmos_ai_tools/runtime/include/lib_nn/api/multiply_int16_transform.h +71 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_api.h +15 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_bin_types.h +14 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_config.h +287 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_conv2d_structs.h +72 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_image.h +26 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +303 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_op_helper.h +132 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_op_utils.h +150 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_operator.h +18 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_pooling.h +551 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_types.h +83 -0
- xmos_ai_tools/runtime/include/lib_nn/api/nn_window_params.h +55 -0
- xmos_ai_tools/runtime/include/lib_nn/api/output_transform_fn_int16.h +54 -0
- xmos_ai_tools/runtime/include/lib_nn/api/output_transform_fn_int16_kernel_transform.h +37 -0
- xmos_ai_tools/runtime/include/lib_nn/api/output_transform_fn_int16_mappings.h +13 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +82 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quadratic_interpolation.h +23 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quantize_int16.h +22 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quantize_int16_transform.h +33 -0
- xmos_ai_tools/runtime/include/lib_nn/api/version.h +13 -0
- xmos_ai_tools/runtime/include/lib_nn/api/vpu_memmove_word_aligned.h +15 -0
- xmos_ai_tools/runtime/include/lib_nn/api/vpu_memset_256.h +55 -0
- xmos_ai_tools/runtime/include/lib_nn/api/vpu_sim.h +118 -0
- xmos_ai_tools/runtime/include/lib_nn/api/xs3_vpu.h +216 -0
- xmos_ai_tools/runtime/include/lib_nn/api/xs3a_registers.h +2869 -0
- xmos_ai_tools/runtime/include/lib_nn/src/asm/asm_constants.h +41 -0
- xmos_ai_tools/runtime/include/lib_nn/src/asm/window_op_plan.h +25 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/fast_flash.h +47 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/inference_engine.h +218 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/memory_parallel_transport.h +52 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/version.h +13 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_config.h +17 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_device_memory.h +62 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_shared_config.h +31 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/conv2d_float.h +155 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_common.h +19 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_custom_options.h +28 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_error_reporter.h +32 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_interpreter.h +49 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +71 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_profiler.h +49 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.h +160 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/thread_call.h +119 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_defs.h +4 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_device.h +4 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_std_descriptors.h +4 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/legacy/usb_std_requests.h +4 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud.h +518 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_conf_default.h +11 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_device.h +87 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_std_descriptors.h +191 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud_std_requests.h +120 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/XUD_USB_Defines.h +70 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/hid.h +23 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/usbaudio10.h +30 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/usbaudio20.h +357 -0
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/src/user/class/usbaudiocommon.h +168 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/delay_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/energy_flexbuffers_generated_data.h +28 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/fft_flexbuffers_generated_data.h +37 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_log_flexbuffers_generated_data.h +27 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/filter_bank_spectral_subtraction_flexbuffers_generated_data.h +26 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/framer_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/irfft.h +31 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/overlap_add_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/pcan_flexbuffers_generated_data.h +7 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/rfft.h +31 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/stacker_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/micro/kernels/window_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/signal/src/circular_buffer.h +118 -0
- xmos_ai_tools/runtime/include/signal/src/complex.h +29 -0
- xmos_ai_tools/runtime/include/signal/src/energy.h +38 -0
- xmos_ai_tools/runtime/include/signal/src/fft_auto_scale.h +35 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank.h +69 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank_log.h +38 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank_spectral_subtraction.h +73 -0
- xmos_ai_tools/runtime/include/signal/src/filter_bank_square_root.h +34 -0
- xmos_ai_tools/runtime/include/signal/src/irfft.h +84 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_common.h +49 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_float.h +31 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int16.h +30 -0
- xmos_ai_tools/runtime/include/signal/src/kiss_fft_wrappers/kiss_fft_int32.h +31 -0
- xmos_ai_tools/runtime/include/signal/src/log.h +30 -0
- xmos_ai_tools/runtime/include/signal/src/max_abs.h +31 -0
- xmos_ai_tools/runtime/include/signal/src/msb.h +32 -0
- xmos_ai_tools/runtime/include/signal/src/overlap_add.h +46 -0
- xmos_ai_tools/runtime/include/signal/src/pcan_argc_fixed.h +41 -0
- xmos_ai_tools/runtime/include/signal/src/rfft.h +85 -0
- xmos_ai_tools/runtime/include/signal/src/square_root.h +32 -0
- xmos_ai_tools/runtime/include/signal/src/window.h +31 -0
- xmos_ai_tools/runtime/include/signal/testdata/fft_test_data.h +48 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/array.h +156 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/builtin_op_data.h +22 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/builtin_ops.h +241 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/c/builtin_op_data.h +20 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/c/c_api_types.h +26 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/c/common.h +30 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/context_util.h +54 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +72 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +440 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/tensor_utils.h +28 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/builtin_op_data.h +626 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +178 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +1496 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/core/macros.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/bits.h +102 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/fft.h +50 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/fft_io.h +34 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/fft_util.h +34 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/filterbank.h +63 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/filterbank_io.h +35 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h +50 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/frontend.h +64 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/frontend_io.h +31 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/frontend_util.h +52 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/kiss_fft_common.h +48 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/kiss_fft_int16.h +33 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_lut.h +40 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_scale.h +39 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_scale_io.h +33 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h +45 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/noise_reduction.h +46 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_io.h +36 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h +50 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.h +47 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h +57 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/window.h +49 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/window_io.h +34 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/experimental/microfrontend/lib/window_util.h +45 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +1358 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/compatibility.h +122 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +40 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/max.h +35 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/min.h +35 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/optimized/neon_check.h +20 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +141 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor_utils.h +623 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/quantization_util.h +292 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +561 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add_n.h +86 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/arg_min_max.h +88 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_matmul.h +275 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_to_space_nd.h +101 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/binary_function.h +91 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_args.h +56 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_to.h +97 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/ceil.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +271 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/concatenation.h +141 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +289 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/cumsum.h +175 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depth_to_space.h +79 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h +100 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h +319 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/dequantize.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/div.h +247 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/elu.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/exp.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fill.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor.h +39 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_div.h +35 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_mod.h +44 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fully_connected.h +323 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/hard_swish.h +168 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +250 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +241 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h +291 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h +126 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h +67 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h +121 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h +18 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +194 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h +264 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h +117 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h +224 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/l2normalization.h +90 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/leaky_relu.h +69 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/log_softmax.h +256 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/logistic.h +132 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/lstm_cell.h +422 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/maximum_minimum.h +64 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +267 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/neg.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pad.h +169 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pooling.h +303 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h +333 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h +244 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/prelu.h +111 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h +140 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/quantize.h +89 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +491 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/requantize.h +70 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +233 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h +102 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/round.h +51 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/select.h +151 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/slice.h +80 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/softmax.h +233 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_batch_nd.h +109 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_depth.h +80 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/strided_slice.h +147 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +465 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/tanh.h +129 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose.h +203 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose_conv.h +225 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +168 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +278 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +42 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +1096 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +341 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/op_macros.h +49 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/padding.h +115 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h +100 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/non_persistent_arena_buffer_allocator.h +104 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/persistent_arena_buffer_allocator.h +58 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/recording_single_arena_buffer_allocator.h +63 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.h +144 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/benchmarks/micro_benchmark.h +95 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/compatibility.h +32 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/cortex_m_generic/debug_log_callback.h +49 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/debug_log.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/expected_output_data.h +47 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/input_data.h +108 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/network_model.h +166 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/detection_responder.h +32 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/image_provider.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/main_functions.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/person_detection/model_settings.h +35 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +70 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/flatbuffer_utils.h +65 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activation_utils.h +57 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activations.h +64 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h +141 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h +75 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h +56 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h +310 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h +145 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/ceva_common.h +24 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/ceva_tflm_lib.h +613 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/mcps_macros.h +115 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/types.h +1286 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +45 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer_flexbuffers_generated_data.h +22 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +117 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +94 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +80 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/dequantize.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/detection_postprocess_flexbuffers_generated_data.h +25 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +28 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +112 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/hard_swish.h +30 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +86 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +150 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/leaky_relu.h +43 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logical.h +35 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logistic.h +42 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval.h +541 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval_test.h +817 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_shared.h +150 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +158 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_tensor_utils.h +56 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +74 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pad.h +27 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +142 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/prelu.h +39 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/quantize.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +65 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +26 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +67 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +40 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/sub.h +60 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +100 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/conv_test_data.h +37 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/lstm_test_data.h +579 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +47 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/hifimini/fixedpoint_utils.h +139 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_eval.h +216 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_shared.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_add.h +48 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +89 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +74 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_fully_connected.h +78 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pad.h +49 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pooling.h +76 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reduce.h +47 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +44 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +58 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_svdf.h +39 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_helpers.h +64 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +170 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +53 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/memory_plan_struct.h +73 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +95 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +133 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocation_info.h +138 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +351 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_arena_constants.h +28 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_common.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +176 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +79 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +189 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +125 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +110 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +42 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +708 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +62 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +140 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler_interface.h +38 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_resource_variable.h +89 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_time.h +36 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_utils.h +162 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +60 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/interpreter/src/python_ops_resolver.h +21 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size.h +30 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.h +33 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_allocator.h +125 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_interpreter.h +69 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/system_setup.h +27 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +49 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +334 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +267 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/test_conv_model.h +23 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/flatbuffer_conversions_bridge.h +45 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.h +36 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +273 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +41 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +127 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/portable_type_to_tflitetype.h +75 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +24644 -0
- xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_utils.h +33 -0
- xmos_ai_tools/runtime/include/tile_ram_server.h +38 -0
- xmos_ai_tools/runtime/lib/libhost_xtflitemicro.a +0 -0
- xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
- xmos_ai_tools/xformer/__init__.py +60 -0
- xmos_ai_tools/xformer/flash.py +190 -0
- xmos_ai_tools/xinterpreters/__init__.py +1 -0
- xmos_ai_tools/xinterpreters/exceptions.py +38 -0
- xmos_ai_tools/xinterpreters/host_interpreter.py +652 -0
- xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.1.0.1.dylib +0 -0
- xmos_ai_tools/xinterpreters/libs/macos/xtflm_python.dylib +0 -0
- xmos_ai_tools-1.3.2.dev80.data/data/bin/xcore-opt +0 -0
- xmos_ai_tools-1.3.2.dev80.dist-info/METADATA +33 -0
- xmos_ai_tools-1.3.2.dev80.dist-info/RECORD +395 -0
- xmos_ai_tools-1.3.2.dev80.dist-info/WHEEL +5 -0
- xmos_ai_tools-1.3.2.dev80.dist-info/top_level.txt +1 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
/* Copyright 2022 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_ARENA_ALLOCATOR_NON_PERSISTENT_ARENA_BUFFER_ALLOCATOR_H_
|
16
|
+
#define TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_NON_PERSISTENT_ARENA_BUFFER_ALLOCATOR_H_
|
17
|
+
|
18
|
+
#include <cstddef>
|
19
|
+
#include <cstdint>
|
20
|
+
|
21
|
+
#include "tensorflow/lite/c/common.h"
|
22
|
+
#include "tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h"
|
23
|
+
#include "tensorflow/lite/micro/compatibility.h"
|
24
|
+
|
25
|
+
namespace tflite_micro {
|
26
|
+
|
27
|
+
// Implement INonPersistentBufferAllocator on an arena that is dedicated for
|
28
|
+
// non-persistent buffers.
|
29
|
+
class NonPersistentArenaBufferAllocator : public INonPersistentBufferAllocator {
|
30
|
+
public:
|
31
|
+
NonPersistentArenaBufferAllocator(uint8_t* buffer, size_t buffer_size);
|
32
|
+
virtual ~NonPersistentArenaBufferAllocator();
|
33
|
+
|
34
|
+
// Allocates a temporary buffer. This buffer is not resizable.
|
35
|
+
uint8_t* AllocateTemp(size_t size, size_t alignment) override;
|
36
|
+
|
37
|
+
// Signals that a temporary buffer is no longer needed.
|
38
|
+
void DeallocateTemp(uint8_t* buf) override;
|
39
|
+
|
40
|
+
// Returns true if all temporary buffers are already deallocated.
|
41
|
+
bool IsAllTempDeallocated() override;
|
42
|
+
|
43
|
+
// Signals that all temporary allocations can be reclaimed. TFLM calls this
|
44
|
+
// API when it knows that all temporary buffers that it requested has been
|
45
|
+
// deallocated.
|
46
|
+
TfLiteStatus ResetTempAllocations() override;
|
47
|
+
|
48
|
+
// Returns a buffer that is resizable viable ResizeBuffer().
|
49
|
+
uint8_t* AllocateResizableBuffer(size_t size, size_t alignment) override;
|
50
|
+
|
51
|
+
// Resizes a buffer that is previously returned by the
|
52
|
+
// AllocateResizableBuffer.
|
53
|
+
TfLiteStatus ResizeBuffer(uint8_t* resizable_buf, size_t size,
|
54
|
+
size_t alignment) override;
|
55
|
+
|
56
|
+
// Frees up the memory occupied by the resizable buffer.
|
57
|
+
TfLiteStatus DeallocateResizableBuffer(uint8_t* resizable_buf) override;
|
58
|
+
|
59
|
+
// Returns a pointer pointing to the start of the overlay memory, which is
|
60
|
+
// used for activation tensors and scratch buffers by kernels at Invoke stage.
|
61
|
+
uint8_t* GetOverlayMemoryAddress() const override;
|
62
|
+
|
63
|
+
// Reserves the size of the overlay memory. This overlay is reserved for the
|
64
|
+
// kernels at Invoke stage. This is referred to as the overlay because before
|
65
|
+
// Invoket state, the same memory can be used for temp buffers. The layout of
|
66
|
+
// the memory is planned by the memory planner separately at Invoke stage.
|
67
|
+
TfLiteStatus ReserveNonPersistentOverlayMemory(size_t size,
|
68
|
+
size_t alignment) override;
|
69
|
+
|
70
|
+
// Returns the size of non-persistent buffer in use.
|
71
|
+
size_t GetNonPersistentUsedBytes() const override;
|
72
|
+
|
73
|
+
// Returns the number of bytes available with a given alignment. This number
|
74
|
+
// takes in account any temporary allocations.
|
75
|
+
size_t GetAvailableMemory(size_t alignment) const override;
|
76
|
+
|
77
|
+
TF_LITE_REMOVE_VIRTUAL_DELETE
|
78
|
+
|
79
|
+
private:
|
80
|
+
// The memory arena that this allocator manages.
|
81
|
+
uint8_t* const buffer_head_;
|
82
|
+
uint8_t* const buffer_tail_;
|
83
|
+
|
84
|
+
// The whole region is split into two parts:
|
85
|
+
// buffer_head_ to head_temp_ - 1 belongs to the only resizable buffer.
|
86
|
+
// head_temp_ to buffer_tail_ can be used for (non-resizable) temp buffers.
|
87
|
+
uint8_t* head_temp_;
|
88
|
+
|
89
|
+
// next_temp_ points to the next available temp buffer allocation address and
|
90
|
+
// its range is between head_temp_ and buffer_tail_
|
91
|
+
uint8_t* next_temp_;
|
92
|
+
|
93
|
+
// XOR Check sum for outstanding temp buffers.
|
94
|
+
// If all temp buffers are deallocated OR no temp buffers are allocated,
|
95
|
+
// temp_buffer_ptr_check_sum_ == nullptr.
|
96
|
+
intptr_t temp_buffer_ptr_check_sum_ = 0;
|
97
|
+
// Count of outstanding temp buffers.
|
98
|
+
int temp_buffer_count_ = 0;
|
99
|
+
bool resizable_buffer_allocated_ = false;
|
100
|
+
};
|
101
|
+
|
102
|
+
} // namespace tflite_micro
|
103
|
+
|
104
|
+
#endif // TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_NON_PERSISTENT_ARENA_BUFFER_ALLOCATOR_H_
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/* Copyright 2022 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_ARENA_ALLOCATOR_PERSISTENT_ARENA_BUFFER_ALLOCATOR_H_
|
16
|
+
#define TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_PERSISTENT_ARENA_BUFFER_ALLOCATOR_H_
|
17
|
+
|
18
|
+
#include <cstddef>
|
19
|
+
#include <cstdint>
|
20
|
+
|
21
|
+
#include "tensorflow/lite/c/common.h"
|
22
|
+
#include "tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h"
|
23
|
+
#include "tensorflow/lite/micro/compatibility.h"
|
24
|
+
|
25
|
+
namespace tflite_micro {
|
26
|
+
|
27
|
+
// PersistentArenaBufferAllocator is an implementatation of
|
28
|
+
// IPersistentBufferAllocator interface on an arena that is dedicated for
|
29
|
+
// persistent buffers.
|
30
|
+
class PersistentArenaBufferAllocator : public IPersistentBufferAllocator {
|
31
|
+
public:
|
32
|
+
PersistentArenaBufferAllocator(uint8_t* buffer, size_t buffer_size);
|
33
|
+
virtual ~PersistentArenaBufferAllocator();
|
34
|
+
|
35
|
+
// Allocates persistent memory. The persistent buffer is never freed.
|
36
|
+
// Returns nullptr if errors occured.
|
37
|
+
uint8_t* AllocatePersistentBuffer(size_t size, size_t alignment) override;
|
38
|
+
|
39
|
+
// Returns the size of all persistent allocations in bytes.
|
40
|
+
size_t GetPersistentUsedBytes() const override;
|
41
|
+
|
42
|
+
TF_LITE_REMOVE_VIRTUAL_DELETE
|
43
|
+
private:
|
44
|
+
// The memory arena that this allocator manages.
|
45
|
+
uint8_t* const buffer_head_;
|
46
|
+
uint8_t* const buffer_tail_;
|
47
|
+
|
48
|
+
// The whole region is split into two parts:
|
49
|
+
// tail_temp_ to buffer_tail_ contains allocated buffers;
|
50
|
+
// buffer_head_ to tail_temp_ - 1 belongs to still available spaces.
|
51
|
+
// So in essence, the allocated region grows from the bottom and emulates
|
52
|
+
// SingleArenaBufferAllocator's persistent part.
|
53
|
+
uint8_t* tail_temp_;
|
54
|
+
};
|
55
|
+
|
56
|
+
} // namespace tflite_micro
|
57
|
+
|
58
|
+
#endif // TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_PERSISTENT_ARENA_BUFFER_ALLOCATOR_H_
|
@@ -0,0 +1,63 @@
|
|
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_ARENA_ALLOCATOR_RECORDING_SINGLE_ARENA_BUFFER_ALLOCATOR_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_RECORDING_SINGLE_ARENA_BUFFER_ALLOCATOR_H_
|
18
|
+
|
19
|
+
#include "tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.h"
|
20
|
+
#include "tensorflow/lite/micro/compatibility.h"
|
21
|
+
|
22
|
+
namespace tflite_micro {
|
23
|
+
|
24
|
+
// Utility class used to log allocations of a SingleArenaBufferAllocator. Should
|
25
|
+
// only be used in debug/evaluation settings or unit tests to evaluate
|
26
|
+
// allocation usage.
|
27
|
+
class RecordingSingleArenaBufferAllocator : public SingleArenaBufferAllocator {
|
28
|
+
public:
|
29
|
+
RecordingSingleArenaBufferAllocator(uint8_t* buffer_head, size_t buffer_size);
|
30
|
+
// TODO(b/157615197): Cleanup constructors/destructor and use factory
|
31
|
+
// functions.
|
32
|
+
~RecordingSingleArenaBufferAllocator() override;
|
33
|
+
|
34
|
+
static RecordingSingleArenaBufferAllocator* Create(uint8_t* buffer_head,
|
35
|
+
size_t buffer_size);
|
36
|
+
|
37
|
+
// Returns the number of bytes requested from the head or tail.
|
38
|
+
size_t GetRequestedBytes() const;
|
39
|
+
|
40
|
+
// Returns the number of bytes actually allocated from the head or tail. This
|
41
|
+
// value will be >= to the number of requested bytes due to padding and
|
42
|
+
// alignment.
|
43
|
+
size_t GetUsedBytes() const;
|
44
|
+
|
45
|
+
// Returns the number of alloc calls from the head or tail.
|
46
|
+
size_t GetAllocatedCount() const;
|
47
|
+
|
48
|
+
TfLiteStatus ResizeBuffer(uint8_t* resizable_buf, size_t size,
|
49
|
+
size_t alignment) override;
|
50
|
+
uint8_t* AllocatePersistentBuffer(size_t size, size_t alignment) override;
|
51
|
+
|
52
|
+
private:
|
53
|
+
size_t requested_head_bytes_;
|
54
|
+
size_t requested_tail_bytes_;
|
55
|
+
size_t used_bytes_;
|
56
|
+
size_t alloc_count_;
|
57
|
+
|
58
|
+
TF_LITE_REMOVE_VIRTUAL_DELETE
|
59
|
+
};
|
60
|
+
|
61
|
+
} // namespace tflite_micro
|
62
|
+
|
63
|
+
#endif // TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_RECORDING_SINGLE_ARENA_BUFFER_ALLOCATOR_H_
|
xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.h
ADDED
@@ -0,0 +1,144 @@
|
|
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_ARENA_ALLOCATOR_SINGLE_ARENA_BUFFER_ALLOCATOR_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_SINGLE_ARENA_BUFFER_ALLOCATOR_H_
|
18
|
+
|
19
|
+
#include <cstddef>
|
20
|
+
#include <cstdint>
|
21
|
+
|
22
|
+
#include "tensorflow/lite/c/common.h"
|
23
|
+
#include "tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h"
|
24
|
+
#include "tensorflow/lite/micro/compatibility.h"
|
25
|
+
|
26
|
+
namespace tflite_micro {
|
27
|
+
|
28
|
+
// TODO(petewarden): This allocator never frees up or reuses any memory, even
|
29
|
+
// though we have enough information about lifetimes of the tensors to do so.
|
30
|
+
// This makes it pretty wasteful, so we should use a more intelligent method.
|
31
|
+
class SingleArenaBufferAllocator : public INonPersistentBufferAllocator,
|
32
|
+
public IPersistentBufferAllocator {
|
33
|
+
public:
|
34
|
+
// TODO(b/157615197): Cleanup constructors/destructor and use factory
|
35
|
+
// functions.
|
36
|
+
SingleArenaBufferAllocator(uint8_t* buffer_head, uint8_t* buffer_tail);
|
37
|
+
SingleArenaBufferAllocator(uint8_t* buffer, size_t buffer_size);
|
38
|
+
virtual ~SingleArenaBufferAllocator();
|
39
|
+
|
40
|
+
// Creates a new SingleArenaBufferAllocator from a given buffer head and size.
|
41
|
+
static SingleArenaBufferAllocator* Create(uint8_t* buffer_head,
|
42
|
+
size_t buffer_size);
|
43
|
+
|
44
|
+
// Resizes a buffer that is previously returned by the
|
45
|
+
// AllocateResizableBuffer. In current implementation, it Adjusts the head
|
46
|
+
// (lowest address and moving upwards) memory allocation to a given size.
|
47
|
+
// Calls to this method will also invalidate all temporary allocation values
|
48
|
+
// (it sets the location of temp space at the end of the head section). This
|
49
|
+
// call will fail if a chain of allocations through AllocateTemp() have not
|
50
|
+
// been cleaned up with a call to ResetTempAllocations().
|
51
|
+
virtual TfLiteStatus ResizeBuffer(uint8_t* resizable_buf, size_t size,
|
52
|
+
size_t alignment) override;
|
53
|
+
|
54
|
+
// Returns a buffer that is resizable viable ResizeBuffer(). Only one
|
55
|
+
// resizable buffer is currently supported.
|
56
|
+
virtual uint8_t* AllocateResizableBuffer(size_t size,
|
57
|
+
size_t alignment) override;
|
58
|
+
|
59
|
+
// Frees up the memory occupied by the resizable buffer
|
60
|
+
virtual TfLiteStatus DeallocateResizableBuffer(
|
61
|
+
uint8_t* resizable_buf) override;
|
62
|
+
|
63
|
+
// Reserves the non-persistent memory that is planned by the memory planner.
|
64
|
+
virtual TfLiteStatus ReserveNonPersistentOverlayMemory(
|
65
|
+
size_t size, size_t alignment) override;
|
66
|
+
|
67
|
+
// Allocates persistent memory starting at the tail of the arena (highest
|
68
|
+
// address and moving downwards).
|
69
|
+
virtual uint8_t* AllocatePersistentBuffer(size_t size,
|
70
|
+
size_t alignment) override;
|
71
|
+
|
72
|
+
// Allocates a temporary buffer from the head of the arena (lowest address and
|
73
|
+
// moving upwards) but does not update the actual head allocation size or
|
74
|
+
// position. The returned buffer is guaranteed until either
|
75
|
+
// ResetTempAllocations() is called or another call to AllocateFromHead().
|
76
|
+
// Repeat calls to this function will create a chain of temp allocations. All
|
77
|
+
// calls to AllocateTemp() must end with a call to ResetTempAllocations(). If
|
78
|
+
// AllocateFromHead() is called before a call to ResetTempAllocations(), it
|
79
|
+
// will fail with an error message.
|
80
|
+
virtual uint8_t* AllocateTemp(size_t size, size_t alignment) override;
|
81
|
+
|
82
|
+
// Signals that a temporary buffer is no longer needed. This is currently for
|
83
|
+
// book-keeping purpose and the memory region are not immediately available
|
84
|
+
// for re-use. The deallocated memory region are only reclaimed after
|
85
|
+
// ResetTempAllocations is called as it is right now.
|
86
|
+
virtual void DeallocateTemp(uint8_t* buf) override;
|
87
|
+
|
88
|
+
// Returns true if all temporary buffers are already deallocated.
|
89
|
+
virtual bool IsAllTempDeallocated() override;
|
90
|
+
|
91
|
+
// Resets a chain of temporary allocations back to the current head of the
|
92
|
+
// arena (lowest address).
|
93
|
+
virtual TfLiteStatus ResetTempAllocations() override;
|
94
|
+
|
95
|
+
// Returns a pointer to the buffer currently assigned to the head section.
|
96
|
+
// This buffer is set by calling SetHeadSize().
|
97
|
+
uint8_t* GetOverlayMemoryAddress() const override;
|
98
|
+
|
99
|
+
// Returns the size of the head section in bytes.
|
100
|
+
size_t GetNonPersistentUsedBytes() const override;
|
101
|
+
|
102
|
+
// Returns the size of all allocations in the tail section in bytes.
|
103
|
+
size_t GetPersistentUsedBytes() const override;
|
104
|
+
|
105
|
+
// Returns the number of bytes available with a given alignment. This number
|
106
|
+
// takes in account any temporary allocations.
|
107
|
+
size_t GetAvailableMemory(size_t alignment) const override;
|
108
|
+
|
109
|
+
// Returns the number of used bytes in the allocator. This number takes in
|
110
|
+
// account any temporary allocations.
|
111
|
+
size_t GetUsedBytes() const;
|
112
|
+
|
113
|
+
TF_LITE_REMOVE_VIRTUAL_DELETE
|
114
|
+
|
115
|
+
protected:
|
116
|
+
// Returns a pointer to the current end of the head buffer.
|
117
|
+
uint8_t* head() const;
|
118
|
+
|
119
|
+
// Returns a pointer to the current end of the tail buffer.
|
120
|
+
uint8_t* tail() const;
|
121
|
+
|
122
|
+
private:
|
123
|
+
size_t GetBufferSize() const;
|
124
|
+
uint8_t* buffer_head_;
|
125
|
+
uint8_t* buffer_tail_;
|
126
|
+
uint8_t* head_;
|
127
|
+
uint8_t* tail_;
|
128
|
+
uint8_t* temp_;
|
129
|
+
|
130
|
+
// The combination of the checksum of outstanding temporary buffer pointers
|
131
|
+
// AND the count of outstanding temporary buffer provide a low cost mechanism
|
132
|
+
// to audit temporary buffers' allocation and deallocation.
|
133
|
+
//
|
134
|
+
// XOR Check sum for outstanding temp buffers.
|
135
|
+
// If all temp buffers are deallocated OR no temp buffers are allocated,
|
136
|
+
// temp_buffer_ptr_check_sum_ == nullptr.
|
137
|
+
intptr_t temp_buffer_ptr_check_sum_ = 0;
|
138
|
+
// Count of outstanding temp buffers.
|
139
|
+
int temp_buffer_count_ = 0;
|
140
|
+
};
|
141
|
+
|
142
|
+
} // namespace tflite_micro
|
143
|
+
|
144
|
+
#endif // TENSORFLOW_LITE_MICRO_ARENA_ALLOCATOR_SINGLE_ARENA_BUFFER_ALLOCATOR_H_
|
@@ -0,0 +1,95 @@
|
|
1
|
+
/* Copyright 2022 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_BENCHMARKS_MICRO_BENCHMARK_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_
|
18
|
+
|
19
|
+
#include <climits>
|
20
|
+
|
21
|
+
#include "tensorflow/lite/micro/micro_log.h"
|
22
|
+
#include "tensorflow/lite/micro/micro_op_resolver.h"
|
23
|
+
#include "tensorflow/lite/micro/micro_profiler_interface.h"
|
24
|
+
#include "tensorflow/lite/micro/micro_resource_variable.h"
|
25
|
+
#include "tensorflow/lite/micro/micro_time.h"
|
26
|
+
#include "tensorflow/lite/micro/recording_micro_interpreter.h"
|
27
|
+
|
28
|
+
namespace tflite_micro {
|
29
|
+
|
30
|
+
template <typename inputT>
|
31
|
+
class MicroBenchmarkRunner {
|
32
|
+
public:
|
33
|
+
// The lifetimes of model, op_resolver, tensor_arena, profiler must exceed
|
34
|
+
// that of the created MicroBenchmarkRunner object.
|
35
|
+
MicroBenchmarkRunner(const uint8_t* model,
|
36
|
+
const tflite_micro::MicroOpResolver* op_resolver,
|
37
|
+
uint8_t* tensor_arena, int tensor_arena_size,
|
38
|
+
MicroProfilerInterface* profiler,
|
39
|
+
int num_resource_variables = 0)
|
40
|
+
: allocator_(
|
41
|
+
RecordingMicroAllocator::Create(tensor_arena, tensor_arena_size)),
|
42
|
+
interpreter_(
|
43
|
+
GetModel(model), *op_resolver, allocator_,
|
44
|
+
MicroResourceVariables::Create(allocator_, num_resource_variables),
|
45
|
+
profiler) {
|
46
|
+
interpreter_.AllocateTensors();
|
47
|
+
}
|
48
|
+
|
49
|
+
void RunSingleIteration() {
|
50
|
+
// Run the model on this input and make sure it succeeds.
|
51
|
+
TfLiteStatus invoke_status = interpreter_.Invoke();
|
52
|
+
if (invoke_status == kTfLiteError) {
|
53
|
+
MicroPrintf("Invoke failed.");
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
int NumInputs() { return interpreter_.inputs().size(); }
|
58
|
+
|
59
|
+
void SetRandomInput(const int random_seed, int input_index = 0) {
|
60
|
+
// The pseudo-random number generator is initialized to a constant seed
|
61
|
+
std::srand(random_seed);
|
62
|
+
TfLiteTensor* input = interpreter_.input(input_index);
|
63
|
+
|
64
|
+
// Pre-populate input tensor with random values.
|
65
|
+
int input_length = input->bytes / sizeof(inputT);
|
66
|
+
inputT* input_values = tflite_micro::GetTensorData<inputT>(input);
|
67
|
+
for (int i = 0; i < input_length; i++) {
|
68
|
+
// Pre-populate input tensor with a random value based on a constant seed.
|
69
|
+
input_values[i] = static_cast<inputT>(
|
70
|
+
std::rand() % (std::numeric_limits<inputT>::max() -
|
71
|
+
std::numeric_limits<inputT>::min() + 1));
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
void SetInput(const inputT* custom_input, int input_index = 0) {
|
76
|
+
TfLiteTensor* input = interpreter_.input(input_index);
|
77
|
+
inputT* input_buffer = tflite_micro::GetTensorData<inputT>(input);
|
78
|
+
int input_length = input->bytes / sizeof(inputT);
|
79
|
+
for (int i = 0; i < input_length; i++) {
|
80
|
+
input_buffer[i] = custom_input[i];
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
void PrintAllocations() const {
|
85
|
+
interpreter_.GetMicroAllocator().PrintAllocations();
|
86
|
+
}
|
87
|
+
|
88
|
+
private:
|
89
|
+
tflite_micro::RecordingMicroAllocator* allocator_;
|
90
|
+
tflite_micro::RecordingMicroInterpreter interpreter_;
|
91
|
+
};
|
92
|
+
|
93
|
+
} // namespace tflite_micro
|
94
|
+
|
95
|
+
#endif // TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_
|
@@ -0,0 +1,32 @@
|
|
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_COMPATIBILITY_H_
|
16
|
+
#define TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_
|
17
|
+
|
18
|
+
// C++ will automatically create class-specific delete operators for virtual
|
19
|
+
// objects, which by default call the global delete function. For embedded
|
20
|
+
// applications we want to avoid this, and won't be calling new/delete on these
|
21
|
+
// objects, so we need to override the default implementation with one that does
|
22
|
+
// nothing to avoid linking in ::delete().
|
23
|
+
// This macro needs to be included in all subclasses of a virtual base class in
|
24
|
+
// the private section.
|
25
|
+
#ifdef TF_LITE_STATIC_MEMORY
|
26
|
+
#define TF_LITE_REMOVE_VIRTUAL_DELETE \
|
27
|
+
void operator delete(void* p) {}
|
28
|
+
#else
|
29
|
+
#define TF_LITE_REMOVE_VIRTUAL_DELETE
|
30
|
+
#endif
|
31
|
+
|
32
|
+
#endif // TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_
|
@@ -0,0 +1,49 @@
|
|
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
|
+
#ifndef TENSORFLOW_LITE_MICRO_CORTEX_M_GENERIC_DEBUG_LOG_CALLBACK_H_
|
16
|
+
#define TENSORFLOW_LITE_MICRO_CORTEX_M_GENERIC_DEBUG_LOG_CALLBACK_H_
|
17
|
+
|
18
|
+
// The application layer must implement and register a callback before calling
|
19
|
+
// the network in a way similar to
|
20
|
+
//
|
21
|
+
// void debug_log_printf(const char* s)
|
22
|
+
// {
|
23
|
+
// printf(s);
|
24
|
+
// }
|
25
|
+
//
|
26
|
+
// int main(void)
|
27
|
+
// {
|
28
|
+
// // Register callback for printing debug log
|
29
|
+
// RegisterDebugLogCallback(debug_log_printf);
|
30
|
+
//
|
31
|
+
// // now call the network
|
32
|
+
// TfLiteStatus invoke_status = interpreter->Invoke();
|
33
|
+
// }
|
34
|
+
|
35
|
+
#ifdef __cplusplus
|
36
|
+
extern "C" {
|
37
|
+
#endif // __cplusplus
|
38
|
+
|
39
|
+
typedef void (*DebugLogCallback)(const char* s);
|
40
|
+
|
41
|
+
// Registers and application-specific callback for debug logging. It must be
|
42
|
+
// called before the first call to DebugLog().
|
43
|
+
void RegisterDebugLogCallback(DebugLogCallback callback);
|
44
|
+
|
45
|
+
#ifdef __cplusplus
|
46
|
+
} // extern "C"
|
47
|
+
#endif // __cplusplus
|
48
|
+
|
49
|
+
#endif // TENSORFLOW_LITE_MICRO_CORTEX_M_GENERIC_DEBUG_LOG_CALLBACK_H_
|
@@ -0,0 +1,38 @@
|
|
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
|
+
#ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
|
16
|
+
#define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
|
17
|
+
|
18
|
+
#ifdef __cplusplus
|
19
|
+
#include <cstdarg>
|
20
|
+
#else
|
21
|
+
#include <stdarg.h>
|
22
|
+
#endif // __cplusplus
|
23
|
+
|
24
|
+
#ifdef __cplusplus
|
25
|
+
extern "C" {
|
26
|
+
#endif // __cplusplus
|
27
|
+
|
28
|
+
// This function should be implemented by each target platform, and provide a
|
29
|
+
// way for strings to be output to some text stream. For more information, see
|
30
|
+
// the tensorflow/lite/micro/debug_log.cc file. This function should support
|
31
|
+
// standard C/C++ stdio style formatting operations.
|
32
|
+
void DebugLog(const char* format, va_list args);
|
33
|
+
|
34
|
+
#ifdef __cplusplus
|
35
|
+
} // extern "C"
|
36
|
+
#endif // __cplusplus
|
37
|
+
|
38
|
+
#endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_
|
xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/micro_speech/micro_model_settings.h
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
|
16
|
+
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_MODEL_SETTINGS_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_MODEL_SETTINGS_H_
|
18
|
+
|
19
|
+
// The following values are derived from values used during model training.
|
20
|
+
// If you change the way you preprocess the input, update all these constants.
|
21
|
+
constexpr int kAudioSampleFrequency = 16000;
|
22
|
+
constexpr int kFeatureSize = 40;
|
23
|
+
constexpr int kFeatureCount = 49;
|
24
|
+
constexpr int kFeatureElementCount = (kFeatureSize * kFeatureCount);
|
25
|
+
constexpr int kFeatureStrideMs = 20;
|
26
|
+
constexpr int kFeatureDurationMs = 30;
|
27
|
+
|
28
|
+
// Variables for the model's output categories.
|
29
|
+
constexpr int kCategoryCount = 4;
|
30
|
+
constexpr const char* kCategoryLabels[kCategoryCount] = {
|
31
|
+
"silence",
|
32
|
+
"unknown",
|
33
|
+
"yes",
|
34
|
+
"no",
|
35
|
+
};
|
36
|
+
|
37
|
+
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_MODEL_SETTINGS_H_
|
xmos_ai_tools/runtime/include/tensorflow/lite/micro/examples/network_tester/expected_output_data.h
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
|
16
|
+
#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_EXPECTED_OUTPUT_DATA_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_EXPECTED_OUTPUT_DATA_H_
|
18
|
+
|
19
|
+
#ifdef ETHOS_U
|
20
|
+
static unsigned char expected_output_data[] = {143, 113};
|
21
|
+
#else
|
22
|
+
static unsigned char expected_output_data[] = {
|
23
|
+
0x07, 0xf3, 0x16, 0xf3, 0x3a, 0x1f, 0xb1, 0x45, 0xce, 0x12, 0xc2, 0xbb,
|
24
|
+
0xf5, 0x47, 0x45, 0x91, 0x13, 0x21, 0xc7, 0x07, 0xa2, 0x2c, 0xf2, 0xf7,
|
25
|
+
0xd1, 0xe1, 0x08, 0xf5, 0x0a, 0x58, 0x40, 0xb0, 0xd9, 0xf1, 0x37, 0x1e,
|
26
|
+
0xf1, 0x0d, 0xea, 0x05, 0xf9, 0xee, 0xfa, 0xca, 0x37, 0xb9, 0xc4, 0xd8,
|
27
|
+
0x15, 0xe3, 0xd7, 0xd3, 0x36, 0x14, 0xb7, 0xed, 0x43, 0xfa, 0x29, 0xbe,
|
28
|
+
0xff, 0xdb, 0x38, 0xc7, 0x00, 0xf1, 0x06, 0xbe, 0x31, 0x5b, 0xe9, 0x02,
|
29
|
+
0xf0, 0x07, 0x13, 0x25, 0xe1, 0xf0, 0x0e, 0x12, 0x17, 0xd2, 0x51, 0x48,
|
30
|
+
0x2a, 0x24, 0xf2, 0x0a, 0x3d, 0x05, 0x0b, 0x67, 0xc3, 0xea, 0x0a, 0xbf,
|
31
|
+
0x22, 0x40, 0x20, 0x18, 0x54, 0xd3, 0x31, 0xef, 0xe7, 0x04, 0x3c, 0xf6,
|
32
|
+
0xcf, 0xe2, 0x79, 0xed, 0xec, 0xff, 0xfa, 0xcf, 0xc2, 0x42, 0x1f, 0x0d,
|
33
|
+
0xf8, 0xc2, 0x36, 0x1d, 0x09, 0x01, 0xd2, 0x09, 0xda, 0xdf, 0xe8, 0x1f,
|
34
|
+
0x06, 0xdf, 0xf7, 0x3c, 0x4d, 0xe5, 0xb4, 0xc1, 0xfa, 0x03, 0x22, 0xbc,
|
35
|
+
0x08, 0xea, 0x72, 0x3a, 0xc8, 0x0b, 0xe6, 0x1c, 0x00, 0xef, 0xf1, 0x34,
|
36
|
+
0x01, 0xbe, 0xf7, 0x92, 0xe6, 0xc1, 0xe3, 0x25, 0xe5, 0x4c, 0xf1, 0xbb,
|
37
|
+
0x6f, 0x07, 0x63, 0x80, 0x2a, 0xae, 0x46, 0xf1, 0x3c, 0x01, 0xe8, 0xda,
|
38
|
+
0xed, 0x15, 0xfc, 0x56, 0x18, 0x16, 0x16, 0xc1, 0xf5, 0xef, 0x64, 0x03,
|
39
|
+
0xa5, 0x0c, 0x15, 0x25, 0xe0, 0x51, 0x23, 0xec, 0x31, 0xfe, 0xe9, 0xd9,
|
40
|
+
0x0c, 0x09, 0x42, 0xd8, 0xbc, 0x15, 0xe1, 0x21, 0xe4, 0x09, 0x4f, 0xb5,
|
41
|
+
0xd6, 0x0c, 0x04, 0x20, 0xdf, 0x99, 0x2e, 0xe8, 0x06, 0xad, 0xf5, 0x04,
|
42
|
+
0xf7, 0x1b, 0x5b, 0x63, 0xaa, 0xf3, 0xf0, 0xfc, 0x05, 0x35, 0xf1, 0x1d,
|
43
|
+
0x40, 0x2d, 0xf6, 0xfa, 0xdd, 0x07, 0xfe, 0x32, 0x6d, 0x1b, 0x01, 0x31,
|
44
|
+
0x39, 0xcb, 0x22, 0xf8};
|
45
|
+
#endif
|
46
|
+
|
47
|
+
#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_EXPECTED_OUTPUT_DATA_H_
|