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
xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/hifimini/fixedpoint_utils.h
ADDED
@@ -0,0 +1,139 @@
|
|
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_KERNELS_XTENSA_HIFIMINI_FIXEDPOINT_UTILS_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_HIFIMINI_FIXEDPOINT_UTILS_H_
|
18
|
+
|
19
|
+
#if defined(HIFIMINI)
|
20
|
+
#include <xtensa/tie/xt_hifi2.h>
|
21
|
+
|
22
|
+
#include <algorithm>
|
23
|
+
#include <cmath>
|
24
|
+
#include <cstdint>
|
25
|
+
|
26
|
+
#include "tensorflow/lite/kernels/internal/compatibility.h"
|
27
|
+
#include "tensorflow/lite/micro/kernels/xtensa/xtensa.h"
|
28
|
+
|
29
|
+
namespace tflite_micro {
|
30
|
+
|
31
|
+
// INT24 MIN/MAX
|
32
|
+
#define INT24_MIN -8388608
|
33
|
+
#define INT24_MAX 8388607
|
34
|
+
|
35
|
+
// Multiply 24bit value by a quantized multiplier (w/ shift) and returns a 48bit
|
36
|
+
// aligned value in the QR register.
|
37
|
+
inline ae_q56s MultiplyByQuantizedMultiplier(ae_p24x2s x_24x2,
|
38
|
+
int32_t quantized_multiplier,
|
39
|
+
int shift) {
|
40
|
+
// A value with 1 sign bit, N integer bits and M fractional bits is
|
41
|
+
// represented as QN+1.M since the sign bit is included in the integer bits.
|
42
|
+
//
|
43
|
+
// The Q notation in this method explains the values represented in each
|
44
|
+
// variable, along with an implicit division since the quantized_multiplier
|
45
|
+
// represents a value between 0.5 and 1.0 (Q1.X-1 where X is the bit precision
|
46
|
+
// of the type).
|
47
|
+
//
|
48
|
+
// Load the quantized multiplier into the PR register.
|
49
|
+
// NOTE: This method assumes that this param has been calculated for 24bit
|
50
|
+
// space - not 32bits.
|
51
|
+
// Q32.0 / 2^23 -> Q24.0 / 2^23 representing a Q1.23 multiplier.
|
52
|
+
ae_p24x2s quantized_multiplier_24x2 = AE_MOVPA24(quantized_multiplier);
|
53
|
+
// Shift right by 23 - 16 bits minus the specified shift. This is because we
|
54
|
+
// keep 16 fractional bits until the end to perform rounding. Subtract shift
|
55
|
+
// since shift is a left shift, and the 23-16 is a right shift.
|
56
|
+
int shift_amount = 7 - shift;
|
57
|
+
|
58
|
+
// Find the product of x and the quantized_multiplier.
|
59
|
+
// Q24.0 / 2^23 * Q24.0 = Q48.0 / 2^23
|
60
|
+
// Q48.0 / 2^23 >> 7 = Q48.0 / 2^16
|
61
|
+
ae_q56s result_56 = AE_MULP24S_HH(x_24x2, quantized_multiplier_24x2);
|
62
|
+
|
63
|
+
// Shift right if shift amount is positive, left if shift amount is negative.
|
64
|
+
if (shift_amount >= 0) {
|
65
|
+
result_56 = AE_Q56S_SRA(result_56, shift_amount);
|
66
|
+
} else {
|
67
|
+
result_56 = AE_Q56S_SLA(result_56, -shift_amount);
|
68
|
+
}
|
69
|
+
|
70
|
+
// Round off the bottom 16 bits.
|
71
|
+
// Q48.0 / 2^16 -> Q32.0 aligned to 48 bits.
|
72
|
+
result_56 = AE_ROUNDSQ32SYM(result_56);
|
73
|
+
return result_56;
|
74
|
+
}
|
75
|
+
|
76
|
+
// Multiply 32bit value by a quantized multiplier (w/ shift) and returns a 48bit
|
77
|
+
// aligned value in the QR register.
|
78
|
+
inline ae_q56s MultiplyByQuantizedMultiplierResult48Bit(
|
79
|
+
int32_t x, int32_t quantized_multiplier, int shift) {
|
80
|
+
// Convert x into a 2x24bit PR register file. If x is outside the numerical
|
81
|
+
// limits of a 24bit integer, the "fractional" or lower 8bits are discarded.
|
82
|
+
// If x is within the range of a 24 bit integer, the "signed" or upper 8bits
|
83
|
+
// are discarded.
|
84
|
+
ae_p24x2s x_24x2;
|
85
|
+
if (x > INT24_MIN && x < INT24_MAX) {
|
86
|
+
x_24x2 = AE_MOVPA24(x);
|
87
|
+
} else {
|
88
|
+
x_24x2 = static_cast<ae_p24s>(*reinterpret_cast<ae_p24f*>(&x));
|
89
|
+
shift += 8;
|
90
|
+
}
|
91
|
+
|
92
|
+
return MultiplyByQuantizedMultiplier(x_24x2, quantized_multiplier, shift);
|
93
|
+
}
|
94
|
+
|
95
|
+
// Calculate quantization params for 24bit runtimes.
|
96
|
+
inline void QuantizeMultiplierForInt24(float multiplier,
|
97
|
+
int32_t* quantized_multiplier,
|
98
|
+
int* shift) {
|
99
|
+
if (multiplier == 0.0f) {
|
100
|
+
*quantized_multiplier = 0;
|
101
|
+
*shift = 0;
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
|
105
|
+
// Special cased to 24bit:
|
106
|
+
const float q = std::frexp(multiplier, shift);
|
107
|
+
auto q_fixed = static_cast<int64_t>(std::round(q * (1 << 23)));
|
108
|
+
|
109
|
+
TFLITE_CHECK(q_fixed <= (1 << 23));
|
110
|
+
if (q_fixed == (1 << 23)) {
|
111
|
+
q_fixed /= 2;
|
112
|
+
++*shift;
|
113
|
+
}
|
114
|
+
TFLITE_CHECK_LE(q_fixed, INT24_MAX);
|
115
|
+
|
116
|
+
// Ensure shift does not exceed 24-bit range.
|
117
|
+
TFLITE_CHECK_LE(*shift, 23);
|
118
|
+
if (*shift < -23) {
|
119
|
+
*shift = 0;
|
120
|
+
q_fixed = 0;
|
121
|
+
}
|
122
|
+
*quantized_multiplier = static_cast<int32_t>(q_fixed);
|
123
|
+
}
|
124
|
+
|
125
|
+
// Convert a floating point number to a Q representation for 24 bit integers.
|
126
|
+
inline int CreateQConstantForInt24(int integer_bits, float f) {
|
127
|
+
const float min_bounds = static_cast<float>(INT24_MIN);
|
128
|
+
const float max_bounds = static_cast<float>(INT24_MAX);
|
129
|
+
|
130
|
+
int fractional_bits = 23 - integer_bits;
|
131
|
+
float raw = std::round(f * static_cast<float>(1 << fractional_bits));
|
132
|
+
raw = std::max(raw, min_bounds);
|
133
|
+
raw = std::min(raw, max_bounds);
|
134
|
+
return static_cast<int>(raw);
|
135
|
+
}
|
136
|
+
|
137
|
+
} // namespace tflite_micro
|
138
|
+
#endif // defined(HIFIMINI)
|
139
|
+
#endif // TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_HIFIMINI_FIXEDPOINT_UTILS_H_
|
@@ -0,0 +1,216 @@
|
|
1
|
+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
#ifndef TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_
|
16
|
+
#define TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_
|
17
|
+
|
18
|
+
#include <cstdint>
|
19
|
+
#include <memory>
|
20
|
+
|
21
|
+
#include "tensorflow/lite/c/builtin_op_data.h"
|
22
|
+
#include "tensorflow/lite/c/common.h"
|
23
|
+
#include "tensorflow/lite/kernels/internal/portable_tensor_utils.h"
|
24
|
+
#include "tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h"
|
25
|
+
#include "tensorflow/lite/micro/kernels/kernel_util.h"
|
26
|
+
|
27
|
+
namespace tflite_micro {
|
28
|
+
namespace ops {
|
29
|
+
namespace micro {
|
30
|
+
namespace lstm_eval {
|
31
|
+
|
32
|
+
#if defined(HIFI5)
|
33
|
+
void calc_cell_state_without_cifg(int16_t* cell_state,
|
34
|
+
const int16_t* forget_gate,
|
35
|
+
const int16_t* cell_gate,
|
36
|
+
const int16_t* input_gate, int shift1,
|
37
|
+
int shift2, int clip, int num_elms);
|
38
|
+
|
39
|
+
void calc_cell_state_with_cifg(int16_t* cell_state, const int16_t* forget_gate,
|
40
|
+
const int16_t* cell_gate, int shift1, int shift2,
|
41
|
+
int clip, int num_elms);
|
42
|
+
|
43
|
+
void xa_nn_elm_mul_16x16_asym8s(int8_t* output, const int16_t* input_1,
|
44
|
+
const int16_t* input_2, int32_t multiplier,
|
45
|
+
int32_t shift, int32_t zero_point,
|
46
|
+
int num_elms);
|
47
|
+
#endif // defined(HIFI5)
|
48
|
+
|
49
|
+
// Pamameters for integer LSTM.
|
50
|
+
// Consider split this into two Integer Parameters if more fields are added.
|
51
|
+
struct IntegerLstmParameter {
|
52
|
+
int32_t effective_input_to_input_scale_a;
|
53
|
+
int effective_input_to_input_scale_b;
|
54
|
+
int32_t effective_recurrent_to_input_scale_a;
|
55
|
+
int effective_recurrent_to_input_scale_b;
|
56
|
+
int32_t effective_cell_to_input_scale_a;
|
57
|
+
int effective_cell_to_input_scale_b;
|
58
|
+
int32_t effective_input_to_forget_scale_a;
|
59
|
+
int effective_input_to_forget_scale_b;
|
60
|
+
int32_t effective_recurrent_to_forget_scale_a;
|
61
|
+
int effective_recurrent_to_forget_scale_b;
|
62
|
+
int32_t effective_cell_to_forget_scale_a;
|
63
|
+
int effective_cell_to_forget_scale_b;
|
64
|
+
int32_t effective_input_to_cell_scale_a;
|
65
|
+
int effective_input_to_cell_scale_b;
|
66
|
+
int32_t effective_recurrent_to_cell_scale_a;
|
67
|
+
int effective_recurrent_to_cell_scale_b;
|
68
|
+
int32_t effective_input_to_output_scale_a;
|
69
|
+
int effective_input_to_output_scale_b;
|
70
|
+
int32_t effective_recurrent_to_output_scale_a;
|
71
|
+
int effective_recurrent_to_output_scale_b;
|
72
|
+
int32_t effective_cell_to_output_scale_a;
|
73
|
+
int effective_cell_to_output_scale_b;
|
74
|
+
int32_t effective_proj_scale_a;
|
75
|
+
int effective_proj_scale_b;
|
76
|
+
int32_t effective_hidden_scale_a;
|
77
|
+
int effective_hidden_scale_b;
|
78
|
+
int32_t layer_norm_input_scale_a;
|
79
|
+
int layer_norm_input_scale_b;
|
80
|
+
int32_t layer_norm_forget_scale_a;
|
81
|
+
int layer_norm_forget_scale_b;
|
82
|
+
int32_t layer_norm_cell_scale_a;
|
83
|
+
int layer_norm_cell_scale_b;
|
84
|
+
int32_t layer_norm_output_scale_a;
|
85
|
+
int layer_norm_output_scale_b;
|
86
|
+
// Quantized clip value for cell and projection. Zero value means no clipping.
|
87
|
+
int16_t quantized_cell_clip;
|
88
|
+
int8_t quantized_proj_clip;
|
89
|
+
int32_t hidden_zp;
|
90
|
+
int32_t cell_scale;
|
91
|
+
|
92
|
+
int32_t input_variance_guard;
|
93
|
+
int32_t forget_variance_guard;
|
94
|
+
int32_t cell_variance_guard;
|
95
|
+
int32_t output_variance_guard;
|
96
|
+
|
97
|
+
// Pre-calculate bias + zero_point * weight.
|
98
|
+
// Unabled to use temporary tensors since those are used in Prepare() and
|
99
|
+
// scratch buffer is only allocated after Preapre().
|
100
|
+
std::unique_ptr<int32_t[]> input_to_forget_effective_bias;
|
101
|
+
std::unique_ptr<int32_t[]> recurrent_to_forget_effective_bias;
|
102
|
+
std::unique_ptr<int32_t[]> input_to_cell_effective_bias;
|
103
|
+
std::unique_ptr<int32_t[]> recurrent_to_cell_effective_bias;
|
104
|
+
std::unique_ptr<int32_t[]> input_to_output_effective_bias;
|
105
|
+
std::unique_ptr<int32_t[]> recurrent_to_output_effective_bias;
|
106
|
+
std::unique_ptr<int32_t[]> input_to_input_effective_bias;
|
107
|
+
std::unique_ptr<int32_t[]> recurrent_to_input_effective_bias;
|
108
|
+
std::unique_ptr<int32_t[]> projection_effective_bias;
|
109
|
+
|
110
|
+
// Scale and zero point for intermediate tensors.
|
111
|
+
// Used only in the 8x8_8 case.
|
112
|
+
int32_t intermediate_scale_a[8];
|
113
|
+
int32_t intermediate_scale_b[8];
|
114
|
+
int32_t intermediate_zp[12];
|
115
|
+
};
|
116
|
+
|
117
|
+
TfLiteStatus EvalFloat(const TfLiteEvalTensor* input,
|
118
|
+
const TfLiteEvalTensor* input_to_input_weights,
|
119
|
+
const TfLiteEvalTensor* input_to_forget_weights,
|
120
|
+
const TfLiteEvalTensor* input_to_cell_weights,
|
121
|
+
const TfLiteEvalTensor* input_to_output_weights,
|
122
|
+
const TfLiteEvalTensor* recurrent_to_input_weights,
|
123
|
+
const TfLiteEvalTensor* recurrent_to_forget_weights,
|
124
|
+
const TfLiteEvalTensor* recurrent_to_cell_weights,
|
125
|
+
const TfLiteEvalTensor* recurrent_to_output_weights,
|
126
|
+
const TfLiteEvalTensor* cell_to_input_weights,
|
127
|
+
const TfLiteEvalTensor* cell_to_forget_weights,
|
128
|
+
const TfLiteEvalTensor* cell_to_output_weights,
|
129
|
+
const TfLiteEvalTensor* input_layer_norm_coefficients,
|
130
|
+
const TfLiteEvalTensor* forget_layer_norm_coefficients,
|
131
|
+
const TfLiteEvalTensor* cell_layer_norm_coefficients,
|
132
|
+
const TfLiteEvalTensor* output_layer_norm_coefficients,
|
133
|
+
const TfLiteEvalTensor* aux_input,
|
134
|
+
const TfLiteEvalTensor* aux_input_to_input_weights,
|
135
|
+
const TfLiteEvalTensor* aux_input_to_forget_weights,
|
136
|
+
const TfLiteEvalTensor* aux_input_to_cell_weights,
|
137
|
+
const TfLiteEvalTensor* aux_input_to_output_weights,
|
138
|
+
const TfLiteEvalTensor* input_gate_bias,
|
139
|
+
const TfLiteEvalTensor* forget_gate_bias,
|
140
|
+
const TfLiteEvalTensor* cell_gate_bias,
|
141
|
+
const TfLiteEvalTensor* output_gate_bias,
|
142
|
+
const TfLiteEvalTensor* projection_weights,
|
143
|
+
const TfLiteEvalTensor* projection_bias,
|
144
|
+
const TfLiteLSTMParams* params, bool forward_sequence,
|
145
|
+
bool time_major, int output_offset,
|
146
|
+
TfLiteEvalTensor* scratch_buffer,
|
147
|
+
TfLiteEvalTensor* output_state,
|
148
|
+
TfLiteEvalTensor* cell_state, TfLiteEvalTensor* output);
|
149
|
+
|
150
|
+
TfLiteStatus EvalInteger8x8_16(
|
151
|
+
TfLiteContext* context, TfLiteNode* node, const TfLiteEvalTensor* input,
|
152
|
+
const TfLiteEvalTensor* input_to_input_weights,
|
153
|
+
const TfLiteEvalTensor* input_to_forget_weights,
|
154
|
+
const TfLiteEvalTensor* input_to_cell_weights,
|
155
|
+
const TfLiteEvalTensor* input_to_output_weights,
|
156
|
+
const TfLiteEvalTensor* recurrent_to_input_weights,
|
157
|
+
const TfLiteEvalTensor* recurrent_to_forget_weights,
|
158
|
+
const TfLiteEvalTensor* recurrent_to_cell_weights,
|
159
|
+
const TfLiteEvalTensor* recurrent_to_output_weights,
|
160
|
+
const TfLiteEvalTensor* cell_to_input_weights,
|
161
|
+
const TfLiteEvalTensor* cell_to_forget_weights,
|
162
|
+
const TfLiteEvalTensor* cell_to_output_weights,
|
163
|
+
const TfLiteEvalTensor* input_layer_norm_coefficients,
|
164
|
+
const TfLiteEvalTensor* forget_layer_norm_coefficients,
|
165
|
+
const TfLiteEvalTensor* cell_layer_norm_coefficients,
|
166
|
+
const TfLiteEvalTensor* output_layer_norm_coefficients,
|
167
|
+
const TfLiteEvalTensor* input_gate_bias,
|
168
|
+
const TfLiteEvalTensor* forget_gate_bias,
|
169
|
+
const TfLiteEvalTensor* cell_gate_bias,
|
170
|
+
const TfLiteEvalTensor* output_gate_bias,
|
171
|
+
const TfLiteEvalTensor* projection_weights,
|
172
|
+
const TfLiteEvalTensor* projection_bias, const TfLiteLSTMParams* params,
|
173
|
+
bool forward_sequence, bool time_major,
|
174
|
+
const lstm_eval::IntegerLstmParameter* integer_lstm_param,
|
175
|
+
TfLiteEvalTensor* output_state, TfLiteEvalTensor* cell_state,
|
176
|
+
TfLiteEvalTensor* output, TfLiteEvalTensor* scratch0,
|
177
|
+
TfLiteEvalTensor* scratch1, TfLiteEvalTensor* scratch2,
|
178
|
+
TfLiteEvalTensor* scratch3, TfLiteEvalTensor* scratch4,
|
179
|
+
TfLiteEvalTensor* scratch5);
|
180
|
+
|
181
|
+
TfLiteStatus EvalInteger8x8_8(
|
182
|
+
const TfLiteEvalTensor* input,
|
183
|
+
const TfLiteEvalTensor* input_to_input_weights,
|
184
|
+
const TfLiteEvalTensor* input_to_forget_weights,
|
185
|
+
const TfLiteEvalTensor* input_to_cell_weights,
|
186
|
+
const TfLiteEvalTensor* input_to_output_weights,
|
187
|
+
const TfLiteEvalTensor* recurrent_to_input_weights,
|
188
|
+
const TfLiteEvalTensor* recurrent_to_forget_weights,
|
189
|
+
const TfLiteEvalTensor* recurrent_to_cell_weights,
|
190
|
+
const TfLiteEvalTensor* recurrent_to_output_weights,
|
191
|
+
const TfLiteEvalTensor* cell_to_input_weights,
|
192
|
+
const TfLiteEvalTensor* cell_to_forget_weights,
|
193
|
+
const TfLiteEvalTensor* cell_to_output_weights,
|
194
|
+
const TfLiteEvalTensor* input_layer_norm_coefficients,
|
195
|
+
const TfLiteEvalTensor* forget_layer_norm_coefficients,
|
196
|
+
const TfLiteEvalTensor* cell_layer_norm_coefficients,
|
197
|
+
const TfLiteEvalTensor* output_layer_norm_coefficients,
|
198
|
+
const TfLiteEvalTensor* input_gate_bias,
|
199
|
+
const TfLiteEvalTensor* forget_gate_bias,
|
200
|
+
const TfLiteEvalTensor* cell_gate_bias,
|
201
|
+
const TfLiteEvalTensor* output_gate_bias,
|
202
|
+
const TfLiteEvalTensor* projection_weights,
|
203
|
+
const TfLiteEvalTensor* projection_bias, const TfLiteLSTMParams* params,
|
204
|
+
TfLiteEvalTensor* output_state, TfLiteEvalTensor* cell_state,
|
205
|
+
TfLiteEvalTensor* output,
|
206
|
+
const lstm_eval::IntegerLstmParameter* integer_lstm_param,
|
207
|
+
TfLiteEvalTensor* scratch0, TfLiteEvalTensor* scratch1,
|
208
|
+
TfLiteEvalTensor* scratch2, TfLiteEvalTensor* scratch3,
|
209
|
+
TfLiteEvalTensor* scratch4, TfLiteEvalTensor* scratch5,
|
210
|
+
TfLiteEvalTensor* scratch6, TfLiteEvalTensor* scratch7);
|
211
|
+
|
212
|
+
} // namespace lstm_eval
|
213
|
+
} // namespace micro
|
214
|
+
} // namespace ops
|
215
|
+
} // namespace tflite_micro
|
216
|
+
#endif // TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_
|
@@ -0,0 +1,78 @@
|
|
1
|
+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
#ifndef TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_
|
16
|
+
#define TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_
|
17
|
+
|
18
|
+
namespace tflite_micro {
|
19
|
+
namespace ops {
|
20
|
+
namespace micro {
|
21
|
+
namespace lstm {
|
22
|
+
// For full inputs kernel (24-inputs).
|
23
|
+
// Please note the 20-input full kernel is deprecated and only kept
|
24
|
+
// here for backward compatibility.
|
25
|
+
namespace full {
|
26
|
+
|
27
|
+
// Input Tensors of size {n_batch, n_input}
|
28
|
+
constexpr int kInputTensor = 0;
|
29
|
+
|
30
|
+
// Input weight tensors of size: {n_cell, n_input}
|
31
|
+
constexpr int kInputToInputWeightsTensor = 1; // Optional
|
32
|
+
constexpr int kInputToForgetWeightsTensor = 2;
|
33
|
+
constexpr int kInputToCellWeightsTensor = 3;
|
34
|
+
constexpr int kInputToOutputWeightsTensor = 4;
|
35
|
+
|
36
|
+
// Recurrent weight tensors of size {n_cell, n_output}
|
37
|
+
constexpr int kRecurrentToInputWeightsTensor = 5; // Optional
|
38
|
+
constexpr int kRecurrentToForgetWeightsTensor = 6;
|
39
|
+
constexpr int kRecurrentToCellWeightsTensor = 7;
|
40
|
+
constexpr int kRecurrentToOutputWeightsTensor = 8;
|
41
|
+
|
42
|
+
// Peephole weights tensors of size {n_cell}, representing a diagonal matrix.
|
43
|
+
constexpr int kCellToInputWeightsTensor = 9; // Optional
|
44
|
+
constexpr int kCellToForgetWeightsTensor = 10; // Optional
|
45
|
+
constexpr int kCellToOutputWeightsTensor = 11; // Optional
|
46
|
+
|
47
|
+
// Gates bias tensors of size {n_cell}
|
48
|
+
constexpr int kInputGateBiasTensor = 12; // Optional
|
49
|
+
constexpr int kForgetGateBiasTensor = 13;
|
50
|
+
constexpr int kCellGateBiasTensor = 14;
|
51
|
+
constexpr int kOutputGateBiasTensor = 15;
|
52
|
+
|
53
|
+
// Projection weight tensor of size {n_output, n_cell}
|
54
|
+
constexpr int kProjectionWeightsTensor = 16; // Optional
|
55
|
+
// Projection bias tensor of size {n_output}
|
56
|
+
constexpr int kProjectionBiasTensor = 17; // Optional
|
57
|
+
|
58
|
+
// These state tensors are defined as variable tensors, and will be modified by
|
59
|
+
// this op.
|
60
|
+
constexpr int kOutputStateTensor = 18;
|
61
|
+
constexpr int kCellStateTensor = 19;
|
62
|
+
|
63
|
+
// Layer norm coefficient tensors of size {n_cell}, representing a diagonal
|
64
|
+
// matrix.
|
65
|
+
constexpr int kInputLayerNormCoefficientsTensor = 20; // Optional
|
66
|
+
constexpr int kForgetLayerNormCoefficientsTensor = 21; // Optional
|
67
|
+
constexpr int kCellLayerNormCoefficientsTensor = 22; // Optional
|
68
|
+
constexpr int kOutputLayerNormCoefficientsTensor = 23; // Optional
|
69
|
+
|
70
|
+
// Output tensors.
|
71
|
+
constexpr int kOutputTensor = 0;
|
72
|
+
} // namespace full
|
73
|
+
|
74
|
+
} // namespace lstm
|
75
|
+
} // namespace micro
|
76
|
+
} // namespace ops
|
77
|
+
} // namespace tflite_micro
|
78
|
+
#endif // TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_
|
@@ -0,0 +1,38 @@
|
|
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_KERNELS_XTENSA_XTENSA_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_H_
|
18
|
+
|
19
|
+
#if defined(HIFIMINI)
|
20
|
+
#include <xtensa/tie/xt_hifi2.h>
|
21
|
+
|
22
|
+
#include "tensorflow/lite/micro/kernels/xtensa/hifimini/fixedpoint_utils.h"
|
23
|
+
#endif // defined(HIFMINI)
|
24
|
+
|
25
|
+
#if defined(HIFI3) || defined(HIFI4) || defined(HIFI5)
|
26
|
+
#include "include/nnlib/xa_nnlib_api.h"
|
27
|
+
#include "include/nnlib/xa_nnlib_standards.h"
|
28
|
+
|
29
|
+
#define ALIGNED_SIZE(x, bytes) (((x) + (bytes - 1)) & (~(bytes - 1)))
|
30
|
+
#define ALIGN_PTR(x, bytes) ((((unsigned)(x)) + (bytes - 1)) & (~(bytes - 1)))
|
31
|
+
#endif // defined(HIFI3) || defined(HIFI4) || defined(HIFI5)
|
32
|
+
|
33
|
+
#if defined(VISION_P6)
|
34
|
+
#include "utils.h"
|
35
|
+
#include "vision_api.h"
|
36
|
+
#endif // defined(VISION_P6)
|
37
|
+
|
38
|
+
#endif // TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_H_
|
@@ -0,0 +1,48 @@
|
|
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_KERNELS_XTENSA_XTENSA_ADD_H_
|
17
|
+
#define TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_ADD_H_
|
18
|
+
|
19
|
+
#include <cstdint>
|
20
|
+
|
21
|
+
#include "tensorflow/lite/c/builtin_op_data.h"
|
22
|
+
#include "tensorflow/lite/c/common.h"
|
23
|
+
#include "tensorflow/lite/micro/kernels/add.h"
|
24
|
+
namespace tflite_micro {
|
25
|
+
|
26
|
+
struct XtensaAddOpData {
|
27
|
+
OpDataAdd reference_op_data;
|
28
|
+
#if defined(VISION_P6)
|
29
|
+
uint8_t* p_context; // persistent lib context for this instance saved here
|
30
|
+
uint32_t context_size;
|
31
|
+
#endif // VISION_P6
|
32
|
+
};
|
33
|
+
|
34
|
+
#if defined(VISION_P6)
|
35
|
+
|
36
|
+
TfLiteStatus AddPrepareVision(TfLiteContext* context, TfLiteNode* node);
|
37
|
+
TfLiteStatus AddEvalQuantizedVision(TfLiteContext* context, TfLiteNode* node,
|
38
|
+
const TfLiteAddParams& params,
|
39
|
+
const XtensaAddOpData& data,
|
40
|
+
const TfLiteEvalTensor* input1,
|
41
|
+
const TfLiteEvalTensor* input2,
|
42
|
+
TfLiteEvalTensor* output);
|
43
|
+
|
44
|
+
#endif // VISION_P6
|
45
|
+
|
46
|
+
} // namespace tflite_micro
|
47
|
+
|
48
|
+
#endif // TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_ADD_H_
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
14
|
+
==============================================================================*/
|
15
|
+
#ifndef TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_CONV_H_
|
16
|
+
#define TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_CONV_H_
|
17
|
+
|
18
|
+
#include <cstdint>
|
19
|
+
|
20
|
+
#include "tensorflow/lite/c/common.h"
|
21
|
+
#include "tensorflow/lite/kernels/internal/types.h"
|
22
|
+
#include "tensorflow/lite/micro/kernels/conv.h"
|
23
|
+
|
24
|
+
namespace tflite_micro {
|
25
|
+
struct XtensaConvOpData {
|
26
|
+
OpDataConv reference_op_data;
|
27
|
+
|
28
|
+
#if defined(HIFI3) || defined(HIFI4) || defined(HIFI5)
|
29
|
+
int scratch_tensor_index;
|
30
|
+
#endif // defined(HIFI3) || defined(HIFI4) || defined(HIFI5)
|
31
|
+
|
32
|
+
#if defined(VISION_P6)
|
33
|
+
int8_t* reorder_coefficient_bias; // buffers used to keep reordered coeff and
|
34
|
+
// biases.
|
35
|
+
uint32_t reorder_coefficient_bias_size;
|
36
|
+
int8_t* per_channel_output_shift_int8;
|
37
|
+
uint8_t* p_context; // persistent lib context for this instance saved here
|
38
|
+
uint32_t context_size;
|
39
|
+
bool is_per_channel_quantized;
|
40
|
+
#endif // VISION_P6
|
41
|
+
};
|
42
|
+
|
43
|
+
#if defined(HIFI3) || defined(HIFI4) || defined(HIFI5)
|
44
|
+
TfLiteStatus ConvPrepareHifi(TfLiteContext* context, TfLiteNode* node);
|
45
|
+
|
46
|
+
TfLiteStatus ConvEvalHifiInt8(TfLiteContext* context, TfLiteNode* node,
|
47
|
+
const TfLiteConvParams& params,
|
48
|
+
const XtensaConvOpData& data,
|
49
|
+
const TfLiteEvalTensor* input,
|
50
|
+
const TfLiteEvalTensor* filter,
|
51
|
+
const TfLiteEvalTensor* bias,
|
52
|
+
TfLiteEvalTensor* output);
|
53
|
+
|
54
|
+
#if defined(HIFI3) || defined(HIFI4)
|
55
|
+
TfLiteStatus ConvEvalHifiInt16(TfLiteContext* context, TfLiteNode* node,
|
56
|
+
const TfLiteConvParams& params,
|
57
|
+
const XtensaConvOpData& data,
|
58
|
+
const TfLiteEvalTensor* input,
|
59
|
+
const TfLiteEvalTensor* filter,
|
60
|
+
const TfLiteEvalTensor* bias,
|
61
|
+
TfLiteEvalTensor* output);
|
62
|
+
#endif // defined(HIFI3) || defined(HIFI4)
|
63
|
+
|
64
|
+
#endif // defined(HIFI3) || defined(HIFI4) || defined(HIFI5)
|
65
|
+
|
66
|
+
#if defined(VISION_P6)
|
67
|
+
|
68
|
+
TfLiteStatus ConvPrepareVision(TfLiteContext* context, TfLiteNode* node);
|
69
|
+
|
70
|
+
TfLiteStatus ConvEvalVision(TfLiteContext* context, TfLiteNode* node,
|
71
|
+
const TfLiteConvParams& params,
|
72
|
+
const XtensaConvOpData& data,
|
73
|
+
const TfLiteEvalTensor* input,
|
74
|
+
const TfLiteEvalTensor* filter,
|
75
|
+
const TfLiteEvalTensor* bias,
|
76
|
+
TfLiteEvalTensor* output);
|
77
|
+
|
78
|
+
#endif // VISION_P6
|
79
|
+
|
80
|
+
TfLiteStatus ConvReferenceEvalInt8(TfLiteContext* context, TfLiteNode* node);
|
81
|
+
|
82
|
+
TfLiteStatus ConvReferenceEvalInt16(TfLiteContext* context, TfLiteNode* node);
|
83
|
+
|
84
|
+
void* ConvInitXtensa(TfLiteContext* context, const char* buffer, size_t length);
|
85
|
+
TfLiteStatus ConvPrepareXtensa(TfLiteContext* context, TfLiteNode* node);
|
86
|
+
|
87
|
+
} // namespace tflite_micro
|
88
|
+
|
89
|
+
#endif // TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_XTENSA_CONV_H_
|