xmos-ai-tools 1.2.1.dev24__py3-none-win_amd64.whl → 1.3.2.dev180__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xmos_ai_tools/__init__.py +7 -7
- xmos_ai_tools/io_server/__init__.py +151 -151
- xmos_ai_tools/runtime/buildfiles/aitoolslib.cmake +13 -13
- xmos_ai_tools/runtime/buildfiles/aitoolslib.make +8 -8
- xmos_ai_tools/runtime/include/flash_server.h +2 -3
- xmos_ai_tools/runtime/include/lib_nn/api/nn_layers.h +11 -51
- xmos_ai_tools/runtime/include/lib_nn/api/nn_op_utils.h +3 -0
- xmos_ai_tools/runtime/include/lib_nn/api/quadratic_approximation.h +1 -0
- xmos_ai_tools/runtime/include/lib_nn/api/version.h +2 -2
- 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_tflite_micro/api/fast_flash.h +6 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/inference_engine.h +13 -13
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/load_weights.h +64 -0
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/version.h +1 -1
- xmos_ai_tools/runtime/include/lib_tflite_micro/api/xcore_config.h +1 -1
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_custom_options.h +2 -2
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_error_reporter.h +3 -3
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_interpreter.h +8 -8
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_ops.h +21 -7
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_profiler.h +4 -4
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_utils.h +5 -5
- xmos_ai_tools/runtime/include/lib_xud/lib_xud/api/xud.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/array.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/context_util.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/error_reporter.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/flatbuffer_conversions.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/core/api/tensor_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/c_api_types.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/core/c/common.h +17 -17
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/common.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/cppmath.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/max.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/min.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/portable_tensor_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/quantization_util.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/add_n.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/arg_min_max.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_matmul.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/batch_to_space_nd.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/binary_function.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_args.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/broadcast_to.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/ceil.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/comparisons.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/concatenation.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/cumsum.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depth_to_space.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h +1 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h +1 -1
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/dequantize.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/div.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/elu.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/exp.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fill.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_div.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/floor_mod.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/fully_connected.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/hard_swish.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/l2normalization.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/leaky_relu.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/log_softmax.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/logistic.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/lstm_cell.h +5 -5
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/maximum_minimum.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/mul.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/neg.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pad.h +8 -8
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/pooling.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/prelu.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/quantize.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/reduce.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/requantize.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_bilinear.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/round.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/select.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/slice.h +5 -5
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/softmax.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_batch_nd.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/space_to_depth.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/strided_slice.h +6 -6
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/sub.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/tanh.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/reference/transpose_conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/runtime_shape.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/strided_slice_logic.h +9 -9
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/tensor_ctypes.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/internal/types.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/kernel_util.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/kernels/padding.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/ibuffer_allocator.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/non_persistent_arena_buffer_allocator.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/persistent_arena_buffer_allocator.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/recording_single_arena_buffer_allocator.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/arena_allocator/single_arena_buffer_allocator.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/benchmarks/micro_benchmark.h +7 -7
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/fake_micro_context.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/flatbuffer_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activation_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/activations.h +6 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/add.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_function_specializations.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_interface.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ceva/types.h +6 -6
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/circular_buffer.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/conv_test.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/depthwise_conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/dequantize.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/ethosu.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/fully_connected.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/hard_swish.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_runner.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/kernel_util.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/leaky_relu.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logical.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/logistic.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval.h +48 -48
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_eval_test.h +57 -57
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/lstm_shared.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_ops.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/micro_tensor_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/mul.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pad.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/pooling.h +15 -15
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/prelu.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/quantize.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reduce.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/reshape.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/softmax.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/strided_slice.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/sub.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/svdf.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/conv_test_data.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/testdata/lstm_test_data.h +7 -7
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/unidirectional_sequence_lstm.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/hifimini/fixedpoint_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_eval.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/lstm_shared.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_add.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_depthwise_conv.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_fully_connected.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pad.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_pooling.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reduce.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_reshape.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_softmax.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/kernels/xtensa/xtensa_svdf.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_helpers.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/memory_plan_struct.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/micro_memory_planner.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/memory_planner/non_persistent_buffer_planner_shim.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocation_info.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_allocator.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_arena_constants.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_context.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_graph.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_context.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_interpreter_graph.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_log.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_mutable_op_resolver.h +50 -50
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_op_resolver.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_profiler_interface.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_resource_variable.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_time.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/micro_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/mock_micro_graph.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_allocator.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/recording_micro_interpreter.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/system_setup.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helper_custom_ops.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/test_helpers.h +6 -6
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/testing/micro_test.h +4 -4
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/flatbuffer_conversions_bridge.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tflite_bridge/micro_error_reporter.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/log_utils.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/metrics.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/micro/tools/benchmarking/op_resolver.h +3 -3
- xmos_ai_tools/runtime/include/tensorflow/lite/portable_type_to_tflitetype.h +2 -2
- xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_generated.h +2731 -2731
- xmos_ai_tools/runtime/include/tensorflow/lite/schema/schema_utils.h +2 -2
- xmos_ai_tools/runtime/lib/host_xtflitemicro.lib +0 -0
- xmos_ai_tools/runtime/lib/libxtflitemicro.a +0 -0
- xmos_ai_tools/xformer/__init__.py +64 -60
- xmos_ai_tools/xformer/flash.py +190 -190
- xmos_ai_tools/xinterpreters/__init__.py +1 -1
- xmos_ai_tools/xinterpreters/exceptions.py +38 -38
- xmos_ai_tools/xinterpreters/host_interpreter.py +651 -652
- xmos_ai_tools/xinterpreters/libs/windows/xtflm_python.dll +0 -0
- {xmos_ai_tools-1.2.1.dev24.data → xmos_ai_tools-1.3.2.dev180.data}/data/Scripts/xcore-opt.exe +0 -0
- {xmos_ai_tools-1.2.1.dev24.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/METADATA +5 -7
- {xmos_ai_tools-1.2.1.dev24.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/RECORD +224 -222
- {xmos_ai_tools-1.2.1.dev24.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/WHEEL +1 -1
- xmos_ai_tools/runtime/include/lib_tflite_micro/src/tflite-xcore-kernels/xcore_common.h +0 -19
- {xmos_ai_tools-1.2.1.dev24.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/top_level.txt +0 -0
xmos_ai_tools/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
from importlib.metadata import version, PackageNotFoundError
|
2
|
-
|
3
|
-
try:
|
4
|
-
__version__ = version(__name__)
|
5
|
-
except PackageNotFoundError:
|
6
|
-
# package is not installed
|
7
|
-
pass
|
1
|
+
from importlib.metadata import version, PackageNotFoundError
|
2
|
+
|
3
|
+
try:
|
4
|
+
__version__ = version(__name__)
|
5
|
+
except PackageNotFoundError:
|
6
|
+
# package is not installed
|
7
|
+
pass
|
@@ -1,151 +1,151 @@
|
|
1
|
-
# Copyright (c) 2020, XMOS Ltd, All rights reserved
|
2
|
-
|
3
|
-
import usb
|
4
|
-
from typing import Tuple
|
5
|
-
import numpy as np
|
6
|
-
|
7
|
-
IOSERVER_INVOKE = int(0x01)
|
8
|
-
IOSERVER_TENSOR_SEND_OUTPUT = int(0x02)
|
9
|
-
IOSERVER_TENSOR_RECV_INPUT = int(0x03)
|
10
|
-
IOSERVER_RESET = int(0x07)
|
11
|
-
IOSERVER_EXIT = int(0x08)
|
12
|
-
|
13
|
-
|
14
|
-
class IOServerError(Exception):
|
15
|
-
"""Error from device"""
|
16
|
-
|
17
|
-
pass
|
18
|
-
|
19
|
-
|
20
|
-
class IOError(IOServerError):
|
21
|
-
"""IO Error from device"""
|
22
|
-
|
23
|
-
pass
|
24
|
-
|
25
|
-
|
26
|
-
def handle_usb_error(func):
|
27
|
-
def wrapper(*args, **kwargs):
|
28
|
-
try:
|
29
|
-
return func(*args, **kwargs)
|
30
|
-
except usb.core.USBError as e:
|
31
|
-
print(f"USB error {e}")
|
32
|
-
if e.backend_error_code == usb.backend.libusb1.LIBUSB_ERROR_PIPE:
|
33
|
-
raise IOError()
|
34
|
-
else:
|
35
|
-
raise IOServerError(f"Wow...") from e
|
36
|
-
|
37
|
-
return wrapper
|
38
|
-
|
39
|
-
|
40
|
-
class IOServer:
|
41
|
-
def __init__(self, output_details: Tuple[dict, ...] = None, timeout=5000):
|
42
|
-
self.__out_ep = None
|
43
|
-
self.__in_ep = None
|
44
|
-
self._dev = None
|
45
|
-
self._output_details = output_details
|
46
|
-
self._timeout = timeout
|
47
|
-
self._max_block_size = 512 # TODO read from (usb) device?
|
48
|
-
super().__init__()
|
49
|
-
|
50
|
-
def bytes_to_arr(self, data_bytes, tensor_num):
|
51
|
-
if self._output_details:
|
52
|
-
d = self._output_details[tensor_num]
|
53
|
-
s = d["shape"]
|
54
|
-
return np.frombuffer(data_bytes, dtype=d["dtype"])[: np.prod(s)].reshape(s)
|
55
|
-
return np.frombuffer(data_bytes, dtype=np.uint8)
|
56
|
-
|
57
|
-
def write_input_tensor(self, raw_img, tensor_num=0, model_num=0):
|
58
|
-
self._download_data(
|
59
|
-
IOSERVER_TENSOR_RECV_INPUT,
|
60
|
-
raw_img,
|
61
|
-
tensor_num=tensor_num,
|
62
|
-
model_num=model_num,
|
63
|
-
)
|
64
|
-
|
65
|
-
def read_output_tensor(self, tensor_num=0, model_num=0):
|
66
|
-
# Retrieve result from device
|
67
|
-
data_read = self._upload_data(
|
68
|
-
IOSERVER_TENSOR_SEND_OUTPUT,
|
69
|
-
model_num=model_num,
|
70
|
-
tensor_num=tensor_num,
|
71
|
-
)
|
72
|
-
assert type(data_read) is bytearray
|
73
|
-
return self.bytes_to_arr(data_read, tensor_num)
|
74
|
-
|
75
|
-
def close(self):
|
76
|
-
if self._dev is not None:
|
77
|
-
self._dev.write(self._out_ep, bytes([IOSERVER_EXIT, 0, 0]), 1000)
|
78
|
-
usb.util.dispose_resources(self._dev)
|
79
|
-
self._dev = None
|
80
|
-
|
81
|
-
@handle_usb_error
|
82
|
-
def _download_data(self, cmd, data_bytes, tensor_num=0, model_num=0):
|
83
|
-
# TODO rm this extra CMD packet
|
84
|
-
self._out_ep.write(bytes([cmd, model_num, tensor_num]))
|
85
|
-
self._out_ep.write(data_bytes, 1000)
|
86
|
-
if (len(data_bytes) % self._max_block_size) == 0:
|
87
|
-
self._out_ep.write(bytearray(), 1000)
|
88
|
-
|
89
|
-
@handle_usb_error
|
90
|
-
def _upload_data(self, cmd, tensor_num=0, model_num=0):
|
91
|
-
read_data = bytearray()
|
92
|
-
self._out_ep.write(bytes([cmd, model_num, tensor_num]), self._timeout)
|
93
|
-
buff = usb.util.create_buffer(self._max_block_size)
|
94
|
-
read_len = self._dev.read(self._in_ep, buff, 10000)
|
95
|
-
read_data.extend(buff[:read_len])
|
96
|
-
while read_len == self._max_block_size:
|
97
|
-
read_len = self._dev.read(self._in_ep, buff, 10000)
|
98
|
-
read_data.extend(buff[:read_len])
|
99
|
-
|
100
|
-
return read_data
|
101
|
-
|
102
|
-
def _clear_error(self):
|
103
|
-
self._dev.clear_halt(self._out_ep)
|
104
|
-
self._dev.clear_halt(self._in_ep)
|
105
|
-
|
106
|
-
def connect(self):
|
107
|
-
self._dev = None
|
108
|
-
while self._dev is None:
|
109
|
-
# TODO - more checks that we have the right device..
|
110
|
-
self._dev = usb.core.find(idVendor=0x20B1, product="xAISRV")
|
111
|
-
|
112
|
-
# set the active configuration. With no arguments, the first
|
113
|
-
# configuration will be the active one
|
114
|
-
self._dev.set_configuration()
|
115
|
-
|
116
|
-
# get an endpoint instance
|
117
|
-
cfg = self._dev.get_active_configuration()
|
118
|
-
intf = cfg[(0, 0)]
|
119
|
-
self._out_ep = usb.util.find_descriptor(
|
120
|
-
intf,
|
121
|
-
# match the first OUT endpoint
|
122
|
-
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress)
|
123
|
-
== usb.util.ENDPOINT_OUT,
|
124
|
-
)
|
125
|
-
|
126
|
-
self._in_ep = usb.util.find_descriptor(
|
127
|
-
intf,
|
128
|
-
# match the first IN endpoint
|
129
|
-
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress)
|
130
|
-
== usb.util.ENDPOINT_IN,
|
131
|
-
)
|
132
|
-
|
133
|
-
assert self._out_ep is not None
|
134
|
-
assert self._in_ep is not None
|
135
|
-
|
136
|
-
print("Connected to XCORE_IO_SERVER via USB")
|
137
|
-
|
138
|
-
# TODO move to super()
|
139
|
-
def start_inference(self):
|
140
|
-
# Send cmd
|
141
|
-
self._out_ep.write(bytes([IOSERVER_INVOKE, 0, 0]), 1000)
|
142
|
-
|
143
|
-
# Send out a 0 length packet
|
144
|
-
self._out_ep.write(bytes([]), 1000)
|
145
|
-
|
146
|
-
def reset(self):
|
147
|
-
# Send cmd
|
148
|
-
self._out_ep.write(bytes([IOSERVER_RESET, 0, 0]), 1000)
|
149
|
-
|
150
|
-
# Send out a 0 length packet
|
151
|
-
self._out_ep.write(bytes([]), 1000)
|
1
|
+
# Copyright (c) 2020, XMOS Ltd, All rights reserved
|
2
|
+
|
3
|
+
import usb
|
4
|
+
from typing import Tuple
|
5
|
+
import numpy as np
|
6
|
+
|
7
|
+
IOSERVER_INVOKE = int(0x01)
|
8
|
+
IOSERVER_TENSOR_SEND_OUTPUT = int(0x02)
|
9
|
+
IOSERVER_TENSOR_RECV_INPUT = int(0x03)
|
10
|
+
IOSERVER_RESET = int(0x07)
|
11
|
+
IOSERVER_EXIT = int(0x08)
|
12
|
+
|
13
|
+
|
14
|
+
class IOServerError(Exception):
|
15
|
+
"""Error from device"""
|
16
|
+
|
17
|
+
pass
|
18
|
+
|
19
|
+
|
20
|
+
class IOError(IOServerError):
|
21
|
+
"""IO Error from device"""
|
22
|
+
|
23
|
+
pass
|
24
|
+
|
25
|
+
|
26
|
+
def handle_usb_error(func):
|
27
|
+
def wrapper(*args, **kwargs):
|
28
|
+
try:
|
29
|
+
return func(*args, **kwargs)
|
30
|
+
except usb.core.USBError as e:
|
31
|
+
print(f"USB error {e}")
|
32
|
+
if e.backend_error_code == usb.backend.libusb1.LIBUSB_ERROR_PIPE:
|
33
|
+
raise IOError()
|
34
|
+
else:
|
35
|
+
raise IOServerError(f"Wow...") from e
|
36
|
+
|
37
|
+
return wrapper
|
38
|
+
|
39
|
+
|
40
|
+
class IOServer:
|
41
|
+
def __init__(self, output_details: Tuple[dict, ...] = None, timeout=5000):
|
42
|
+
self.__out_ep = None
|
43
|
+
self.__in_ep = None
|
44
|
+
self._dev = None
|
45
|
+
self._output_details = output_details
|
46
|
+
self._timeout = timeout
|
47
|
+
self._max_block_size = 512 # TODO read from (usb) device?
|
48
|
+
super().__init__()
|
49
|
+
|
50
|
+
def bytes_to_arr(self, data_bytes, tensor_num):
|
51
|
+
if self._output_details:
|
52
|
+
d = self._output_details[tensor_num]
|
53
|
+
s = d["shape"]
|
54
|
+
return np.frombuffer(data_bytes, dtype=d["dtype"])[: np.prod(s)].reshape(s)
|
55
|
+
return np.frombuffer(data_bytes, dtype=np.uint8)
|
56
|
+
|
57
|
+
def write_input_tensor(self, raw_img, tensor_num=0, model_num=0):
|
58
|
+
self._download_data(
|
59
|
+
IOSERVER_TENSOR_RECV_INPUT,
|
60
|
+
raw_img,
|
61
|
+
tensor_num=tensor_num,
|
62
|
+
model_num=model_num,
|
63
|
+
)
|
64
|
+
|
65
|
+
def read_output_tensor(self, tensor_num=0, model_num=0):
|
66
|
+
# Retrieve result from device
|
67
|
+
data_read = self._upload_data(
|
68
|
+
IOSERVER_TENSOR_SEND_OUTPUT,
|
69
|
+
model_num=model_num,
|
70
|
+
tensor_num=tensor_num,
|
71
|
+
)
|
72
|
+
assert type(data_read) is bytearray
|
73
|
+
return self.bytes_to_arr(data_read, tensor_num)
|
74
|
+
|
75
|
+
def close(self):
|
76
|
+
if self._dev is not None:
|
77
|
+
self._dev.write(self._out_ep, bytes([IOSERVER_EXIT, 0, 0]), 1000)
|
78
|
+
usb.util.dispose_resources(self._dev)
|
79
|
+
self._dev = None
|
80
|
+
|
81
|
+
@handle_usb_error
|
82
|
+
def _download_data(self, cmd, data_bytes, tensor_num=0, model_num=0):
|
83
|
+
# TODO rm this extra CMD packet
|
84
|
+
self._out_ep.write(bytes([cmd, model_num, tensor_num]))
|
85
|
+
self._out_ep.write(data_bytes, 1000)
|
86
|
+
if (len(data_bytes) % self._max_block_size) == 0:
|
87
|
+
self._out_ep.write(bytearray(), 1000)
|
88
|
+
|
89
|
+
@handle_usb_error
|
90
|
+
def _upload_data(self, cmd, tensor_num=0, model_num=0):
|
91
|
+
read_data = bytearray()
|
92
|
+
self._out_ep.write(bytes([cmd, model_num, tensor_num]), self._timeout)
|
93
|
+
buff = usb.util.create_buffer(self._max_block_size)
|
94
|
+
read_len = self._dev.read(self._in_ep, buff, 10000)
|
95
|
+
read_data.extend(buff[:read_len])
|
96
|
+
while read_len == self._max_block_size:
|
97
|
+
read_len = self._dev.read(self._in_ep, buff, 10000)
|
98
|
+
read_data.extend(buff[:read_len])
|
99
|
+
|
100
|
+
return read_data
|
101
|
+
|
102
|
+
def _clear_error(self):
|
103
|
+
self._dev.clear_halt(self._out_ep)
|
104
|
+
self._dev.clear_halt(self._in_ep)
|
105
|
+
|
106
|
+
def connect(self):
|
107
|
+
self._dev = None
|
108
|
+
while self._dev is None:
|
109
|
+
# TODO - more checks that we have the right device..
|
110
|
+
self._dev = usb.core.find(idVendor=0x20B1, product="xAISRV")
|
111
|
+
|
112
|
+
# set the active configuration. With no arguments, the first
|
113
|
+
# configuration will be the active one
|
114
|
+
self._dev.set_configuration()
|
115
|
+
|
116
|
+
# get an endpoint instance
|
117
|
+
cfg = self._dev.get_active_configuration()
|
118
|
+
intf = cfg[(0, 0)]
|
119
|
+
self._out_ep = usb.util.find_descriptor(
|
120
|
+
intf,
|
121
|
+
# match the first OUT endpoint
|
122
|
+
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress)
|
123
|
+
== usb.util.ENDPOINT_OUT,
|
124
|
+
)
|
125
|
+
|
126
|
+
self._in_ep = usb.util.find_descriptor(
|
127
|
+
intf,
|
128
|
+
# match the first IN endpoint
|
129
|
+
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress)
|
130
|
+
== usb.util.ENDPOINT_IN,
|
131
|
+
)
|
132
|
+
|
133
|
+
assert self._out_ep is not None
|
134
|
+
assert self._in_ep is not None
|
135
|
+
|
136
|
+
print("Connected to XCORE_IO_SERVER via USB")
|
137
|
+
|
138
|
+
# TODO move to super()
|
139
|
+
def start_inference(self):
|
140
|
+
# Send cmd
|
141
|
+
self._out_ep.write(bytes([IOSERVER_INVOKE, 0, 0]), 1000)
|
142
|
+
|
143
|
+
# Send out a 0 length packet
|
144
|
+
self._out_ep.write(bytes([]), 1000)
|
145
|
+
|
146
|
+
def reset(self):
|
147
|
+
# Send cmd
|
148
|
+
self._out_ep.write(bytes([IOSERVER_RESET, 0, 0]), 1000)
|
149
|
+
|
150
|
+
# Send out a 0 length packet
|
151
|
+
self._out_ep.write(bytes([]), 1000)
|
@@ -1,13 +1,13 @@
|
|
1
|
-
set(XMOS_AITOOLSLIB_DEFINITIONS
|
2
|
-
"TF_LITE_STATIC_MEMORY"
|
3
|
-
"TF_LITE_STRIP_ERROR_STRINGS"
|
4
|
-
"XCORE"
|
5
|
-
"NO_INTERPRETER"
|
6
|
-
)
|
7
|
-
|
8
|
-
if("${APP_BUILD_ARCH}" STREQUAL xs3a OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL XCORE_XS3A)
|
9
|
-
set(XMOS_AITOOLSLIB_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/../lib/libxtflitemicro.a")
|
10
|
-
else()
|
11
|
-
set(XMOS_AITOOLSLIB_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/../lib/libhost_xtflitemicro.a")
|
12
|
-
endif()
|
13
|
-
set(XMOS_AITOOLSLIB_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/../include")
|
1
|
+
set(XMOS_AITOOLSLIB_DEFINITIONS
|
2
|
+
"TF_LITE_STATIC_MEMORY"
|
3
|
+
"TF_LITE_STRIP_ERROR_STRINGS"
|
4
|
+
"XCORE"
|
5
|
+
"NO_INTERPRETER"
|
6
|
+
)
|
7
|
+
|
8
|
+
if("${APP_BUILD_ARCH}" STREQUAL xs3a OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL XCORE_XS3A)
|
9
|
+
set(XMOS_AITOOLSLIB_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/../lib/libxtflitemicro.a")
|
10
|
+
else()
|
11
|
+
set(XMOS_AITOOLSLIB_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/../lib/libhost_xtflitemicro.a")
|
12
|
+
endif()
|
13
|
+
set(XMOS_AITOOLSLIB_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/../include")
|
@@ -1,8 +1,8 @@
|
|
1
|
-
XMOS_AITOOLSLIB_DEFINITIONS = \
|
2
|
-
-DTF_LITE_STATIC_MEMORY \
|
3
|
-
-DTF_LITE_STRIP_ERROR_STRINGS \
|
4
|
-
-DXCORE \
|
5
|
-
-DNO_INTERPRETER
|
6
|
-
|
7
|
-
XMOS_AITOOLSLIB_LIBRARIES = $(XMOS_AITOOLSLIB_PATH)/lib/libxtflitemicro.a
|
8
|
-
XMOS_AITOOLSLIB_INCLUDES = -I$(XMOS_AITOOLSLIB_PATH)/include
|
1
|
+
XMOS_AITOOLSLIB_DEFINITIONS = \
|
2
|
+
-DTF_LITE_STATIC_MEMORY \
|
3
|
+
-DTF_LITE_STRIP_ERROR_STRINGS \
|
4
|
+
-DXCORE \
|
5
|
+
-DNO_INTERPRETER
|
6
|
+
|
7
|
+
XMOS_AITOOLSLIB_LIBRARIES = $(XMOS_AITOOLSLIB_PATH)/lib/libxtflitemicro.a
|
8
|
+
XMOS_AITOOLSLIB_INCLUDES = -I$(XMOS_AITOOLSLIB_PATH)/include
|
@@ -26,9 +26,8 @@ typedef struct flash {
|
|
26
26
|
typedef enum flash_command {
|
27
27
|
FLASH_READ_PARAMETERS =
|
28
28
|
0, ///< Read a set of parameters. // TODO: share with lib_tflite_micro
|
29
|
-
|
30
|
-
|
31
|
-
2, ///< Read the binary for an operator - future extension
|
29
|
+
FLASH_READ_PARAMETERS_ASYNC = 1, ///< Read parameters asynchronously.
|
30
|
+
FLASH_READ_SYNCHRONIZE = 2, ///< Complete async read.
|
32
31
|
FLASH_READ_XIP =
|
33
32
|
3, ///< Read code to execute-in-place throught L2 cache - future extension
|
34
33
|
FLASH_SERVER_QUIT = 4,
|
@@ -109,50 +109,6 @@ typedef struct padding_sizes_t {
|
|
109
109
|
int32_t right;
|
110
110
|
} padding_sizes_t;
|
111
111
|
|
112
|
-
/**
|
113
|
-
* @brief Execute @oper{pad_prepare} function.
|
114
|
-
*
|
115
|
-
* `plan` points to the output vector @tensor{y} with length @math{N}.
|
116
|
-
*
|
117
|
-
* `p` struct describing the padding to be applied to the input tensor.
|
118
|
-
*
|
119
|
-
* `x` parameters describing the input tensor to be padded.
|
120
|
-
*
|
121
|
-
* `bytes_per_pixel` the bytes per pixel for tensor x.
|
122
|
-
*
|
123
|
-
* @param plan [out] The output vector @tensor{y}
|
124
|
-
* @param p [in] The input vector @tensor{x}
|
125
|
-
* @param x [in] Look-up table @tensor{T}
|
126
|
-
* @param bytes_per_pixel [in] Length @math{N} of input and output vectors
|
127
|
-
*/
|
128
|
-
C_API void pad_prepare(nn_pad_plan_t *plan, const padding_sizes_t *p,
|
129
|
-
const nn_image_params_t *x,
|
130
|
-
const unsigned bytes_per_pixel);
|
131
|
-
|
132
|
-
/**
|
133
|
-
* @brief Execute @oper{pad_run} job.
|
134
|
-
*
|
135
|
-
* See @oper_ref{pad_run} for more details about the @oper{requantize_16_to_8}
|
136
|
-
* operator.
|
137
|
-
*
|
138
|
-
* `Y` points to the output vector @tensor{y}.
|
139
|
-
*
|
140
|
-
* `X` points to the input vector @tensor{x}.
|
141
|
-
*
|
142
|
-
* `plan` points to the (initialized) plan.
|
143
|
-
*
|
144
|
-
* @requires_word_alignment{Y,X}
|
145
|
-
*
|
146
|
-
* @param y [out] The output vector @tensor{y}
|
147
|
-
* @param x [in] The input vector @tensor{x}
|
148
|
-
* @param plan [in] The prameters describing how to pad.
|
149
|
-
*/
|
150
|
-
void pad_run(char *y, char *x, const nn_pad_plan_t *p, uint32_t pad_value);
|
151
|
-
|
152
|
-
void pad_ref(char *y, char *x, const padding_sizes_t *p,
|
153
|
-
const nn_image_params_t *xp, const unsigned bytes_per_pixel,
|
154
|
-
uint32_t pad_value);
|
155
|
-
|
156
112
|
/**
|
157
113
|
* Func to calculate n_3
|
158
114
|
*/
|
@@ -336,12 +292,16 @@ void softmax_generate_exp_lut(int zero_point, float scale, float *lut);
|
|
336
292
|
void softmax_ref(int8_t *Y, const int8_t *X, const float zero_point,
|
337
293
|
const float scale, const int length);
|
338
294
|
|
339
|
-
void
|
340
|
-
|
341
|
-
|
295
|
+
void softmax_single(int8_t *Y, const int8_t *X, const float *lut,
|
296
|
+
const int offset);
|
297
|
+
|
298
|
+
void mean_int8(const int8_t *input, int8_t *output, const int start_dim_size,
|
299
|
+
const int mean_dim_size, const int end_dim_size,
|
300
|
+
const float in_zero_point, const float out_zero_point,
|
301
|
+
const float scale_mul);
|
302
|
+
|
303
|
+
void mean_int16(const int16_t *input, int16_t *output, const int start_dim_size,
|
304
|
+
const int mean_dim_size, const int end_dim_size,
|
305
|
+
const float scale_mul);
|
342
306
|
|
343
|
-
void slice_memcpy_get_params(int *begin_dst, int *end_dst, int *in_offsets,
|
344
|
-
int *out_offsets, int *shape_dst, const int *begin,
|
345
|
-
const int *size, const int *shape,
|
346
|
-
const int dtype_size, const int rank);
|
347
307
|
#endif // LAYERS_H_
|
@@ -8,6 +8,9 @@
|
|
8
8
|
|
9
9
|
#include "xs3_vpu.h"
|
10
10
|
|
11
|
+
C_API int calculateAlignedThreadSplit(int tc, int split_size, int split_start[], int split_end[]);
|
12
|
+
C_API int calculateThreadSplit(int tc, int split_size, int split_start[], int split_end[], int alignment);
|
13
|
+
|
11
14
|
#ifdef __XC__
|
12
15
|
extern "C" {
|
13
16
|
#endif
|
@@ -78,5 +78,6 @@ C_API float approximation_function_tanh(float x);
|
|
78
78
|
C_API float approximation_function_logistics(float x);
|
79
79
|
C_API float approximation_function_elu(float x);
|
80
80
|
C_API float approximation_function_relu(float x);
|
81
|
+
C_API float approximation_function_relu6(float x);
|
81
82
|
|
82
83
|
#endif
|
@@ -1,11 +1,11 @@
|
|
1
|
-
// Copyright (c)
|
1
|
+
// Copyright (c) 2024, XMOS Ltd, All rights reserved
|
2
2
|
#ifndef LIB_NN_VERSION_H_
|
3
3
|
#define LIB_NN_VERSION_H_
|
4
4
|
|
5
5
|
namespace lib_nn {
|
6
6
|
|
7
7
|
static const unsigned major_version = 0;
|
8
|
-
static const unsigned minor_version =
|
8
|
+
static const unsigned minor_version = 4;
|
9
9
|
static const unsigned patch_version = 0;
|
10
10
|
|
11
11
|
} // namespace lib_nn
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#ifndef _vpu_memmove_word_aligned_h_
|
2
|
+
#define _vpu_memmove_word_aligned_h_
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Function that copies a block of memory. Both source and destination
|
6
|
+
* address must be word aligned. Any number of bytes can be copied. There
|
7
|
+
* may be an overlap between the destination and source.
|
8
|
+
*
|
9
|
+
* @param dst Destination address, must be word aligned.
|
10
|
+
* @param src Source address, must be word aligned.
|
11
|
+
* @param byte_count Number of bytes to copy - may be zero
|
12
|
+
*/
|
13
|
+
void vpu_memmove_word_aligned(void * dst, const void * src, unsigned int byte_count);
|
14
|
+
|
15
|
+
#endif
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#include <stdint.h>
|
2
|
+
|
3
|
+
#ifndef _vpu_memset_256_h_
|
4
|
+
#define _vpu_memset_256_h_
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Function that replicates a vector. The source address must be word
|
8
|
+
* aligned, the destination address is assumed to be aligned with the
|
9
|
+
* replication pattern in the source. Any number of bytes can be copied.
|
10
|
+
* There should not be an overlap between the destination and source.
|
11
|
+
*
|
12
|
+
* It is assumed that the source address contains 32 replicated bytes (if
|
13
|
+
* the destination address is byte aligned), or that it contains 16
|
14
|
+
* replicated shorts (if the destination address is 16-bit aligned), or
|
15
|
+
* that it contains 8 replicated ints.
|
16
|
+
*
|
17
|
+
* broadcast_32_to_256() and BROADCAST_8_TO_32() cane be used to
|
18
|
+
* create the source vector
|
19
|
+
*
|
20
|
+
* @param dst Destination address
|
21
|
+
* @param src Source address, must be word aligned.
|
22
|
+
* @param byte_count Number of bytes to copy - may be zero
|
23
|
+
*/
|
24
|
+
void vpu_memset_256(void *dst, const void *src, unsigned int byte_count);
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Function that replicates an int over a vector. The vector must be
|
28
|
+
* aligned on an 8-byte boundary. In order to replicate a byte or short over
|
29
|
+
* a vector, combine this with a call to BROADCAST_8_TO_32() or
|
30
|
+
* BROADCAST_16_TO_32(). Declare the vector as a uint64_t x[] in order to
|
31
|
+
* guarantee 8-byte alignement.
|
32
|
+
*
|
33
|
+
* @param dst Destination address, must be 8-byte aligned
|
34
|
+
* @param from Value to be replicated
|
35
|
+
*/
|
36
|
+
void broadcast_32_to_256(void *dst, uint32_t from);
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Macro that replicates a byte over an int.
|
40
|
+
* Use with broadcast_32_to_256() in order to replicate a byte over a vector
|
41
|
+
*/
|
42
|
+
#define BROADCAST_8_TO_32(f) (((uint8_t)f) * 0x01010101)
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Macro that replicates a short over an int
|
46
|
+
* Use with broadcast_32_to_256() in order to replicate a short over a vector
|
47
|
+
*/
|
48
|
+
#define BROADCAST_16_TO_32(f) (((uint16_t)f) * 0x00010001)
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Macro that replicates a byte over a short
|
52
|
+
*/
|
53
|
+
#define BROADCAST_8_TO_16(f) (((uint8_t)f) * 0x00000101)
|
54
|
+
|
55
|
+
#endif
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
#include <quadflash.h>
|
5
5
|
|
6
|
+
#ifdef __XC__
|
6
7
|
/** Fast flash library.
|
7
8
|
* Before calling any of the functions in here, lib_quad_flash must be initialised as normal by using
|
8
9
|
* fl_connectToDevice(qspi, flash_spec, n_flash_spec).
|
@@ -44,4 +45,9 @@ int fast_flash_init(fl_QSPIPorts &qspi);
|
|
44
45
|
*/
|
45
46
|
void fast_flash_read(fl_QSPIPorts &qspi, unsigned addr, unsigned word_count, unsigned read_data[], chanend ?c_data_out);
|
46
47
|
|
48
|
+
#else
|
49
|
+
int fast_flash_init(fl_QSPIPorts *qspi);
|
50
|
+
void fast_flash_read(fl_QSPIPorts *qspi, unsigned addr, unsigned word_count, unsigned read_data[], chanend_t c_data_out);
|
51
|
+
#endif
|
52
|
+
|
47
53
|
#endif
|
@@ -38,15 +38,15 @@
|
|
38
38
|
* must therefore be allocated inside a C++ source file.
|
39
39
|
*/
|
40
40
|
struct tflite_micro_objects {
|
41
|
-
|
42
|
-
|
41
|
+
tflite_micro::micro::xcore::XCoreErrorReporter error_reporter;
|
42
|
+
tflite_micro::micro::xcore::XCoreProfiler xcore_profiler;
|
43
43
|
uint64_t interpreter_buffer
|
44
|
-
[(sizeof(
|
44
|
+
[(sizeof(tflite_micro::micro::xcore::XCoreInterpreter) + sizeof(uint64_t) - 1) /
|
45
45
|
sizeof(uint64_t)]; // This needs to be aligned on a double word boundary
|
46
|
-
|
46
|
+
tflite_micro::MicroMutableOpResolver<XTFLM_OPERATORS> resolver;
|
47
47
|
|
48
|
-
|
49
|
-
const
|
48
|
+
tflite_micro::micro::xcore::XCoreInterpreter *interpreter;
|
49
|
+
const tflite_micro::Model *model;
|
50
50
|
};
|
51
51
|
#endif
|
52
52
|
|
@@ -122,8 +122,8 @@ typedef struct inference_engine {
|
|
122
122
|
* &s0);
|
123
123
|
* resolver->AddAdd();
|
124
124
|
* resolver->AddConv2D();
|
125
|
-
* resolver->AddCustom(
|
126
|
-
*
|
125
|
+
* resolver->AddCustom(tflite_micro::ops::micro::xcore::Conv2D_V2_OpCode,
|
126
|
+
* tflite_micro::ops::micro::xcore::Register_Conv2D_V2());
|
127
127
|
* [...]
|
128
128
|
*
|
129
129
|
* Note that when tensorflow lite for micro is disabled this function will not
|
@@ -146,7 +146,7 @@ typedef struct inference_engine {
|
|
146
146
|
* structures. Must be allocated by the caller.
|
147
147
|
*
|
148
148
|
*/
|
149
|
-
|
149
|
+
tflite_micro::MicroMutableOpResolver<XTFLM_OPERATORS> *inference_engine_initialize(
|
150
150
|
inference_engine_t *UNSAFE ie, uint32_t memory_primary[],
|
151
151
|
uint32_t n_memory_primary, uint32_t memory_secondary[],
|
152
152
|
uint32_t n_secondary, struct tflite_micro_objects *UNSAFE xtflmo);
|
@@ -175,17 +175,17 @@ void inference_engine_unload_model(inference_engine_t *UNSAFE ie);
|
|
175
175
|
* \param ie pointer to inference engine.
|
176
176
|
* \param model_bytes Number of bytes in the model
|
177
177
|
* \param model_data Pointer to the model (one of data_model or
|
178
|
-
* data_tensor_arena passed above) \param
|
179
|
-
*
|
178
|
+
* data_tensor_arena passed above) \param c_flash_or_tile Optional channel to flash
|
179
|
+
* or tile server
|
180
180
|
*
|
181
181
|
* \returns non zero indicates an error
|
182
182
|
*/
|
183
183
|
#ifdef __XC__
|
184
|
-
int inference_engine_load_model(inference_engine_t * UNSAFE ie, uint32_t model_bytes, uint32_t * UNSAFE model_data, chanend ?
|
184
|
+
int inference_engine_load_model(inference_engine_t * UNSAFE ie, uint32_t model_bytes, uint32_t * UNSAFE model_data, chanend ?c_flash_or_tile);
|
185
185
|
#else
|
186
186
|
int inference_engine_load_model(inference_engine_t *UNSAFE ie,
|
187
187
|
uint32_t model_bytes,
|
188
|
-
uint32_t *UNSAFE model_data, void *
|
188
|
+
uint32_t *UNSAFE model_data, void *weights_data_ptr);
|
189
189
|
#endif
|
190
190
|
|
191
191
|
/** Function that invokes the inference engine. This function will create an
|