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,551 @@
|
|
1
|
+
// Copyright 2020-2021 XMOS LIMITED.
|
2
|
+
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
3
|
+
#ifndef POOLING_H_
|
4
|
+
#define POOLING_H_
|
5
|
+
|
6
|
+
#include "nn_conv2d_structs.h"
|
7
|
+
#include "nn_image.h"
|
8
|
+
#include "nn_types.h"
|
9
|
+
#include "nn_window_params.h"
|
10
|
+
|
11
|
+
typedef nn_window_op_job_params_t nn_conv2d_job_params_t;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Flags used with maxpool2d_ext() for advanced scenarios.
|
15
|
+
*/
|
16
|
+
typedef enum {
|
17
|
+
/**
|
18
|
+
* Placeholder flag used to indicate no other flags are needed.
|
19
|
+
*/
|
20
|
+
MAXPOOL2D_FLAG_NONE = 0,
|
21
|
+
} nn_maxpool2d_flags_e;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Flags used with avgpool2d_ext() for advanced scenarios.
|
25
|
+
*/
|
26
|
+
typedef enum {
|
27
|
+
/**
|
28
|
+
* Placeholder flag used to indicate no other flags are needed.
|
29
|
+
*/
|
30
|
+
AVGPOOL2D_FLAG_NONE = 0,
|
31
|
+
} nn_avgpool2d_flags_e;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Flags used with avgpool2d_global_ext() for advanced scenarios.
|
35
|
+
*/
|
36
|
+
typedef enum {
|
37
|
+
/**
|
38
|
+
* Placeholder flag used to indicate no other flags are needed.
|
39
|
+
*/
|
40
|
+
AVGPOOL2D_GLOBAL_FLAG_NONE = 0,
|
41
|
+
} nn_avgpool2d_global_flags_e;
|
42
|
+
|
43
|
+
// /**
|
44
|
+
// * @brief Initialize an instance of the @oper{avgpool2d_global} operator.
|
45
|
+
// *
|
46
|
+
// * See @oper_ref{avgpool2d_global} for more details about the
|
47
|
+
// @oper{avgpool2d_global} operator. To invoke a
|
48
|
+
// * @oper{avgpool2d_global} job, call avgpool2d_global().
|
49
|
+
// *
|
50
|
+
// * When avgpool2d_global() is called, a plan (`nn_avgpool2d_global_plan_t`)
|
51
|
+
// and a job (`nn_avgpool2d_global_job_t`) must
|
52
|
+
// * be supplied to tell it how to do its work. This function initializes that
|
53
|
+
// plan and one or more jobs to be supplied in
|
54
|
+
// * subsequent calls to avgpool2d_global().
|
55
|
+
// *
|
56
|
+
// * A plan contains information shared by all jobs of an instance of
|
57
|
+
// @oper{avgpool2d_global}. Each job computes a range
|
58
|
+
// * of channels in the output vector (possibly the entire vector).
|
59
|
+
// *
|
60
|
+
// * `plan` points to the plan to be initialized. It need only be initialized
|
61
|
+
// once for many calls to avgpool2d_global().
|
62
|
+
// *
|
63
|
+
// * `jobs` points to an array of `nn_avgpool2d_global_job_t` to be
|
64
|
+
// initialized. Each element represents one job. There
|
65
|
+
// * should be `job_count` elements in the array.
|
66
|
+
// *
|
67
|
+
// * `x_params` points to the image parameters for the instance's input (and
|
68
|
+
// output) image @tensor{X}.
|
69
|
+
// *
|
70
|
+
// * `job_params` points to either an array of
|
71
|
+
// `nn_avgpool2d_global_job_params_t` structs or else is `NULL`. A
|
72
|
+
// * `job_params` value of `NULL` indicates that there will only be a single
|
73
|
+
// job which computes the entire output image.
|
74
|
+
// * If `job_params` is `NULL`, then `job_count` must be `1`. If `job_params`
|
75
|
+
// is not `NULL`, it must point to an array
|
76
|
+
// * of `job_count` `nn_avgpool2d_global_job_params_t` elements.
|
77
|
+
// *
|
78
|
+
// * In particular, job `k` will compute the output elements @math{y[p]} for
|
79
|
+
// which:
|
80
|
+
// * @inlinecode
|
81
|
+
// * job_params[k].start_channel <= p < job_params[k].start_channel +
|
82
|
+
// job_params[k].out.channels
|
83
|
+
// * @endinlinecode
|
84
|
+
// *
|
85
|
+
// * `job_count` indicates the number of jobs to be initialized (and thus the
|
86
|
+
// number of elements in the `jobs` array), as
|
87
|
+
// * well the number of elements in the `job_params` array if it is not `NULL`.
|
88
|
+
// *
|
89
|
+
// * @param plan [out] The plan to be initialized.
|
90
|
+
// * @param jobs [out] Array of jobs to be initialized.
|
91
|
+
// * @param x_params [in] Parameters describing the shape of each input
|
92
|
+
// (and output) image tensor @tensor{X}.
|
93
|
+
// * @param job_params [in] An array of
|
94
|
+
// `nn_avgpool2d_global_job_params_t` structs, or NULL
|
95
|
+
// * @param job_count [in] The number of jobs to be initialized.
|
96
|
+
// */
|
97
|
+
// void avgpool2d_global_init(
|
98
|
+
// nn_avgpool2d_global_plan_t* plan,
|
99
|
+
// nn_avgpool2d_global_job_t* jobs,
|
100
|
+
// const nn_image_params_t* x_params,
|
101
|
+
// const nn_avgpool2d_global_job_params_t* job_params,
|
102
|
+
// const unsigned job_count);
|
103
|
+
|
104
|
+
/**
|
105
|
+
* @brief Invoke @oper{maxpool2d} job.
|
106
|
+
*
|
107
|
+
* See @oper_ref{maxpool2d} for more details about the @oper{maxpool2d}
|
108
|
+
* operator.
|
109
|
+
*
|
110
|
+
* @par Parameter Details
|
111
|
+
*
|
112
|
+
* `Y` points to the output image @tensor{Y} with shape @tensor_shape{Y_h, Y_w,
|
113
|
+
* X_c}.
|
114
|
+
*
|
115
|
+
* `X` points to the input image @tensor{X} with shape @tensor_shape{X_h, X_w,
|
116
|
+
* X_c}.
|
117
|
+
*
|
118
|
+
* The memory layout of @tensor{Y} and @tensor{X} are the standard memory layout
|
119
|
+
* for image tensors (see @ref standard_layout).
|
120
|
+
*
|
121
|
+
* `x_params` points to the image parameters describing the shape of the input
|
122
|
+
* image @tensor{X}. The size of each of
|
123
|
+
* @tensor{X}'s dimensions, @math{X_h}, @math{X_w}, and @math{X_c} correspond to
|
124
|
+
* `x_params->height`, `x_params->width`, and `x_params->channels` respectively.
|
125
|
+
*
|
126
|
+
* `y_params` points to the image parameters describing the shape of the output
|
127
|
+
* image @tensor{Y}. The size of each of
|
128
|
+
* @tensor{Y}'s dimensions, @math{Y_h}, @math{Y_w}, and @math{X_c} correspond to
|
129
|
+
* `y_params->height`, `y_params->width`, and `x_params->channels` respectively.
|
130
|
+
*
|
131
|
+
* `pooling_window` points to a `nn_window_params_t` struct containing the
|
132
|
+
* instance's @math{W_h}, @math{W_w},
|
133
|
+
* @math{W_{vert}}, @math{W_{hori}}, @math{W_{r0}} and @math{W_{c0}}
|
134
|
+
* hyperparameters (see @ref maxpool2d_hyperparameters) which describe the
|
135
|
+
* spacial relationship between the input image, the pooling window window and
|
136
|
+
* the output image. `pooling_window->dilation` is ignored.
|
137
|
+
*
|
138
|
+
* `pooling_window->shape` specifies @math{W_h} and @math{W_w}, the height and
|
139
|
+
* width of the pooling window.
|
140
|
+
*
|
141
|
+
* `pooling_window->start` specifies @math{W_{r0}} and @math{W_{c0}}, the
|
142
|
+
* starting row and column of the pooling window in @tensor{X}'s coordinate
|
143
|
+
* space. For example, a `start` value of `(0,0)` indicates that the top-left
|
144
|
+
* pixel of the output image has the pooling window aligned with the top-left
|
145
|
+
* corner of the input image, with no implied padding at the top or left sides
|
146
|
+
* of the input image. A `start` value of `(1,1)`, on the other hand, indicates
|
147
|
+
* that the top-left pixel of the output image has the pooling window shifted
|
148
|
+
* one pixel right and one pixel down relative to the top-left corner of the
|
149
|
+
* input image.
|
150
|
+
*
|
151
|
+
* `pooling_window->stride.horizontal` specifies @math{W_{vert}} and
|
152
|
+
* @math{W_{hori}}, the vertical and horizontal strides of the pooling window.
|
153
|
+
* The strides describe the number of pixels the pooling window moves (across
|
154
|
+
* the input image) with each pixel in the output image.
|
155
|
+
*
|
156
|
+
* @par Parameter Constraints
|
157
|
+
*
|
158
|
+
* The arguments `Y` and `X` must each point to a word-aligned address.
|
159
|
+
*
|
160
|
+
* The input and output images must have the same number of channels. As such,
|
161
|
+
* it is required that `y_params->channels == x_params->channels`.
|
162
|
+
*
|
163
|
+
* Due to memory alignment requirements, @math{X_c} must be a multiple of
|
164
|
+
* @math{4}, which forces all pixels to begin at word-aligned addresses.
|
165
|
+
*
|
166
|
+
* Padding is not supported by this operator.
|
167
|
+
*
|
168
|
+
* @par Splitting the Workload
|
169
|
+
*
|
170
|
+
* See maxpool2d_ext() for more advanced scenarios which allow the the work to
|
171
|
+
* be split across multiple invocations (which can be parallelized across
|
172
|
+
* cores).
|
173
|
+
*
|
174
|
+
* @par Additional Remarks
|
175
|
+
*
|
176
|
+
* Internally, maxpool2d() calls maxpool2d_ext() with a `job_params` argument
|
177
|
+
* that computes the entire output image, and with no flags set. For more
|
178
|
+
* advanced scenarios, use maxpool2d_ext().
|
179
|
+
*
|
180
|
+
* By default this operator uses the standard 8-bit limits @math([-128, 127])
|
181
|
+
* when applying saturation logic. Instead, it can be configured to use
|
182
|
+
* symmetric saturation bounds @math([-127, 127]) by defining
|
183
|
+
* `CONFIG_SYMMETRIC_SATURATION_maxpool2d` appropriately. See @ref nn_config.h
|
184
|
+
* for more details. Note that this configures _all_ instances of the
|
185
|
+
* @oper{maxpool2d} operator.
|
186
|
+
*
|
187
|
+
* If @math{X_c} is not a multiple of @math{32}, this operator may read up to 28
|
188
|
+
* bytes following the end of @tensor{X}. This is not ordinarily a problem.
|
189
|
+
* However, if the object to which `X` points is located very near the end of a
|
190
|
+
* valid memory address range, it is possible memory access exceptions may occur
|
191
|
+
* when this operator is invoked.
|
192
|
+
*
|
193
|
+
* If necessary, this can be avoided by manually forcing a buffer region (no
|
194
|
+
* more than @math{28} bytes are necessary) following @tensor{X}. There are
|
195
|
+
* various ways this can be accomplished, including embedding these objects in
|
196
|
+
* larger structures.
|
197
|
+
*
|
198
|
+
* @param[out] Y The output image @tensor{Y}
|
199
|
+
* @param[in] X The input image @tensor{X}
|
200
|
+
* @param[in] x_params Parameters describing the shape of input image
|
201
|
+
* tensor @tensor{X}
|
202
|
+
* @param[in] y_params Parameters describing the shape of output image
|
203
|
+
* tensor @tensor{Y}
|
204
|
+
* @param[in] pooling_window Parameters describing the relationship between
|
205
|
+
* the pooling window, the input image, and the output image
|
206
|
+
*/
|
207
|
+
void maxpool2d(nn_image_t* Y, const nn_image_t* X,
|
208
|
+
const nn_image_params_t* x_params,
|
209
|
+
const nn_image_params_t* y_params,
|
210
|
+
const nn_window_params_t* pooling_window);
|
211
|
+
|
212
|
+
/**
|
213
|
+
* @brief Invoke @oper{maxpool2d} job.
|
214
|
+
*
|
215
|
+
* See @oper_ref{maxpool2d} for more details about the @oper{maxpool2d}
|
216
|
+
* operator.
|
217
|
+
*
|
218
|
+
* @par Parameter Details
|
219
|
+
*
|
220
|
+
* `Y` points to the output image @tensor{Y} with shape @tensor_shape{Y_h, Y_w,
|
221
|
+
* X_c}.
|
222
|
+
*
|
223
|
+
* `X` points to the input image @tensor{X} with shape @tensor_shape{X_h, X_w,
|
224
|
+
* X_c}.
|
225
|
+
*
|
226
|
+
* The memory layout of @tensor{Y} and @tensor{X} are the standard memory layout
|
227
|
+
* for image tensors (see @ref standard_layout).
|
228
|
+
*
|
229
|
+
* `x_params` points to the image parameters describing the shape of the input
|
230
|
+
* image @tensor{X}. The size of each of
|
231
|
+
* @tensor{X}'s dimensions, @math{X_h}, @math{X_w}, and @math{X_c} correspond to
|
232
|
+
* `x_params->height`, `x_params->width`, and `x_params->channels` respectively.
|
233
|
+
*
|
234
|
+
* `y_params` points to the image parameters describing the shape of the output
|
235
|
+
* image @tensor{Y}. The size of each of
|
236
|
+
* @tensor{Y}'s dimensions, @math{Y_h}, @math{Y_w}, and @math{X_c} correspond to
|
237
|
+
* `y_params->height`, `y_params->width`, and `x_params->channels` respectively.
|
238
|
+
*
|
239
|
+
* `pooling_window` points to a `nn_window_params_t` struct containing the
|
240
|
+
* instance's @math{W_h}, @math{W_w},
|
241
|
+
* @math{W_{vert}}, @math{W_{hori}}, @math{W_{r0}} and @math{W_{c0}}
|
242
|
+
* hyperparameters (see @ref maxpool2d_hyperparameters) which describe the
|
243
|
+
* spacial relationship between the input image, the pooling window window and
|
244
|
+
* the output image. `pooling_window->dilation` is ignored.
|
245
|
+
*
|
246
|
+
* `pooling_window->shape` specifies @math{W_h} and @math{W_w}, the height and
|
247
|
+
* width of the pooling window.
|
248
|
+
*
|
249
|
+
* `pooling_window->start` specifies @math{W_{r0}} and @math{W_{c0}}, the
|
250
|
+
* starting row and column of the pooling window in @tensor{X}'s coordinate
|
251
|
+
* space. For example, a `start` value of `(0,0)` indicates that the top-left
|
252
|
+
* pixel of the output image has the pooling window aligned with the top-left
|
253
|
+
* corner of the input image, with no implied padding at the top or left sides
|
254
|
+
* of the input image. A `start` value of `(1,1)`, on the other hand, indicates
|
255
|
+
* that the top-left pixel of the output image has the pooling window shifted
|
256
|
+
* one pixel right and one pixel down relative to the top-left corner of the
|
257
|
+
* input image.
|
258
|
+
*
|
259
|
+
* `pooling_window->stride.horizontal` specifies @math{W_{vert}} and
|
260
|
+
* @math{W_{hori}}, the vertical and horizontal strides of the pooling window.
|
261
|
+
* The strides describe the number of pixels the pooling window moves (across
|
262
|
+
* the input image) with each pixel in the output image.
|
263
|
+
*
|
264
|
+
* `job_params` describes which elements of the output image will be computed by
|
265
|
+
* this invocation. This invocation computes the output elements @math{Y[r,c,p]}
|
266
|
+
* for which:
|
267
|
+
* @inlinecode
|
268
|
+
* job_params->start.rows <= r < job_params->start.rows +
|
269
|
+
* job_params->size.rows job_params->start.cols <= c < job_params->start.cols +
|
270
|
+
* job_params->size.cols job_params->start.channels <= p <
|
271
|
+
* job_params->start.channels + job_params->size.channels
|
272
|
+
* @endinlinecode
|
273
|
+
*
|
274
|
+
* `flags` is a collection of flags which modify the behavior of
|
275
|
+
* @oper{maxpool2d}. See `nn_maxpool2d_flags_e` for a description of each flag.
|
276
|
+
* `MAXPOOL2D_FLAG_NONE`(0) can be used for default behavior.
|
277
|
+
*
|
278
|
+
* @par Parameter Constraints
|
279
|
+
*
|
280
|
+
* The arguments `Y` and `X` must each point to a word-aligned address.
|
281
|
+
*
|
282
|
+
* The input and output images must have the same number of channels. As such,
|
283
|
+
* it is required that `y_params->channels == x_params->channels`.
|
284
|
+
*
|
285
|
+
* Due to memory alignment requirements, @math{X_c} must be a multiple of
|
286
|
+
* @math{4}, which forces all pixels to begin at word-aligned addresses.
|
287
|
+
*
|
288
|
+
* Padding is not supported by this operator.
|
289
|
+
*
|
290
|
+
* @par Splitting the Workload
|
291
|
+
*
|
292
|
+
* @todo Include information about how to split the work into multiple
|
293
|
+
* invocations (e.g. for parallelization), particularly any counter-intuitive
|
294
|
+
* aspects.
|
295
|
+
*
|
296
|
+
* @par Additional Remarks
|
297
|
+
*
|
298
|
+
* Internally, maxpool2d() calls maxpool2d_ext() with a `job_params` argument
|
299
|
+
* that computes the entire output image, and with no flags set. For more
|
300
|
+
* advanced scenarios, use maxpool2d_ext().
|
301
|
+
*
|
302
|
+
* By default this operator uses the standard 8-bit limits @math([-128, 127])
|
303
|
+
* when applying saturation logic. Instead, it can be configured to use
|
304
|
+
* symmetric saturation bounds @math([-127, 127]) by defining
|
305
|
+
* `CONFIG_SYMMETRIC_SATURATION_maxpool2d` appropriately. See @ref nn_config.h
|
306
|
+
* for more details. Note that this configures _all_ instances of the
|
307
|
+
* @oper{maxpool2d} operator.
|
308
|
+
*
|
309
|
+
* If @math{X_c} is not a multiple of @math{32}, this operator may read up to 28
|
310
|
+
* bytes following the end of @tensor{X}. This is not ordinarily a problem.
|
311
|
+
* However, if the object to which `X` points is located very near the end of a
|
312
|
+
* valid memory address range, it is possible memory access exceptions may occur
|
313
|
+
* when this operator is invoked.
|
314
|
+
*
|
315
|
+
* If necessary, this can be avoided by manually forcing a buffer region (no
|
316
|
+
* more than @math{28} bytes are necessary) following @tensor{X}. There are
|
317
|
+
* various ways this can be accomplished, including embedding these objects in
|
318
|
+
* larger structures.
|
319
|
+
*
|
320
|
+
* @param[out] Y The output image @tensor{Y}
|
321
|
+
* @param[in] X The input image @tensor{X}
|
322
|
+
* @param[in] x_params Parameters describing the shape of input image
|
323
|
+
* tensor @tensor{X}
|
324
|
+
* @param[in] y_params Parameters describing the shape of output image
|
325
|
+
* tensor @tensor{Y}
|
326
|
+
* @param[in] pooling_window Parameters describing the relationship between
|
327
|
+
* the pooling window, the input image, and the output image
|
328
|
+
* @param[in] job_params Indicates which output elements will be computed
|
329
|
+
* by this invocation
|
330
|
+
* @param[in] flags Flags which modify the behavior of
|
331
|
+
* maxpool2d_ext()
|
332
|
+
*/
|
333
|
+
void maxpool2d_ext(nn_image_t* Y, const nn_image_t* X,
|
334
|
+
const nn_image_params_t* x_params,
|
335
|
+
const nn_image_params_t* y_params,
|
336
|
+
const nn_window_params_t* window_config,
|
337
|
+
const nn_window_op_job_params_t* job_params,
|
338
|
+
const nn_maxpool2d_flags_e flags);
|
339
|
+
|
340
|
+
/**
|
341
|
+
* @brief Invoke a @oper{avgpool2d_global} job.
|
342
|
+
*
|
343
|
+
* The @oper{avgpool2d_global} operator computes a scaled and biased sum of
|
344
|
+
* pixel values for each channel of an input image, producing an 8-bit vector of
|
345
|
+
* outputs.
|
346
|
+
*
|
347
|
+
* See @oper_ref{avgpool2d_global} for more details about the
|
348
|
+
* @oper{avgpool2d_global} operator, including the mathematical details of the
|
349
|
+
* operation performed.
|
350
|
+
*
|
351
|
+
* @par Parameter Details
|
352
|
+
*
|
353
|
+
* `Y` points to the 8-bit output vector @tensor{y} with length
|
354
|
+
* @tensor_shape{X_c}.
|
355
|
+
*
|
356
|
+
* `X` points to the 8-bit input image @tensor{X} with shape @tensor_shape{X_h,
|
357
|
+
* X_w, X_c}. The memory layout of
|
358
|
+
* @tensor{X} is the standard memory layout for image tensors (see @ref
|
359
|
+
* standard_layout).
|
360
|
+
*
|
361
|
+
* `bias` is the 32-bit bias @math{b} with which the accumulators are
|
362
|
+
* initialized for each output. Note that the right-shift by @math{r} bits is
|
363
|
+
* applied after all accumulation. To add an absolute offset of @math{b_0} to
|
364
|
+
* each result, then the value used for @math{b} should be @math{b_0 \cdot 2^r}.
|
365
|
+
*
|
366
|
+
* `scale` is the 8-bit coefficient @math{s}. All pixel values are multiplied by
|
367
|
+
* @math{s} and added to the 32-bit accumulator.
|
368
|
+
*
|
369
|
+
* `shift` is the (rounding) right-shift @math{r} applied to each 32-bit
|
370
|
+
* accumulator to yield an 8-bit result. Note that this is a saturating
|
371
|
+
* right-shift which will saturate to 8-bit bounds (see additional remarks
|
372
|
+
* below).
|
373
|
+
*
|
374
|
+
* `x_params` points to the image parameters describing the shape of the input
|
375
|
+
* image @tensor{X}. The size of each of
|
376
|
+
* @tensor{X}'s dimensions, @math{X_h}, @math{X_w}, and @math{X_c} correspond to
|
377
|
+
* `x_params->height`, `x_params->width`, and `x_params->channels` respectively.
|
378
|
+
*
|
379
|
+
* @par Parameter Constraints
|
380
|
+
*
|
381
|
+
* The arguments `Y` and `X` must each point to a word-aligned address.
|
382
|
+
*
|
383
|
+
* The input and output images must have the same number of channels. As such,
|
384
|
+
* it is required that `y_params->channels == x_params->channels`.
|
385
|
+
*
|
386
|
+
* Due to memory alignment requirements, @math{X_c} must be a multiple of
|
387
|
+
* @math{4}, which forces all pixels to begin at a word-aligned address.
|
388
|
+
*
|
389
|
+
* Padding is not supported by this operator.
|
390
|
+
*
|
391
|
+
* @par Splitting the Workload
|
392
|
+
*
|
393
|
+
* See avgpool2d_ext() for more advanced scenarios which allow the the work to
|
394
|
+
* be split across multiple invocations (which can be parallelized across
|
395
|
+
* cores).
|
396
|
+
*
|
397
|
+
* @par Additional Remarks
|
398
|
+
*
|
399
|
+
* Internally, avgpool2d() calls avgpool2d_ext() with a `job_params` argument
|
400
|
+
* that computes the entire output image, and with no flags set. For more
|
401
|
+
* advanced scenarios, use avgpool2d_ext().
|
402
|
+
*
|
403
|
+
* The arguments `Y` and `X` should both point at the beginning of their
|
404
|
+
* respective objects, even if the job being invoked does not start at the
|
405
|
+
* beginning of the output vector.
|
406
|
+
*
|
407
|
+
* By default this operator uses the standard 8-bit limits @math([-128, 127])
|
408
|
+
* when applying saturation logic. Instead, it can be configured to use
|
409
|
+
* symmetric saturation bounds @math([-127, 127]) by defining
|
410
|
+
* `CONFIG_SYMMETRIC_SATURATION_avgpool2d_global` appropriately. See @ref
|
411
|
+
* nn_config.h for more details. Note that this configures _all_ instances of
|
412
|
+
* the @oper{avgpool2d_global} operator.
|
413
|
+
*
|
414
|
+
* If @math{X_c} is not a multiple of @math{16}, this operator may read up to 12
|
415
|
+
* bytes following the end of @tensor{X}. This is not ordinarily a problem.
|
416
|
+
* However, if the object to which `X` points is located very near the end of a
|
417
|
+
* valid memory address range, it is possible memory access exceptions may occur
|
418
|
+
* when this operator is invoked.
|
419
|
+
*
|
420
|
+
* If necessary, this can be avoided by manually forcing a buffer region (no
|
421
|
+
* more than @math{12} bytes are necessary) following @tensor{X}. There are
|
422
|
+
* various ways this can be accomplished, including embedding these objects in
|
423
|
+
* larger structures.
|
424
|
+
*
|
425
|
+
* @param[out] Y The output vector @tensor{y}
|
426
|
+
* @param[in] X The input image @tensor{X}
|
427
|
+
* @param[in] bias Initial 32-bit accumulator value @math{b}. Shared by
|
428
|
+
* all channels.
|
429
|
+
* @param[in] scale The factor @math{s} by which input pixel values are
|
430
|
+
* scaled.
|
431
|
+
* @param[in] shift The right-shift @math{r} applied to the 32-bit
|
432
|
+
* accumulators to yield an 8-bit result.
|
433
|
+
* @param[in] x_params Parameters describing the shape of input image
|
434
|
+
* tensor @tensor{X}
|
435
|
+
*/
|
436
|
+
void avgpool2d_global(nn_image_t* Y, const nn_image_t* X, const int32_t bias,
|
437
|
+
const int8_t scale, const uint16_t shift,
|
438
|
+
const nn_image_params_t* x_params);
|
439
|
+
|
440
|
+
/**
|
441
|
+
* @brief Invoke a @oper{avgpool2d_global} job.
|
442
|
+
*
|
443
|
+
* The @oper{avgpool2d_global} operator computes a scaled and biased sum of
|
444
|
+
* pixel values for each channel of an input image, producing an 8-bit vector of
|
445
|
+
* outputs.
|
446
|
+
*
|
447
|
+
* See @oper_ref{avgpool2d_global} for more details about the
|
448
|
+
* @oper{avgpool2d_global} operator, including the mathematical details of the
|
449
|
+
* operation performed.
|
450
|
+
*
|
451
|
+
* @par Parameter Details
|
452
|
+
*
|
453
|
+
* `Y` points to the 8-bit output vector @tensor{y} with length
|
454
|
+
* @tensor_shape{X_c}.
|
455
|
+
*
|
456
|
+
* `X` points to the 8-bit input image @tensor{X} with shape @tensor_shape{X_h,
|
457
|
+
* X_w, X_c}. The memory layout of
|
458
|
+
* @tensor{X} is the standard memory layout for image tensors (see @ref
|
459
|
+
* standard_layout).
|
460
|
+
*
|
461
|
+
* `bias` is the 32-bit bias @math{b} with which the accumulators are
|
462
|
+
* initialized for each output. Note that the right-shift by @math{r} bits is
|
463
|
+
* applied after all accumulation. To add an absolute offset of @math{b_0} to
|
464
|
+
* each result, then the value used for @math{b} should be @math{b_0 \cdot 2^r}.
|
465
|
+
*
|
466
|
+
* `scale` is the 8-bit coefficient @math{s}. All pixel values are multiplied by
|
467
|
+
* @math{s} and added to the 32-bit accumulator.
|
468
|
+
*
|
469
|
+
* `shift` is the (rounding) right-shift @math{r} applied to each 32-bit
|
470
|
+
* accumulator to yield an 8-bit result. Note that this is a saturating
|
471
|
+
* right-shift which will saturate to 8-bit bounds (see additional remarks
|
472
|
+
* below).
|
473
|
+
*
|
474
|
+
* `x_params` points to the image parameters describing the shape of the input
|
475
|
+
* image @tensor{X}. The size of each of
|
476
|
+
* @tensor{X}'s dimensions, @math{X_h}, @math{X_w}, and @math{X_c} correspond to
|
477
|
+
* `x_params->height`, `x_params->width`, and `x_params->channels` respectively.
|
478
|
+
*
|
479
|
+
* `chan_start` is the first output channel to be computed by this invocation.
|
480
|
+
*
|
481
|
+
* `chan_count` is the number of channels to be computed by this invocation.
|
482
|
+
*
|
483
|
+
* `flags` is a collection of flags which modify the behavior of
|
484
|
+
* @oper{avgpool2d_global}. See `nn_avgpool2d_flags_e` for a description of each
|
485
|
+
* flag. `AVGPOOL2D_GLOBAL_FLAG_NONE`(0) can be used for default behavior.
|
486
|
+
*
|
487
|
+
* @par Parameter Constraints
|
488
|
+
*
|
489
|
+
* The arguments `Y` and `X` must each point to a word-aligned address.
|
490
|
+
*
|
491
|
+
* The input and output images must have the same number of channels. As such,
|
492
|
+
* it is required that `y_params->channels == x_params->channels`.
|
493
|
+
*
|
494
|
+
* Due to memory alignment requirements, @math{X_c} must be a multiple of
|
495
|
+
* @math{4}, which forces all pixels to begin at a word-aligned address.
|
496
|
+
*
|
497
|
+
* Padding is not supported by this operator.
|
498
|
+
*
|
499
|
+
* @par Splitting the Workload
|
500
|
+
*
|
501
|
+
* @todo Include information about how to split the work into multiple
|
502
|
+
* invocations (e.g. for parallelization), particularly any counter-intuitive
|
503
|
+
* aspects.
|
504
|
+
*
|
505
|
+
* @par Additional Remarks
|
506
|
+
*
|
507
|
+
* Internally, avgpool2d() calls avgpool2d_ext() with a `job_params` argument
|
508
|
+
* that computes the entire output image, and with no flags set. For more
|
509
|
+
* advanced scenarios, use avgpool2d_ext().
|
510
|
+
*
|
511
|
+
* The arguments `Y` and `X` should both point at the beginning of their
|
512
|
+
* respective objects, even if the job being invoked does not start at the
|
513
|
+
* beginning of the output vector.
|
514
|
+
*
|
515
|
+
* By default this operator uses the standard 8-bit limits @math([-128, 127])
|
516
|
+
* when applying saturation logic. Instead, it can be configured to use
|
517
|
+
* symmetric saturation bounds @math([-127, 127]) by defining
|
518
|
+
* `CONFIG_SYMMETRIC_SATURATION_avgpool2d_global` appropriately. See @ref
|
519
|
+
* nn_config.h for more details. Note that this configures _all_ instances of
|
520
|
+
* the @oper{avgpool2d_global} operator.
|
521
|
+
*
|
522
|
+
* If @math{X_c} is not a multiple of @math{16}, this operator may read up to 12
|
523
|
+
* bytes following the end of @tensor{X}. This is not ordinarily a problem.
|
524
|
+
* However, if the object to which `X` points is located very near the end of a
|
525
|
+
* valid memory address range, it is possible memory access exceptions may occur
|
526
|
+
* when this operator is invoked.
|
527
|
+
*
|
528
|
+
* If necessary, this can be avoided by manually forcing a buffer region (no
|
529
|
+
* more than @math{12} bytes are necessary) following @tensor{X}. There are
|
530
|
+
* various ways this can be accomplished, including embedding these objects in
|
531
|
+
* larger structures.
|
532
|
+
*
|
533
|
+
* @param[out] Y The output vector @tensor{y}
|
534
|
+
* @param[in] X The input image @tensor{X}
|
535
|
+
* @param[in] bias Initial 32-bit accumulator value @math{b}. Shared by
|
536
|
+
* all channels.
|
537
|
+
* @param[in] scale The factor @math{s} by which input pixel values are
|
538
|
+
* scaled.
|
539
|
+
* @param[in] shift The right-shift @math{r} applied to the 32-bit
|
540
|
+
* accumulators to yield an 8-bit result.
|
541
|
+
* @param[in] x_params Parameters describing the shape of input image
|
542
|
+
* tensor @tensor{X}
|
543
|
+
*/
|
544
|
+
void avgpool2d_global_ext(nn_image_t* Y, const nn_image_t* X,
|
545
|
+
const int32_t bias, const int8_t scale,
|
546
|
+
const uint16_t shift,
|
547
|
+
const nn_image_params_t* x_params,
|
548
|
+
const unsigned chan_start, const unsigned chan_count,
|
549
|
+
const nn_avgpool2d_global_flags_e flags);
|
550
|
+
|
551
|
+
#endif // POOLING_H_
|
@@ -0,0 +1,83 @@
|
|
1
|
+
// Copyright 2020-2021 XMOS LIMITED.
|
2
|
+
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
3
|
+
#ifndef NN_TYPES_H_
|
4
|
+
#define NN_TYPES_H_
|
5
|
+
|
6
|
+
#include <stdint.h>
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Padding modes
|
10
|
+
*/
|
11
|
+
typedef enum {
|
12
|
+
PADDING_VALID = 0,
|
13
|
+
PADDING_SAME = 1,
|
14
|
+
} padding_mode_t;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Where functions in the API take an array of values, where the array index
|
18
|
+
* corresponds to a padding direction, the indices shall be as indicated in
|
19
|
+
* `nn_pad_index_t`, with the order being top padding, left padding, bottom
|
20
|
+
* padding, right padding. Rather than hard-coding those values, this enum can
|
21
|
+
* be used instead.
|
22
|
+
*/
|
23
|
+
enum {
|
24
|
+
NN_PAD_TOP = 0,
|
25
|
+
NN_PAD_LEFT,
|
26
|
+
NN_PAD_BOTTOM,
|
27
|
+
NN_PAD_RIGHT,
|
28
|
+
};
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Alias for `uint16_t`.
|
32
|
+
*
|
33
|
+
* `data16_t` is used to hint that a struct field or function parameter is
|
34
|
+
* opaque 16-bit data.
|
35
|
+
*/
|
36
|
+
typedef uint16_t data16_t;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Alias for `int8_t`.
|
40
|
+
*
|
41
|
+
* `nn_tensor_t*` is used to hint that a struct field or function parameter is
|
42
|
+
* to be interpreted as a tensor.
|
43
|
+
*/
|
44
|
+
typedef int8_t nn_tensor_t;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Alias for `int8_t`.
|
48
|
+
*
|
49
|
+
* `nn_image_t*` is used to hint that a struct field or function parameter will
|
50
|
+
* be interpreted as an image-like tensor.
|
51
|
+
*/
|
52
|
+
typedef nn_tensor_t nn_image_t;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Alias for `int32_t`.
|
56
|
+
*
|
57
|
+
* `mem_stride_t` is used to hint that a struct field or function parameter
|
58
|
+
* indicates the signed offset between memory addresses, expressed in bytes.
|
59
|
+
*/
|
60
|
+
typedef int32_t mem_stride_t;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Alias for `unsigned`.
|
64
|
+
*
|
65
|
+
* `channel_count_t` is used to hint that a struct field or function parameter
|
66
|
+
* indicates a number of channels.
|
67
|
+
*/
|
68
|
+
typedef uint32_t channel_count_t;
|
69
|
+
|
70
|
+
/**
|
71
|
+
*
|
72
|
+
* Function pointer to unary op kernel functions for int16
|
73
|
+
*/
|
74
|
+
typedef void (*UnaryI16FnType)(void *output, void *input, int tensor_length, void *blob);
|
75
|
+
|
76
|
+
|
77
|
+
/**
|
78
|
+
*
|
79
|
+
* Function pointer to binary op kernel functions for int16
|
80
|
+
*/
|
81
|
+
typedef void (*BinaryI16FnType)(void *output, void *input1, void *input2, int tensor_length, void *blob);
|
82
|
+
|
83
|
+
#endif // NN_TYPES_H_
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// Copyright 2020-2021 XMOS LIMITED.
|
2
|
+
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
3
|
+
#ifndef STRUCTS_H_
|
4
|
+
#define STRUCTS_H_
|
5
|
+
|
6
|
+
#include <stdint.h>
|
7
|
+
|
8
|
+
/**
|
9
|
+
* This struct represents an indexing vector for an image.
|
10
|
+
*/
|
11
|
+
typedef struct {
|
12
|
+
/** Number of image pixel rows */
|
13
|
+
int32_t rows;
|
14
|
+
/** Number of image pixel columns */
|
15
|
+
int32_t cols;
|
16
|
+
/** Number of image pixel channels */
|
17
|
+
int32_t channels;
|
18
|
+
} nn_image_vect_t;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Some of the functions in this API can have their work split into
|
22
|
+
* multiple parts, each called a "job". This is useful, for example,
|
23
|
+
* for parallelizing a computation across multiple cores, or to reduce
|
24
|
+
* the delay between which the calling function can service some other
|
25
|
+
* resource.
|
26
|
+
*
|
27
|
+
* This struct contains the parameters required to specify how work
|
28
|
+
* can be split according to the region of the output image in which
|
29
|
+
* the job operates.
|
30
|
+
*
|
31
|
+
* For an output image `Y` with shape `(Y_height, Y_width, Y_chans)`,
|
32
|
+
* the value of this struct indicates that a particular job should
|
33
|
+
* compute the output values in the rectangular region
|
34
|
+
* `Y[ start.rows : (start.rows + size.rows),
|
35
|
+
* start.cols : (start.cols + size.cols),
|
36
|
+
* start.channels : (start.channels + size.channels) ]`
|
37
|
+
*/
|
38
|
+
typedef struct {
|
39
|
+
/**
|
40
|
+
* Indices in an output image at which to begin producing output.
|
41
|
+
*
|
42
|
+
* Typically channels must be a multiple of 4.
|
43
|
+
*/
|
44
|
+
nn_image_vect_t start;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* The number of rows, columns and channels of output to produce.
|
48
|
+
*
|
49
|
+
* Typically channels must be a multiple of 4.
|
50
|
+
*/
|
51
|
+
nn_image_vect_t size;
|
52
|
+
|
53
|
+
} nn_window_op_job_params_t;
|
54
|
+
|
55
|
+
#endif // STRUCTS_H_
|