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,156 @@
|
|
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_ARRAY_H_
|
16
|
+
#define TENSORFLOW_LITE_ARRAY_H_
|
17
|
+
|
18
|
+
#include <cstring>
|
19
|
+
#include <initializer_list>
|
20
|
+
#include <memory>
|
21
|
+
#include <type_traits>
|
22
|
+
#include <vector>
|
23
|
+
|
24
|
+
#include "tensorflow/lite/core/c/common.h"
|
25
|
+
|
26
|
+
namespace tflite_micro {
|
27
|
+
|
28
|
+
/// TfLite*Array helpers
|
29
|
+
|
30
|
+
namespace array_internal {
|
31
|
+
|
32
|
+
// Function object used as a deleter for unique_ptr holding TFLite*Array
|
33
|
+
// objects.
|
34
|
+
struct TfLiteArrayDeleter {
|
35
|
+
void operator()(TfLiteIntArray* a);
|
36
|
+
void operator()(TfLiteFloatArray* a);
|
37
|
+
};
|
38
|
+
|
39
|
+
// Maps T to the corresponding TfLiteArray type.
|
40
|
+
template <class T>
|
41
|
+
struct TfLiteArrayInfo;
|
42
|
+
|
43
|
+
template <>
|
44
|
+
struct TfLiteArrayInfo<int> {
|
45
|
+
using Type = TfLiteIntArray;
|
46
|
+
};
|
47
|
+
|
48
|
+
template <>
|
49
|
+
struct TfLiteArrayInfo<float> {
|
50
|
+
using Type = TfLiteFloatArray;
|
51
|
+
};
|
52
|
+
|
53
|
+
} // namespace array_internal
|
54
|
+
|
55
|
+
template <class T>
|
56
|
+
using TfLiteArrayUniquePtr =
|
57
|
+
std::unique_ptr<typename array_internal::TfLiteArrayInfo<T>::Type,
|
58
|
+
array_internal::TfLiteArrayDeleter>;
|
59
|
+
|
60
|
+
// `unique_ptr` wrapper for `TfLiteIntArray`s.
|
61
|
+
using IntArrayUniquePtr = TfLiteArrayUniquePtr<int>;
|
62
|
+
|
63
|
+
// `unique_ptr` wrapper for `TfLiteFloatArray`s.
|
64
|
+
using FloatArrayUniquePtr = TfLiteArrayUniquePtr<float>;
|
65
|
+
|
66
|
+
// Allocates a TfLiteArray of given size using malloc.
|
67
|
+
//
|
68
|
+
// This builds an int array by default as this is the overwhelming part of the
|
69
|
+
// use cases.
|
70
|
+
template <class T = int>
|
71
|
+
TfLiteArrayUniquePtr<T> BuildTfLiteArray(int size);
|
72
|
+
|
73
|
+
// Allocates a TfLiteIntArray of given size using malloc.
|
74
|
+
template <>
|
75
|
+
inline IntArrayUniquePtr BuildTfLiteArray<int>(const int size) {
|
76
|
+
return IntArrayUniquePtr(TfLiteMicroIntArrayCreate(size));
|
77
|
+
}
|
78
|
+
|
79
|
+
// Allocates a TfLiteFloatArray of given size using malloc.
|
80
|
+
template <>
|
81
|
+
inline FloatArrayUniquePtr BuildTfLiteArray<float>(const int size) {
|
82
|
+
return FloatArrayUniquePtr(TfLiteMicroFloatArrayCreate(size));
|
83
|
+
}
|
84
|
+
|
85
|
+
// Allocates a TFLiteArray of given size and initializes it with the given
|
86
|
+
// values.
|
87
|
+
//
|
88
|
+
// `values` is expected to holds `size` elements.
|
89
|
+
//
|
90
|
+
// If T is explicitely specified and the type of values is not the same as T,
|
91
|
+
// then a static_cast is performed.
|
92
|
+
template <class T = void, class U,
|
93
|
+
class Type = std::conditional_t<std::is_same<T, void>::value, U, T>>
|
94
|
+
TfLiteArrayUniquePtr<Type> BuildTfLiteArray(const int size,
|
95
|
+
const U* const values) {
|
96
|
+
TfLiteArrayUniquePtr<Type> array = BuildTfLiteArray<Type>(size);
|
97
|
+
// If size is 0, the array pointer may be null.
|
98
|
+
if (array && values) {
|
99
|
+
if (std::is_same<Type, U>::value) {
|
100
|
+
memcpy(array->data, values, size * sizeof(Type));
|
101
|
+
} else {
|
102
|
+
for (int i = 0; i < size; ++i) {
|
103
|
+
array->data[i] = static_cast<Type>(values[i]);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
return array;
|
108
|
+
}
|
109
|
+
|
110
|
+
// Allocates a TFLiteArray and initializes it with the given array.
|
111
|
+
//
|
112
|
+
// `values` is expected to holds `size` elements.
|
113
|
+
template <class T, size_t N>
|
114
|
+
TfLiteArrayUniquePtr<T> BuildTfLiteArray(const T (&values)[N]) {
|
115
|
+
return BuildTfLiteArray<T>(static_cast<int>(N), values);
|
116
|
+
}
|
117
|
+
|
118
|
+
// Allocates a TFLiteArray and initializes it with the given values.
|
119
|
+
//
|
120
|
+
// This uses SFINAE to only be picked up by for types that implement `data()`
|
121
|
+
// and `size()` member functions. We cannot reuse detection facilities provided
|
122
|
+
// by Abseil in this code.
|
123
|
+
//
|
124
|
+
// To conform with the other overloads, we allow specifying the type of the
|
125
|
+
// array as well as deducing it from the container.
|
126
|
+
template <
|
127
|
+
class T = void, class Container,
|
128
|
+
class ElementType =
|
129
|
+
std::decay_t<decltype(*std::declval<Container>().data())>,
|
130
|
+
class SizeType = std::decay_t<decltype(std::declval<Container>().size())>,
|
131
|
+
class Type =
|
132
|
+
std::conditional_t<std::is_same<T, void>::value, ElementType, T>>
|
133
|
+
TfLiteArrayUniquePtr<Type> BuildTfLiteArray(const Container& values) {
|
134
|
+
return BuildTfLiteArray<Type>(static_cast<int>(values.size()), values.data());
|
135
|
+
}
|
136
|
+
|
137
|
+
// Allocates a TFLiteArray and initializes it with the given values.
|
138
|
+
template <class T>
|
139
|
+
TfLiteArrayUniquePtr<T> BuildTfLiteArray(
|
140
|
+
const std::initializer_list<T>& values) {
|
141
|
+
return BuildTfLiteArray(static_cast<int>(values.size()), values.begin());
|
142
|
+
}
|
143
|
+
|
144
|
+
// Allocates a TFLiteArray and initializes it with the given array.
|
145
|
+
inline IntArrayUniquePtr BuildTfLiteArray(const TfLiteIntArray& other) {
|
146
|
+
return BuildTfLiteArray(other.size, other.data);
|
147
|
+
}
|
148
|
+
|
149
|
+
// Allocates a TFLiteArray and initializes it with the given array.
|
150
|
+
inline FloatArrayUniquePtr BuildTfLiteArray(const TfLiteFloatArray& other) {
|
151
|
+
return BuildTfLiteArray(other.size, other.data);
|
152
|
+
}
|
153
|
+
|
154
|
+
} // namespace tflite_micro
|
155
|
+
|
156
|
+
#endif // TENSORFLOW_LITE_ARRAY_H_
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/* Copyright 2017 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
|
+
// Compatibility shim for new location of interface definitions.
|
16
|
+
|
17
|
+
#ifndef TENSORFLOW_LITE_BUILTIN_OP_DATA_H_
|
18
|
+
#define TENSORFLOW_LITE_BUILTIN_OP_DATA_H_
|
19
|
+
|
20
|
+
#include "tensorflow/lite/core/c/builtin_op_data.h"
|
21
|
+
|
22
|
+
#endif // TENSORFLOW_LITE_BUILTIN_OP_DATA_H_
|
@@ -0,0 +1,241 @@
|
|
1
|
+
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
|
16
|
+
#ifndef TENSORFLOW_LITE_BUILTIN_OPS_H_
|
17
|
+
#define TENSORFLOW_LITE_BUILTIN_OPS_H_
|
18
|
+
|
19
|
+
// DO NOT EDIT MANUALLY: This file is automatically generated by
|
20
|
+
// `schema/builtin_ops_header/generator.cc`.
|
21
|
+
|
22
|
+
#ifdef __cplusplus
|
23
|
+
extern "C" {
|
24
|
+
#endif // __cplusplus
|
25
|
+
|
26
|
+
// The enum for builtin operators.
|
27
|
+
// Note: CUSTOM, DELEGATE, and PLACEHOLDER_FOR_GREATER_OP_CODES are 3 special
|
28
|
+
// ops which are not real built-in ops.
|
29
|
+
typedef enum {
|
30
|
+
kTfLiteBuiltinAdd = 0,
|
31
|
+
kTfLiteBuiltinAveragePool2d = 1,
|
32
|
+
kTfLiteBuiltinConcatenation = 2,
|
33
|
+
kTfLiteBuiltinConv2d = 3,
|
34
|
+
kTfLiteBuiltinDepthwiseConv2d = 4,
|
35
|
+
kTfLiteBuiltinDepthToSpace = 5,
|
36
|
+
kTfLiteBuiltinDequantize = 6,
|
37
|
+
kTfLiteBuiltinEmbeddingLookup = 7,
|
38
|
+
kTfLiteBuiltinFloor = 8,
|
39
|
+
kTfLiteBuiltinFullyConnected = 9,
|
40
|
+
kTfLiteBuiltinHashtableLookup = 10,
|
41
|
+
kTfLiteBuiltinL2Normalization = 11,
|
42
|
+
kTfLiteBuiltinL2Pool2d = 12,
|
43
|
+
kTfLiteBuiltinLocalResponseNormalization = 13,
|
44
|
+
kTfLiteBuiltinLogistic = 14,
|
45
|
+
kTfLiteBuiltinLshProjection = 15,
|
46
|
+
kTfLiteBuiltinLstm = 16,
|
47
|
+
kTfLiteBuiltinMaxPool2d = 17,
|
48
|
+
kTfLiteBuiltinMul = 18,
|
49
|
+
kTfLiteBuiltinRelu = 19,
|
50
|
+
kTfLiteBuiltinReluN1To1 = 20,
|
51
|
+
kTfLiteBuiltinRelu6 = 21,
|
52
|
+
kTfLiteBuiltinReshape = 22,
|
53
|
+
kTfLiteBuiltinResizeBilinear = 23,
|
54
|
+
kTfLiteBuiltinRnn = 24,
|
55
|
+
kTfLiteBuiltinSoftmax = 25,
|
56
|
+
kTfLiteBuiltinSpaceToDepth = 26,
|
57
|
+
kTfLiteBuiltinSvdf = 27,
|
58
|
+
kTfLiteBuiltinTanh = 28,
|
59
|
+
kTfLiteBuiltinConcatEmbeddings = 29,
|
60
|
+
kTfLiteBuiltinSkipGram = 30,
|
61
|
+
kTfLiteBuiltinCall = 31,
|
62
|
+
kTfLiteBuiltinCustom = 32,
|
63
|
+
kTfLiteBuiltinEmbeddingLookupSparse = 33,
|
64
|
+
kTfLiteBuiltinPad = 34,
|
65
|
+
kTfLiteBuiltinUnidirectionalSequenceRnn = 35,
|
66
|
+
kTfLiteBuiltinGather = 36,
|
67
|
+
kTfLiteBuiltinBatchToSpaceNd = 37,
|
68
|
+
kTfLiteBuiltinSpaceToBatchNd = 38,
|
69
|
+
kTfLiteBuiltinTranspose = 39,
|
70
|
+
kTfLiteBuiltinMean = 40,
|
71
|
+
kTfLiteBuiltinSub = 41,
|
72
|
+
kTfLiteBuiltinDiv = 42,
|
73
|
+
kTfLiteBuiltinSqueeze = 43,
|
74
|
+
kTfLiteBuiltinUnidirectionalSequenceLstm = 44,
|
75
|
+
kTfLiteBuiltinStridedSlice = 45,
|
76
|
+
kTfLiteBuiltinBidirectionalSequenceRnn = 46,
|
77
|
+
kTfLiteBuiltinExp = 47,
|
78
|
+
kTfLiteBuiltinTopkV2 = 48,
|
79
|
+
kTfLiteBuiltinSplit = 49,
|
80
|
+
kTfLiteBuiltinLogSoftmax = 50,
|
81
|
+
kTfLiteBuiltinDelegate = 51,
|
82
|
+
kTfLiteBuiltinBidirectionalSequenceLstm = 52,
|
83
|
+
kTfLiteBuiltinCast = 53,
|
84
|
+
kTfLiteBuiltinPrelu = 54,
|
85
|
+
kTfLiteBuiltinMaximum = 55,
|
86
|
+
kTfLiteBuiltinArgMax = 56,
|
87
|
+
kTfLiteBuiltinMinimum = 57,
|
88
|
+
kTfLiteBuiltinLess = 58,
|
89
|
+
kTfLiteBuiltinNeg = 59,
|
90
|
+
kTfLiteBuiltinPadv2 = 60,
|
91
|
+
kTfLiteBuiltinGreater = 61,
|
92
|
+
kTfLiteBuiltinGreaterEqual = 62,
|
93
|
+
kTfLiteBuiltinLessEqual = 63,
|
94
|
+
kTfLiteBuiltinSelect = 64,
|
95
|
+
kTfLiteBuiltinSlice = 65,
|
96
|
+
kTfLiteBuiltinSin = 66,
|
97
|
+
kTfLiteBuiltinTransposeConv = 67,
|
98
|
+
kTfLiteBuiltinSparseToDense = 68,
|
99
|
+
kTfLiteBuiltinTile = 69,
|
100
|
+
kTfLiteBuiltinExpandDims = 70,
|
101
|
+
kTfLiteBuiltinEqual = 71,
|
102
|
+
kTfLiteBuiltinNotEqual = 72,
|
103
|
+
kTfLiteBuiltinLog = 73,
|
104
|
+
kTfLiteBuiltinSum = 74,
|
105
|
+
kTfLiteBuiltinSqrt = 75,
|
106
|
+
kTfLiteBuiltinRsqrt = 76,
|
107
|
+
kTfLiteBuiltinShape = 77,
|
108
|
+
kTfLiteBuiltinPow = 78,
|
109
|
+
kTfLiteBuiltinArgMin = 79,
|
110
|
+
kTfLiteBuiltinFakeQuant = 80,
|
111
|
+
kTfLiteBuiltinReduceProd = 81,
|
112
|
+
kTfLiteBuiltinReduceMax = 82,
|
113
|
+
kTfLiteBuiltinPack = 83,
|
114
|
+
kTfLiteBuiltinLogicalOr = 84,
|
115
|
+
kTfLiteBuiltinOneHot = 85,
|
116
|
+
kTfLiteBuiltinLogicalAnd = 86,
|
117
|
+
kTfLiteBuiltinLogicalNot = 87,
|
118
|
+
kTfLiteBuiltinUnpack = 88,
|
119
|
+
kTfLiteBuiltinReduceMin = 89,
|
120
|
+
kTfLiteBuiltinFloorDiv = 90,
|
121
|
+
kTfLiteBuiltinReduceAny = 91,
|
122
|
+
kTfLiteBuiltinSquare = 92,
|
123
|
+
kTfLiteBuiltinZerosLike = 93,
|
124
|
+
kTfLiteBuiltinFill = 94,
|
125
|
+
kTfLiteBuiltinFloorMod = 95,
|
126
|
+
kTfLiteBuiltinRange = 96,
|
127
|
+
kTfLiteBuiltinResizeNearestNeighbor = 97,
|
128
|
+
kTfLiteBuiltinLeakyRelu = 98,
|
129
|
+
kTfLiteBuiltinSquaredDifference = 99,
|
130
|
+
kTfLiteBuiltinMirrorPad = 100,
|
131
|
+
kTfLiteBuiltinAbs = 101,
|
132
|
+
kTfLiteBuiltinSplitV = 102,
|
133
|
+
kTfLiteBuiltinUnique = 103,
|
134
|
+
kTfLiteBuiltinCeil = 104,
|
135
|
+
kTfLiteBuiltinReverseV2 = 105,
|
136
|
+
kTfLiteBuiltinAddN = 106,
|
137
|
+
kTfLiteBuiltinGatherNd = 107,
|
138
|
+
kTfLiteBuiltinCos = 108,
|
139
|
+
kTfLiteBuiltinWhere = 109,
|
140
|
+
kTfLiteBuiltinRank = 110,
|
141
|
+
kTfLiteBuiltinElu = 111,
|
142
|
+
kTfLiteBuiltinReverseSequence = 112,
|
143
|
+
kTfLiteBuiltinMatrixDiag = 113,
|
144
|
+
kTfLiteBuiltinQuantize = 114,
|
145
|
+
kTfLiteBuiltinMatrixSetDiag = 115,
|
146
|
+
kTfLiteBuiltinRound = 116,
|
147
|
+
kTfLiteBuiltinHardSwish = 117,
|
148
|
+
kTfLiteBuiltinIf = 118,
|
149
|
+
kTfLiteBuiltinWhile = 119,
|
150
|
+
kTfLiteBuiltinNonMaxSuppressionV4 = 120,
|
151
|
+
kTfLiteBuiltinNonMaxSuppressionV5 = 121,
|
152
|
+
kTfLiteBuiltinScatterNd = 122,
|
153
|
+
kTfLiteBuiltinSelectV2 = 123,
|
154
|
+
kTfLiteBuiltinDensify = 124,
|
155
|
+
kTfLiteBuiltinSegmentSum = 125,
|
156
|
+
kTfLiteBuiltinBatchMatmul = 126,
|
157
|
+
kTfLiteBuiltinPlaceholderForGreaterOpCodes = 127,
|
158
|
+
kTfLiteBuiltinCumsum = 128,
|
159
|
+
kTfLiteBuiltinCallOnce = 129,
|
160
|
+
kTfLiteBuiltinBroadcastTo = 130,
|
161
|
+
kTfLiteBuiltinRfft2d = 131,
|
162
|
+
kTfLiteBuiltinConv3d = 132,
|
163
|
+
kTfLiteBuiltinImag = 133,
|
164
|
+
kTfLiteBuiltinReal = 134,
|
165
|
+
kTfLiteBuiltinComplexAbs = 135,
|
166
|
+
kTfLiteBuiltinHashtable = 136,
|
167
|
+
kTfLiteBuiltinHashtableFind = 137,
|
168
|
+
kTfLiteBuiltinHashtableImport = 138,
|
169
|
+
kTfLiteBuiltinHashtableSize = 139,
|
170
|
+
kTfLiteBuiltinReduceAll = 140,
|
171
|
+
kTfLiteBuiltinConv3dTranspose = 141,
|
172
|
+
kTfLiteBuiltinVarHandle = 142,
|
173
|
+
kTfLiteBuiltinReadVariable = 143,
|
174
|
+
kTfLiteBuiltinAssignVariable = 144,
|
175
|
+
kTfLiteBuiltinBroadcastArgs = 145,
|
176
|
+
kTfLiteBuiltinRandomStandardNormal = 146,
|
177
|
+
kTfLiteBuiltinBucketize = 147,
|
178
|
+
kTfLiteBuiltinRandomUniform = 148,
|
179
|
+
kTfLiteBuiltinMultinomial = 149,
|
180
|
+
kTfLiteBuiltinGelu = 150,
|
181
|
+
kTfLiteBuiltinDynamicUpdateSlice = 151,
|
182
|
+
kTfLiteBuiltinRelu0To1 = 152,
|
183
|
+
kTfLiteBuiltinUnsortedSegmentProd = 153,
|
184
|
+
kTfLiteBuiltinUnsortedSegmentMax = 154,
|
185
|
+
kTfLiteBuiltinUnsortedSegmentSum = 155,
|
186
|
+
kTfLiteBuiltinAtan2 = 156,
|
187
|
+
kTfLiteBuiltinUnsortedSegmentMin = 157,
|
188
|
+
kTfLiteBuiltinSign = 158,
|
189
|
+
kTfLiteBuiltinBitcast = 159,
|
190
|
+
kTfLiteBuiltinBitwiseXor = 160,
|
191
|
+
kTfLiteBuiltinRightShift = 161,
|
192
|
+
kTfLiteBuiltinStablehloLogistic = 162,
|
193
|
+
kTfLiteBuiltinStablehloAdd = 163,
|
194
|
+
kTfLiteBuiltinStablehloDivide = 164,
|
195
|
+
kTfLiteBuiltinStablehloMultiply = 165,
|
196
|
+
kTfLiteBuiltinStablehloMaximum = 166,
|
197
|
+
kTfLiteBuiltinStablehloReshape = 167,
|
198
|
+
kTfLiteBuiltinStablehloClamp = 168,
|
199
|
+
kTfLiteBuiltinStablehloConcatenate = 169,
|
200
|
+
kTfLiteBuiltinStablehloBroadcastInDim = 170,
|
201
|
+
kTfLiteBuiltinStablehloConvolution = 171,
|
202
|
+
kTfLiteBuiltinStablehloSlice = 172,
|
203
|
+
kTfLiteBuiltinStablehloCustomCall = 173,
|
204
|
+
kTfLiteBuiltinStablehloReduce = 174,
|
205
|
+
kTfLiteBuiltinStablehloAbs = 175,
|
206
|
+
kTfLiteBuiltinStablehloAnd = 176,
|
207
|
+
kTfLiteBuiltinStablehloCosine = 177,
|
208
|
+
kTfLiteBuiltinStablehloExponential = 178,
|
209
|
+
kTfLiteBuiltinStablehloFloor = 179,
|
210
|
+
kTfLiteBuiltinStablehloLog = 180,
|
211
|
+
kTfLiteBuiltinStablehloMinimum = 181,
|
212
|
+
kTfLiteBuiltinStablehloNegate = 182,
|
213
|
+
kTfLiteBuiltinStablehloOr = 183,
|
214
|
+
kTfLiteBuiltinStablehloPower = 184,
|
215
|
+
kTfLiteBuiltinStablehloRemainder = 185,
|
216
|
+
kTfLiteBuiltinStablehloRsqrt = 186,
|
217
|
+
kTfLiteBuiltinStablehloSelect = 187,
|
218
|
+
kTfLiteBuiltinStablehloSubtract = 188,
|
219
|
+
kTfLiteBuiltinStablehloTanh = 189,
|
220
|
+
kTfLiteBuiltinStablehloScatter = 190,
|
221
|
+
kTfLiteBuiltinStablehloCompare = 191,
|
222
|
+
kTfLiteBuiltinStablehloConvert = 192,
|
223
|
+
kTfLiteBuiltinStablehloDynamicSlice = 193,
|
224
|
+
kTfLiteBuiltinStablehloDynamicUpdateSlice = 194,
|
225
|
+
kTfLiteBuiltinStablehloPad = 195,
|
226
|
+
kTfLiteBuiltinStablehloIota = 196,
|
227
|
+
kTfLiteBuiltinStablehloDotGeneral = 197,
|
228
|
+
kTfLiteBuiltinStablehloReduceWindow = 198,
|
229
|
+
kTfLiteBuiltinStablehloSort = 199,
|
230
|
+
kTfLiteBuiltinStablehloWhile = 200,
|
231
|
+
kTfLiteBuiltinStablehloGather = 201,
|
232
|
+
kTfLiteBuiltinStablehloTranspose = 202,
|
233
|
+
kTfLiteBuiltinDilate = 203,
|
234
|
+
kTfLiteBuiltinStablehloRngBitGenerator = 204,
|
235
|
+
kTfLiteBuiltinReduceWindow = 205,
|
236
|
+
} TfLiteBuiltinOperator;
|
237
|
+
|
238
|
+
#ifdef __cplusplus
|
239
|
+
} // extern "C"
|
240
|
+
#endif // __cplusplus
|
241
|
+
#endif // TENSORFLOW_LITE_BUILTIN_OPS_H_
|
@@ -0,0 +1,20 @@
|
|
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_C_BUILTIN_OP_DATA_H_
|
16
|
+
#define TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_
|
17
|
+
|
18
|
+
#include "tensorflow/lite/core/c/builtin_op_data.h"
|
19
|
+
|
20
|
+
#endif // TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_
|
@@ -0,0 +1,26 @@
|
|
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_C_C_API_TYPES_H_
|
16
|
+
#define TENSORFLOW_LITE_C_C_API_TYPES_H_
|
17
|
+
|
18
|
+
/// \file
|
19
|
+
///
|
20
|
+
/// C API types for TensorFlow Lite.
|
21
|
+
///
|
22
|
+
/// For documentation, see tensorflow/lite/core/c/c_api_types.h
|
23
|
+
|
24
|
+
#include "tensorflow/lite/core/c/c_api_types.h"
|
25
|
+
|
26
|
+
#endif // TENSORFLOW_LITE_C_C_API_TYPES_H_
|
@@ -0,0 +1,30 @@
|
|
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
|
+
/// \file
|
17
|
+
///
|
18
|
+
/// This file defines common C types and APIs for implementing operations,
|
19
|
+
/// delegates and other constructs in TensorFlow Lite. The actual operations and
|
20
|
+
/// delegates can be defined using C++, but the interface between the
|
21
|
+
/// interpreter and the operations are C.
|
22
|
+
///
|
23
|
+
/// For documentation, see tensorflow/lite/core/c/common.h.
|
24
|
+
|
25
|
+
#ifndef TENSORFLOW_LITE_C_COMMON_H_
|
26
|
+
#define TENSORFLOW_LITE_C_COMMON_H_
|
27
|
+
|
28
|
+
#include "tensorflow/lite/core/c/common.h"
|
29
|
+
|
30
|
+
#endif // TENSORFLOW_LITE_C_COMMON_H_
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/* Copyright 2017 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
|
+
/// \file
|
16
|
+
///
|
17
|
+
/// This provides a few C++ helpers that are useful for manipulating C
|
18
|
+
/// structures in C++.
|
19
|
+
#ifndef TENSORFLOW_LITE_CONTEXT_UTIL_H_
|
20
|
+
#define TENSORFLOW_LITE_CONTEXT_UTIL_H_
|
21
|
+
|
22
|
+
#include <stddef.h>
|
23
|
+
|
24
|
+
#include "tensorflow/lite/core/c/common.h"
|
25
|
+
|
26
|
+
namespace tflite_micro {
|
27
|
+
|
28
|
+
/// Provides a range iterable wrapper for TfLiteIntArray* (C lists) that TfLite
|
29
|
+
/// C api uses.
|
30
|
+
// Can't use the google array_view, since we can't depend on even
|
31
|
+
// absl for embedded device reasons.
|
32
|
+
class TfLiteIntArrayView {
|
33
|
+
public:
|
34
|
+
/// Construct a view of a TfLiteIntArray*. Note, `int_array` should be
|
35
|
+
/// non-null and this view does not take ownership of it.
|
36
|
+
explicit TfLiteIntArrayView(const TfLiteIntArray* int_array)
|
37
|
+
: int_array_(int_array) {}
|
38
|
+
|
39
|
+
TfLiteIntArrayView(const TfLiteIntArrayView&) = default;
|
40
|
+
TfLiteIntArrayView& operator=(const TfLiteIntArrayView& rhs) = default;
|
41
|
+
|
42
|
+
typedef const int* const_iterator;
|
43
|
+
const_iterator begin() const { return int_array_->data; }
|
44
|
+
const_iterator end() const { return &int_array_->data[int_array_->size]; }
|
45
|
+
size_t size() const { return end() - begin(); }
|
46
|
+
int operator[](size_t pos) const { return int_array_->data[pos]; }
|
47
|
+
|
48
|
+
private:
|
49
|
+
const TfLiteIntArray* int_array_;
|
50
|
+
};
|
51
|
+
|
52
|
+
} // namespace tflite_micro
|
53
|
+
|
54
|
+
#endif // TENSORFLOW_LITE_CONTEXT_UTIL_H_
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/* Copyright 2017 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_CORE_API_ERROR_REPORTER_H_
|
16
|
+
#define TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_
|
17
|
+
|
18
|
+
#include <cstdarg>
|
19
|
+
|
20
|
+
namespace tflite_micro {
|
21
|
+
|
22
|
+
/// A functor that reports error to supporting system. Invoked similar to
|
23
|
+
/// printf.
|
24
|
+
///
|
25
|
+
/// Usage:
|
26
|
+
/// ErrorReporter foo;
|
27
|
+
/// foo.Report("test %d", 5);
|
28
|
+
/// or
|
29
|
+
/// va_list args;
|
30
|
+
/// foo.Report("test %d", args); // where args is va_list
|
31
|
+
///
|
32
|
+
/// Subclass ErrorReporter to provide another reporting destination.
|
33
|
+
/// For example, if you have a GUI program, you might redirect to a buffer
|
34
|
+
/// that drives a GUI error log box.
|
35
|
+
class ErrorReporter {
|
36
|
+
public:
|
37
|
+
virtual ~ErrorReporter() = default;
|
38
|
+
/// Converts `args` to character equivalents according to `format` string,
|
39
|
+
/// constructs the error string and report it.
|
40
|
+
/// Returns number of characters written or zero on success, and negative
|
41
|
+
/// number on error.
|
42
|
+
virtual int Report(const char* format, va_list args) = 0;
|
43
|
+
|
44
|
+
/// Converts arguments to character equivalents according to `format` string,
|
45
|
+
/// constructs the error string and report it.
|
46
|
+
/// Returns number of characters written or zero on success, and negative
|
47
|
+
/// number on error.
|
48
|
+
int Report(const char* format, ...);
|
49
|
+
|
50
|
+
/// Equivalent to `Report` above. The additional `void*` parameter is unused.
|
51
|
+
/// This method is for compatibility with macros that takes `TfLiteContext`,
|
52
|
+
/// like TF_LITE_ENSURE and related macros.
|
53
|
+
int ReportError(void*, const char* format, ...);
|
54
|
+
};
|
55
|
+
|
56
|
+
} // namespace tflite_micro
|
57
|
+
|
58
|
+
// You should not make bare calls to the error reporter, instead use the
|
59
|
+
// TF_LITE_REPORT_ERROR macro, since this allows message strings to be
|
60
|
+
// stripped when the binary size has to be optimized. If you are looking to
|
61
|
+
// reduce binary size, define TF_LITE_STRIP_ERROR_STRINGS when compiling and
|
62
|
+
// every call will be stubbed out, taking no memory.
|
63
|
+
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
64
|
+
#define TF_LITE_REPORT_ERROR(reporter, ...) \
|
65
|
+
do { \
|
66
|
+
static_cast<::tflite_micro::ErrorReporter*>(reporter)->Report(__VA_ARGS__); \
|
67
|
+
} while (false)
|
68
|
+
#else // TF_LITE_STRIP_ERROR_STRINGS
|
69
|
+
#define TF_LITE_REPORT_ERROR(reporter, ...)
|
70
|
+
#endif // TF_LITE_STRIP_ERROR_STRINGS
|
71
|
+
|
72
|
+
#endif // TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_
|