xmos-ai-tools 1.2.1.dev20__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/add_int16_transform.h +2 -1
- xmos_ai_tools/runtime/include/lib_nn/api/dequantize_int16_transform.h +2 -1
- xmos_ai_tools/runtime/include/lib_nn/api/multiply_int16_transform.h +4 -2
- xmos_ai_tools/runtime/include/lib_nn/api/nn_api.h +2 -0
- 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.dev20.data → xmos_ai_tools-1.3.2.dev180.data}/data/Scripts/xcore-opt.exe +0 -0
- {xmos_ai_tools-1.2.1.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/METADATA +5 -7
- {xmos_ai_tools-1.2.1.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/RECORD +228 -226
- {xmos_ai_tools-1.2.1.dev20.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.dev20.dist-info → xmos_ai_tools-1.3.2.dev180.dist-info}/top_level.txt +0 -0
@@ -25,7 +25,7 @@ limitations under the License.
|
|
25
25
|
|
26
26
|
#define KRNL_C_DIM_NHWC 0 // output channels
|
27
27
|
|
28
|
-
namespace
|
28
|
+
namespace tflite_micro {
|
29
29
|
namespace ops {
|
30
30
|
namespace micro {
|
31
31
|
|
@@ -118,7 +118,7 @@ inline void MliTensorAttachBuffer<int8_t>(const TfLiteEvalTensor* tfT,
|
|
118
118
|
// non-const mli_tensor. This is required by current implementation of MLI
|
119
119
|
// backend and planned for redesign due to this and some other aspects.
|
120
120
|
mliT->SetData<int8_t>(
|
121
|
-
const_cast<int8_t*>(
|
121
|
+
const_cast<int8_t*>(tflite_micro::micro::GetTensorData<int8_t>(tfT)),
|
122
122
|
*mliT->DataCapacity());
|
123
123
|
}
|
124
124
|
|
@@ -129,7 +129,7 @@ inline void MliTensorAttachBuffer<int32_t>(const TfLiteEvalTensor* tfT,
|
|
129
129
|
// non-const mli_tensor. This is required by current implementation of MLI
|
130
130
|
// backend and planned for redesign due to this and some other aspects.
|
131
131
|
mliT->SetData<int32_t>(
|
132
|
-
const_cast<int32_t*>(
|
132
|
+
const_cast<int32_t*>(tflite_micro::micro::GetTensorData<int32_t>(tfT)),
|
133
133
|
*mliT->DataCapacity());
|
134
134
|
}
|
135
135
|
|
@@ -305,6 +305,6 @@ inline void permute_weights(const mli_tensor* weights_src,
|
|
305
305
|
|
306
306
|
} // namespace micro
|
307
307
|
} // namespace ops
|
308
|
-
} // namespace
|
308
|
+
} // namespace tflite_micro
|
309
309
|
|
310
310
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_TF_UTILS_H_
|
@@ -20,7 +20,7 @@ limitations under the License.
|
|
20
20
|
#include "mli_interface.h"
|
21
21
|
#include "tensorflow/lite/c/common.h"
|
22
22
|
|
23
|
-
namespace
|
23
|
+
namespace tflite_micro {
|
24
24
|
namespace ops {
|
25
25
|
namespace micro {
|
26
26
|
|
@@ -140,6 +140,6 @@ TfLiteStatus arc_scratch_buffer_calc_slice_size_weights(
|
|
140
140
|
|
141
141
|
} // namespace micro
|
142
142
|
} // namespace ops
|
143
|
-
} // namespace
|
143
|
+
} // namespace tflite_micro
|
144
144
|
|
145
145
|
#endif // TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUF_MGR_H_
|
@@ -19,7 +19,7 @@ limitations under the License.
|
|
19
19
|
#include "mli_api.h" // NOLINT
|
20
20
|
#include "tensorflow/lite/c/common.h"
|
21
21
|
|
22
|
-
namespace
|
22
|
+
namespace tflite_micro {
|
23
23
|
namespace ops {
|
24
24
|
namespace micro {
|
25
25
|
|
@@ -73,6 +73,6 @@ static inline bool inside_arc_ccm(void* p) {
|
|
73
73
|
|
74
74
|
} // namespace micro
|
75
75
|
} // namespace ops
|
76
|
-
} // namespace
|
76
|
+
} // namespace tflite_micro
|
77
77
|
|
78
78
|
#endif // TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUFFERS_H_
|
@@ -209,7 +209,7 @@ inline bool NextIndex(const int num_dims, const int* dims, int* current) {
|
|
209
209
|
|
210
210
|
#include "tensorflow/lite/kernels/internal/compatibility.h"
|
211
211
|
|
212
|
-
namespace
|
212
|
+
namespace tflite_micro {
|
213
213
|
|
214
214
|
enum class FusedActivationFunctionType : uint8_t { kNone, kRelu6, kRelu1, kRelu };
|
215
215
|
enum class PaddingType : uint8_t { kNone, kSame, kValid };
|
@@ -485,9 +485,9 @@ class RuntimeShape {
|
|
485
485
|
};
|
486
486
|
};
|
487
487
|
|
488
|
-
// Converts inference-style shape to legacy
|
489
|
-
inline
|
490
|
-
|
488
|
+
// Converts inference-style shape to legacy tflite_micro::Dims<4>.
|
489
|
+
inline tflite_micro::Dims<4> ToRuntimeDims(const tflite_micro::RuntimeShape& array_shape) {
|
490
|
+
tflite_micro::Dims<4> result;
|
491
491
|
const int dimensions_count = array_shape.DimensionsCount();
|
492
492
|
TFLITE_CHECK_LE(dimensions_count, 4);
|
493
493
|
int cum_prod = 1;
|
@@ -502,7 +502,7 @@ inline tflite::Dims<4> ToRuntimeDims(const tflite::RuntimeShape& array_shape) {
|
|
502
502
|
}
|
503
503
|
|
504
504
|
// TODO(b/80418076): Move to legacy ops file, update invocations.
|
505
|
-
inline RuntimeShape DimsToShape(const
|
505
|
+
inline RuntimeShape DimsToShape(const tflite_micro::Dims<4>& dims) {
|
506
506
|
return RuntimeShape(
|
507
507
|
{dims.sizes[3], dims.sizes[2], dims.sizes[1], dims.sizes[0]});
|
508
508
|
}
|
@@ -1281,6 +1281,6 @@ inline void GetActivationParams(const P& params, float* min, float* max) {
|
|
1281
1281
|
*max = params.float_activation_max;
|
1282
1282
|
}
|
1283
1283
|
|
1284
|
-
} // namespace
|
1284
|
+
} // namespace tflite_micro
|
1285
1285
|
#endif
|
1286
1286
|
#endif // CEVA_TYPES_H_
|
@@ -19,7 +19,7 @@ limitations under the License.
|
|
19
19
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
20
20
|
#include "tensorflow/lite/c/common.h"
|
21
21
|
|
22
|
-
namespace
|
22
|
+
namespace tflite_micro {
|
23
23
|
|
24
24
|
// The CircularBuffer op has one input and one output tensor.
|
25
25
|
extern const int kCircularBufferInputTensor;
|
@@ -40,6 +40,6 @@ struct OpDataCircularBuffer {
|
|
40
40
|
|
41
41
|
TfLiteStatus CircularBufferPrepare(TfLiteContext* context, TfLiteNode* node);
|
42
42
|
|
43
|
-
} // namespace
|
43
|
+
} // namespace tflite_micro
|
44
44
|
|
45
45
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_CIRCULAR_BUFFER_H_
|
@@ -22,7 +22,7 @@ limitations under the License.
|
|
22
22
|
#include "tensorflow/lite/kernels/internal/types.h"
|
23
23
|
#include "tensorflow/lite/micro/micro_common.h"
|
24
24
|
|
25
|
-
namespace
|
25
|
+
namespace tflite_micro {
|
26
26
|
|
27
27
|
struct OpDataConv {
|
28
28
|
TfLitePaddingValues padding;
|
@@ -112,6 +112,6 @@ inline TFLMRegistration Register_CONV_2D_INT8() { return Register_CONV_2D(); }
|
|
112
112
|
inline TFLMRegistration Register_CONV_2D_INT16() { return Register_CONV_2D(); }
|
113
113
|
#endif // defined(CMSIS_NN) || defined(XTENSA)
|
114
114
|
|
115
|
-
} // namespace
|
115
|
+
} // namespace tflite_micro
|
116
116
|
|
117
117
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_CONV_H_
|
@@ -23,7 +23,7 @@ limitations under the License.
|
|
23
23
|
#include "tensorflow/lite/micro/test_helpers.h"
|
24
24
|
#include "tensorflow/lite/micro/testing/micro_test.h"
|
25
25
|
|
26
|
-
namespace
|
26
|
+
namespace tflite_micro {
|
27
27
|
namespace testing {
|
28
28
|
|
29
29
|
TfLiteStatus InvokeConv(TfLiteTensor* tensors, int tensors_size,
|
@@ -89,6 +89,6 @@ TfLiteStatus TestConvQuantizedPerChannel(
|
|
89
89
|
TFLMRegistration registration, int16_t* output_data);
|
90
90
|
|
91
91
|
} // namespace testing
|
92
|
-
} // namespace
|
92
|
+
} // namespace tflite_micro
|
93
93
|
|
94
94
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_CONV_TEST_H_
|
@@ -23,7 +23,7 @@ limitations under the License.
|
|
23
23
|
#include "tensorflow/lite/kernels/internal/types.h"
|
24
24
|
#include "tensorflow/lite/micro/kernels/conv.h"
|
25
25
|
|
26
|
-
namespace
|
26
|
+
namespace tflite_micro {
|
27
27
|
|
28
28
|
extern const int kDepthwiseConvInputTensor;
|
29
29
|
extern const int kDepthwiseConvWeightsTensor;
|
@@ -75,6 +75,6 @@ inline TFLMRegistration Register_DEPTHWISE_CONV_2D_INT16() {
|
|
75
75
|
}
|
76
76
|
#endif
|
77
77
|
|
78
|
-
} // namespace
|
78
|
+
} // namespace tflite_micro
|
79
79
|
|
80
80
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_DEPTHWISE_CONV_H_
|
@@ -20,10 +20,10 @@ limitations under the License.
|
|
20
20
|
#include "tensorflow/lite/c/common.h"
|
21
21
|
#include "tensorflow/lite/kernels/internal/types.h"
|
22
22
|
|
23
|
-
namespace
|
23
|
+
namespace tflite_micro {
|
24
24
|
|
25
25
|
struct DequantizeOpData {
|
26
|
-
|
26
|
+
tflite_micro::DequantizationParams quantization_params;
|
27
27
|
// The scaling factor from input to output (aka the 'real multiplier') can
|
28
28
|
// be represented as a fixed point multiplier plus a left shift.
|
29
29
|
int32_t output_multiplier;
|
@@ -33,6 +33,6 @@ struct DequantizeOpData {
|
|
33
33
|
|
34
34
|
TfLiteStatus DequantizePrepare(TfLiteContext* context, TfLiteNode* node);
|
35
35
|
|
36
|
-
} // namespace
|
36
|
+
} // namespace tflite_micro
|
37
37
|
|
38
38
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_DEQUANTIZE_H_
|
@@ -17,12 +17,12 @@ limitations under the License.
|
|
17
17
|
|
18
18
|
#include "tensorflow/lite/c/common.h"
|
19
19
|
|
20
|
-
namespace
|
20
|
+
namespace tflite_micro {
|
21
21
|
|
22
22
|
TFLMRegistration* Register_ETHOSU();
|
23
23
|
|
24
24
|
const char* GetString_ETHOSU();
|
25
25
|
|
26
|
-
} // namespace
|
26
|
+
} // namespace tflite_micro
|
27
27
|
|
28
28
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_ETHOSU_H_
|
@@ -21,7 +21,7 @@ limitations under the License.
|
|
21
21
|
#include "tensorflow/lite/kernels/internal/types.h"
|
22
22
|
#include "tensorflow/lite/micro/micro_common.h"
|
23
23
|
|
24
|
-
namespace
|
24
|
+
namespace tflite_micro {
|
25
25
|
|
26
26
|
struct OpDataFullyConnected {
|
27
27
|
// The scaling factor from input to output (aka the 'real multiplier') can
|
@@ -107,6 +107,6 @@ inline TFLMRegistration Register_FULLY_CONNECTED_INT16() {
|
|
107
107
|
|
108
108
|
#endif
|
109
109
|
|
110
|
-
} // namespace
|
110
|
+
} // namespace tflite_micro
|
111
111
|
|
112
112
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_
|
@@ -19,12 +19,12 @@ limitations under the License.
|
|
19
19
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
20
20
|
#include "tensorflow/lite/c/common.h"
|
21
21
|
|
22
|
-
namespace
|
22
|
+
namespace tflite_micro {
|
23
23
|
|
24
24
|
extern const int kHardSwishInputTensor;
|
25
25
|
extern const int kHardSwishOutputTensor;
|
26
26
|
|
27
27
|
TfLiteStatus HardSwishPrepare(TfLiteContext* context, TfLiteNode* node);
|
28
|
-
} // namespace
|
28
|
+
} // namespace tflite_micro
|
29
29
|
|
30
30
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_HARD_SWISH_H_
|
@@ -22,7 +22,7 @@ limitations under the License.
|
|
22
22
|
#include "tensorflow/lite/micro/fake_micro_context.h"
|
23
23
|
#include "tensorflow/lite/micro/mock_micro_graph.h"
|
24
24
|
|
25
|
-
namespace
|
25
|
+
namespace tflite_micro {
|
26
26
|
namespace micro {
|
27
27
|
|
28
28
|
// Helper class to perform a simulated kernel (i.e. TFLMRegistration)
|
@@ -81,6 +81,6 @@ class KernelRunner {
|
|
81
81
|
};
|
82
82
|
|
83
83
|
} // namespace micro
|
84
|
-
} // namespace
|
84
|
+
} // namespace tflite_micro
|
85
85
|
|
86
86
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_RUNNER_H_
|
@@ -25,7 +25,7 @@ limitations under the License.
|
|
25
25
|
#include "tensorflow/lite/kernels/internal/types.h"
|
26
26
|
#include "tensorflow/lite/micro/micro_context.h"
|
27
27
|
|
28
|
-
namespace
|
28
|
+
namespace tflite_micro {
|
29
29
|
namespace micro {
|
30
30
|
|
31
31
|
TFLMRegistration RegisterOp(
|
@@ -145,6 +145,6 @@ TfLiteEvalTensor MakeUnpackedInt4Tensor(TfLiteContext* context,
|
|
145
145
|
int scratch_buffer_index,
|
146
146
|
const TfLiteEvalTensor* tensor);
|
147
147
|
} // namespace micro
|
148
|
-
} // namespace
|
148
|
+
} // namespace tflite_micro
|
149
149
|
|
150
150
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_UTIL_H_
|
@@ -18,7 +18,7 @@ limitations under the License.
|
|
18
18
|
|
19
19
|
#include "tensorflow/lite/c/common.h"
|
20
20
|
|
21
|
-
namespace
|
21
|
+
namespace tflite_micro {
|
22
22
|
|
23
23
|
// Input/output tensor index.
|
24
24
|
extern const int kInputTensor;
|
@@ -38,6 +38,6 @@ TfLiteStatus CalculateOpDataLeakyRelu(TfLiteContext* context, TfLiteNode* node);
|
|
38
38
|
|
39
39
|
TfLiteStatus LeakyReluPrepare(TfLiteContext* context, TfLiteNode* node);
|
40
40
|
|
41
|
-
} // namespace
|
41
|
+
} // namespace tflite_micro
|
42
42
|
|
43
43
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_LEAKY_RELU_H_
|
@@ -18,7 +18,7 @@ limitations under the License.
|
|
18
18
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
19
19
|
#include "tensorflow/lite/c/common.h"
|
20
20
|
|
21
|
-
namespace
|
21
|
+
namespace tflite_micro {
|
22
22
|
// Input/output tensor index.
|
23
23
|
extern const int kLogicalInputTensor1;
|
24
24
|
extern const int kLogicalInputTensor2;
|
@@ -30,6 +30,6 @@ TfLiteStatus LogicalImpl(TfLiteContext* context, TfLiteNode* node,
|
|
30
30
|
bool LogicalOr(bool x, bool y);
|
31
31
|
bool LogicalAnd(bool x, bool y);
|
32
32
|
|
33
|
-
} // namespace
|
33
|
+
} // namespace tflite_micro
|
34
34
|
|
35
35
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_LOGICAL_H_
|
@@ -21,7 +21,7 @@ limitations under the License.
|
|
21
21
|
#include "tensorflow/lite/c/builtin_op_data.h"
|
22
22
|
#include "tensorflow/lite/c/common.h"
|
23
23
|
|
24
|
-
namespace
|
24
|
+
namespace tflite_micro {
|
25
25
|
extern const int kLogisticInputTensor;
|
26
26
|
extern const int kLogisticOutputTensor;
|
27
27
|
|
@@ -38,5 +38,5 @@ TfLiteStatus CalculateArithmeticOpDataLogistic(TfLiteContext* context,
|
|
38
38
|
|
39
39
|
TfLiteStatus LogisticPrepare(TfLiteContext* context, TfLiteNode* node);
|
40
40
|
|
41
|
-
} // namespace
|
41
|
+
} // namespace tflite_micro
|
42
42
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_LOGISTIC_H_
|
@@ -28,7 +28,7 @@ limitations under the License.
|
|
28
28
|
#include "tensorflow/lite/micro/kernels/lstm_shared.h"
|
29
29
|
#include "tensorflow/lite/micro/micro_log.h"
|
30
30
|
|
31
|
-
namespace
|
31
|
+
namespace tflite_micro {
|
32
32
|
|
33
33
|
// Interface to access all the TempTfLiteTensors of the LSTM kernel during the
|
34
34
|
// preparation phase. Can only be constructed through the constructor to avoid
|
@@ -100,7 +100,7 @@ TfLiteStatus CreateGateParams(
|
|
100
100
|
const TfLiteTensor* hidden_state_bias,
|
101
101
|
/*Scale of the fc output (input to non-linear activation)*/
|
102
102
|
const float nonlinear_activation_input_scale, const TfLiteType cell_type,
|
103
|
-
const
|
103
|
+
const tflite_micro::GateParameters& gate_params);
|
104
104
|
|
105
105
|
// Create parameters for element wise multiplication that happens in a) cell
|
106
106
|
// state update ; b) hidden state update
|
@@ -108,7 +108,7 @@ TfLiteStatus CreateGateParams(
|
|
108
108
|
// are required for input. However, during the hidden state update phase, the
|
109
109
|
// output is the updated hidden state, which is asymmetrically quantized. Thus
|
110
110
|
// output may require zero point
|
111
|
-
|
111
|
+
tflite_micro::ArithmeticParams CreateInterGateMulParams(const float input1_scale,
|
112
112
|
const float input2_scale,
|
113
113
|
const float output_scale,
|
114
114
|
const TfLiteType output_type,
|
@@ -121,11 +121,11 @@ CellStateInfo CreateLstmCellStateInfo(const float cell_state_scale,
|
|
121
121
|
const float cell_clip);
|
122
122
|
|
123
123
|
CellStateInfo CreateLstmCellStateInfoFloat(const float cell_clip);
|
124
|
-
|
124
|
+
tflite_micro::FullyConnectedParams CreateFCParamsFloat();
|
125
125
|
|
126
|
-
|
126
|
+
tflite_micro::GateParameters CreateGateParamsFloat();
|
127
127
|
|
128
|
-
|
128
|
+
tflite_micro::ArithmeticParams CreateInterGateMulParamsFloat();
|
129
129
|
|
130
130
|
TfLiteStatus PrepareGateParametersFloat(TfLiteContext* context,
|
131
131
|
const LstmTensors& lstm_tensors,
|
@@ -267,29 +267,29 @@ void CalculateLstmGate(
|
|
267
267
|
const auto gate_output_shape = step_info.StateShape();
|
268
268
|
// Check offset validity to avoid memory overflow
|
269
269
|
TFLITE_DCHECK_LE(step_info.InputOffset() + step_info.InputShape().FlatSize(),
|
270
|
-
|
270
|
+
tflite_micro::micro::GetTensorShape(input).FlatSize());
|
271
271
|
TFLITE_DCHECK_LE(
|
272
272
|
step_info.HiddenStateOffset() + step_info.StateShape().FlatSize(),
|
273
|
-
|
273
|
+
tflite_micro::micro::GetTensorShape(recurrent).FlatSize());
|
274
274
|
|
275
275
|
// Input FC
|
276
276
|
FullyConnected(gate_params.input_fc_params, step_info.InputShape(),
|
277
|
-
|
277
|
+
tflite_micro::micro::GetTensorData<ActivationType>(input) +
|
278
278
|
step_info.InputOffset(),
|
279
279
|
micro::GetTensorShape(input_weight),
|
280
|
-
|
281
|
-
|
282
|
-
|
280
|
+
tflite_micro::micro::GetTensorData<WeightType>(input_weight),
|
281
|
+
tflite_micro::micro::GetTensorShape(input_bias),
|
282
|
+
tflite_micro::micro::GetOptionalTensorData<BiasType>(input_bias),
|
283
283
|
gate_output_shape, gate_output);
|
284
284
|
|
285
285
|
// Recurrent FC
|
286
286
|
FullyConnected(gate_params.recurrent_fc_params, step_info.StateShape(),
|
287
|
-
|
287
|
+
tflite_micro::micro::GetTensorData<ActivationType>(recurrent) +
|
288
288
|
step_info.HiddenStateOffset(),
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
289
|
+
tflite_micro::micro::GetTensorShape(recurrent_weight),
|
290
|
+
tflite_micro::micro::GetTensorData<WeightType>(recurrent_weight),
|
291
|
+
tflite_micro::micro::GetTensorShape(recurrent_bias),
|
292
|
+
tflite_micro::micro::GetOptionalTensorData<BiasType>(recurrent_bias),
|
293
293
|
gate_output_shape, fc_output_buffer);
|
294
294
|
|
295
295
|
AddElementWise(gate_output, fc_output_buffer,
|
@@ -329,31 +329,31 @@ void UpdateLstmCell(const LstmStepManager& step_info,
|
|
329
329
|
// Check offset validity to avoid memory overflow
|
330
330
|
TFLITE_DCHECK_LE(
|
331
331
|
step_info.CellStateOffset() + step_info.StateShape().FlatSize(),
|
332
|
-
|
332
|
+
tflite_micro::micro::GetTensorShape(cell_state).FlatSize());
|
333
333
|
|
334
334
|
auto cell_state_shape = step_info.StateShape();
|
335
335
|
// Forget Gate x Cell State
|
336
336
|
Mul(cell_state_shape, forget_cell_mul_params, forget_gate_output,
|
337
|
-
|
337
|
+
tflite_micro::micro::GetTensorData<CellType>(cell_state) +
|
338
338
|
step_info.CellStateOffset(),
|
339
|
-
|
339
|
+
tflite_micro::micro::GetTensorData<CellType>(cell_state) +
|
340
340
|
step_info.CellStateOffset());
|
341
341
|
// Input Gate x Cell Gate
|
342
342
|
Mul(cell_state_shape, input_mul_params, input_gate_output, cell_gate_output,
|
343
343
|
buffer);
|
344
344
|
|
345
345
|
// Update the cell state
|
346
|
-
AddElementWise(
|
346
|
+
AddElementWise(tflite_micro::micro::GetTensorData<CellType>(cell_state) +
|
347
347
|
step_info.CellStateOffset(),
|
348
348
|
buffer,
|
349
349
|
/*n_batch=*/cell_state_shape.DimsData()[0],
|
350
350
|
/*n_state=*/cell_state_shape.DimsData()[1],
|
351
|
-
|
351
|
+
tflite_micro::micro::GetTensorData<CellType>(cell_state) +
|
352
352
|
step_info.CellStateOffset());
|
353
353
|
|
354
354
|
if (cell_state_info.cell_clip > 0) {
|
355
355
|
Clipping(cell_state_shape.FlatSize(), cell_state_info,
|
356
|
-
|
356
|
+
tflite_micro::micro::GetTensorData<CellType>(cell_state) +
|
357
357
|
step_info.CellStateOffset());
|
358
358
|
}
|
359
359
|
}
|
@@ -371,21 +371,21 @@ void UpdateLstmHidden(const LstmStepManager& step_info,
|
|
371
371
|
// Check offset validity to avoid memory overflow
|
372
372
|
TFLITE_DCHECK_LE(
|
373
373
|
step_info.CellStateOffset() + step_info.StateShape().FlatSize(),
|
374
|
-
|
374
|
+
tflite_micro::micro::GetTensorShape(cell_state).FlatSize());
|
375
375
|
TFLITE_DCHECK_LE(
|
376
376
|
step_info.HiddenStateOffset() + step_info.StateShape().FlatSize(),
|
377
|
-
|
377
|
+
tflite_micro::micro::GetTensorShape(hidden_state).FlatSize());
|
378
378
|
|
379
379
|
auto cell_state_shape = step_info.StateShape();
|
380
380
|
CellType* cell_state_data =
|
381
|
-
|
381
|
+
tflite_micro::micro::GetTensorData<CellType>(cell_state) +
|
382
382
|
step_info.CellStateOffset();
|
383
383
|
// Tanh(cell_state)
|
384
384
|
Tanh(cell_state_scale_power, cell_state_shape, cell_state_data,
|
385
385
|
cell_state_shape, buffer);
|
386
386
|
// Update the hidden state
|
387
387
|
Mul(cell_state_shape, mul_params, buffer, output_gate_output,
|
388
|
-
|
388
|
+
tflite_micro::micro::GetTensorData<ActivationType>(hidden_state) +
|
389
389
|
step_info.HiddenStateOffset());
|
390
390
|
}
|
391
391
|
|
@@ -400,13 +400,13 @@ void LstmStep(const LstmStepManager& step_info, const OpDataLSTM& op_data,
|
|
400
400
|
CalculateLstmGate<ActivationType, WeightType, CellType, BiasType>(
|
401
401
|
step_info, op_data.forget_gate_parameters,
|
402
402
|
// Input FC
|
403
|
-
kernel_content.GetInternalTensor(
|
404
|
-
kernel_content.GetInternalTensor(
|
405
|
-
kernel_content.GetInternalTensor(
|
403
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputTensor),
|
404
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputToForgetWeightsTensor),
|
405
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmForgetGateBiasTensor),
|
406
406
|
// Recurrent FC
|
407
407
|
kernel_content.HiddenStateTensor(),
|
408
408
|
kernel_content.GetInternalTensor(
|
409
|
-
|
409
|
+
tflite_micro::kLstmRecurrentToForgetWeightsTensor),
|
410
410
|
/*recurrent_bias*/ nullptr,
|
411
411
|
// Output
|
412
412
|
forget_gate_output,
|
@@ -418,13 +418,13 @@ void LstmStep(const LstmStepManager& step_info, const OpDataLSTM& op_data,
|
|
418
418
|
CalculateLstmGate<ActivationType, WeightType, CellType, BiasType>(
|
419
419
|
step_info, op_data.input_gate_parameters,
|
420
420
|
// Input FC
|
421
|
-
kernel_content.GetInternalTensor(
|
422
|
-
kernel_content.GetInternalTensor(
|
423
|
-
kernel_content.GetInternalTensor(
|
421
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputTensor),
|
422
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputToInputWeightsTensor),
|
423
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputGateBiasTensor),
|
424
424
|
// Recurrent FC
|
425
425
|
kernel_content.HiddenStateTensor(),
|
426
426
|
kernel_content.GetInternalTensor(
|
427
|
-
|
427
|
+
tflite_micro::kLstmRecurrentToInputWeightsTensor),
|
428
428
|
/*recurrent_bias*/ nullptr,
|
429
429
|
// Output
|
430
430
|
input_gate_output,
|
@@ -436,13 +436,13 @@ void LstmStep(const LstmStepManager& step_info, const OpDataLSTM& op_data,
|
|
436
436
|
CalculateLstmGate<ActivationType, WeightType, CellType, BiasType>(
|
437
437
|
step_info, op_data.cell_gate_parameters,
|
438
438
|
// Input FC
|
439
|
-
kernel_content.GetInternalTensor(
|
440
|
-
kernel_content.GetInternalTensor(
|
441
|
-
kernel_content.GetInternalTensor(
|
439
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputTensor),
|
440
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputToCellWeightsTensor),
|
441
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmCellGateBiasTensor),
|
442
442
|
// Recurrent FC
|
443
443
|
kernel_content.HiddenStateTensor(),
|
444
444
|
kernel_content.GetInternalTensor(
|
445
|
-
|
445
|
+
tflite_micro::kLstmRecurrentToCellWeightsTensor),
|
446
446
|
/*recurrent_bias*/ nullptr,
|
447
447
|
// Output
|
448
448
|
cell_gate_output,
|
@@ -465,13 +465,13 @@ void LstmStep(const LstmStepManager& step_info, const OpDataLSTM& op_data,
|
|
465
465
|
CalculateLstmGate<ActivationType, WeightType, CellType, BiasType>(
|
466
466
|
step_info, op_data.output_gate_parameters,
|
467
467
|
// Input FC
|
468
|
-
kernel_content.GetInternalTensor(
|
469
|
-
kernel_content.GetInternalTensor(
|
470
|
-
kernel_content.GetInternalTensor(
|
468
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputTensor),
|
469
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmInputToOutputWeightsTensor),
|
470
|
+
kernel_content.GetInternalTensor(tflite_micro::kLstmOutputGateBiasTensor),
|
471
471
|
// Recurrent FC
|
472
472
|
kernel_content.HiddenStateTensor(),
|
473
473
|
kernel_content.GetInternalTensor(
|
474
|
-
|
474
|
+
tflite_micro::kLstmRecurrentToOutputWeightsTensor),
|
475
475
|
/*recurrent_bias*/ nullptr,
|
476
476
|
// Output
|
477
477
|
output_gate_output,
|
@@ -479,7 +479,7 @@ void LstmStep(const LstmStepManager& step_info, const OpDataLSTM& op_data,
|
|
479
479
|
gate_internal_buffer, kTfLiteActSigmoid);
|
480
480
|
|
481
481
|
CellType* tanh_activated_cell_buffer = buffers.buffer0; // reuse buffer
|
482
|
-
|
482
|
+
tflite_micro::lstm_internal::UpdateLstmHidden<CellType, ActivationType>(
|
483
483
|
step_info, kernel_content.CellStateTensor(),
|
484
484
|
kernel_content.HiddenStateTensor(), output_gate_output,
|
485
485
|
inter_gate_params.output_mul_params,
|
@@ -490,13 +490,13 @@ void LstmStep(const LstmStepManager& step_info, const OpDataLSTM& op_data,
|
|
490
490
|
// Check offset validity to avoid memory overflow
|
491
491
|
TFLITE_DCHECK_LE(
|
492
492
|
step_info.OutputOffset() + step_info.StateShape().FlatSize(),
|
493
|
-
|
493
|
+
tflite_micro::micro::GetTensorShape(kernel_content.output_tensor).FlatSize());
|
494
494
|
// record the output (from the updated hidden state)
|
495
|
-
ActivationType* output_ptr =
|
495
|
+
ActivationType* output_ptr = tflite_micro::micro::GetTensorData<ActivationType>(
|
496
496
|
kernel_content.output_tensor);
|
497
497
|
const auto* hidden_state = kernel_content.HiddenStateTensor();
|
498
498
|
std::memcpy(output_ptr + step_info.OutputOffset(),
|
499
|
-
|
499
|
+
tflite_micro::micro::GetTensorData<ActivationType>(hidden_state) +
|
500
500
|
step_info.HiddenStateOffset(),
|
501
501
|
step_info.StateShape().FlatSize() * sizeof(ActivationType));
|
502
502
|
}
|
@@ -536,6 +536,6 @@ TfLiteStatus EvalLstm(const OpDataLSTM& op_data,
|
|
536
536
|
}
|
537
537
|
return kTfLiteOk;
|
538
538
|
}
|
539
|
-
} // namespace
|
539
|
+
} // namespace tflite_micro
|
540
540
|
|
541
541
|
#endif // TENSORFLOW_LITE_MICRO_KERNELS_LSTM_EVAL_16ACT_H_
|