diff --git a/Tests/UnitTest/RefactoredTestGen/Lib/op_conv.py b/Tests/UnitTest/RefactoredTestGen/Lib/op_conv.py index 381d0e6d..58af9925 100644 --- a/Tests/UnitTest/RefactoredTestGen/Lib/op_conv.py +++ b/Tests/UnitTest/RefactoredTestGen/Lib/op_conv.py @@ -22,12 +22,6 @@ import keras import numpy as np -try: - import tflite_micro -except ModuleNotFoundError: - pass - - def generate_data(tflite_fname, params): tensors = {} effective_scales = {} @@ -41,6 +35,8 @@ def generate_data(tflite_fname, params): aliases["output"] = "output_ref" if params["tflite_generator"] == "json": + import tflite_micro # Only tflite_micro interpreter supports int4 convolution + interpreter = tflite_micro.runtime.Interpreter.from_file( model_path=str(tflite_fname), arena_size=params["arena_size"], intrepreter_config=tflite_micro.runtime.InterpreterConfig.kPreserveAllTensors) diff --git a/Tests/UnitTest/RefactoredTestGen/Lib/test.py b/Tests/UnitTest/RefactoredTestGen/Lib/test.py index d2d55150..16375765 100644 --- a/Tests/UnitTest/RefactoredTestGen/Lib/test.py +++ b/Tests/UnitTest/RefactoredTestGen/Lib/test.py @@ -52,10 +52,10 @@ def generate(params, args, fpaths): # Check if test is valid, skip otherwise if (params["interpreter"] == "tflite_runtime") and (not tflite_runtime_imported): - print("Skipping...") + print("Skipping due to tflite_runtime not being installed...") return if (params["interpreter"] == "tflite_micro") and (not tflite_micro_imported): - print("Skipping...") + print("Skipping due to tflite_micro not being installed...") return op_type = get_op_type(params["op_type"]) diff --git a/Tests/UnitTest/RefactoredTestGen/generate_test_data.py b/Tests/UnitTest/RefactoredTestGen/generate_test_data.py index 00e158fa..b5e4f241 100755 --- a/Tests/UnitTest/RefactoredTestGen/generate_test_data.py +++ b/Tests/UnitTest/RefactoredTestGen/generate_test_data.py @@ -53,7 +53,7 @@ def main(): parser.add_argument("--schema", type=pathlib.Path, - default="../../../tflite_micro/tensorflow/lite/schema/schema.fbs", + default="../../../tflite_micro/tensorflow/compiler/mlir/lite/schema/schema.fbs", help="Path to the schema-file needed for generating tflite-files with flatc") parser.add_argument("--list", action="store_true", help="Only list tests in test plan") diff --git a/Tests/UnitTest/RefactoredTestGen/test_plan.json b/Tests/UnitTest/RefactoredTestGen/test_plan.json index 75157ec8..61e283fb 100644 --- a/Tests/UnitTest/RefactoredTestGen/test_plan.json +++ b/Tests/UnitTest/RefactoredTestGen/test_plan.json @@ -551,7 +551,7 @@ "input_data_type": "int8_t", "weights_data_type": "int8_t", "bias_data_type": "int32_t", - "interpreter": "tensorflow", + "interpreter": "tflite_micro", "tflite_generator": "keras", "tests" : [ {"name" : "lstm_1", diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_bias.h new file mode 100644 index 00000000..5aee2c86 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_1_cell_gate_bias[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_bias_data.h deleted file mode 100644 index 43c4374a..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_bias_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_cell_gate_bias[11] = {-16190, 6797, 24062, 29971, -22780, 17656, 14698, 1849, 4054, 14590, -20709}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_hidden_weights.h new file mode 100644 index 00000000..1144554b --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_hidden_weights.h @@ -0,0 +1,12 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_cell_gate_hidden_weights[121] = { + 112, -105, -82, 46, 66, -73, 74, 110, 81, 100, -52, 58, 78, -51, -90, 33, 86, -34, 49, 52, 113, + -68, 41, 49, -103, -79, -59, -87, -26, 61, -32, 109, 35, 7, 88, -38, 48, 116, -119, 90, 87, -30, + -56, 100, 80, -22, -62, 56, 69, 118, 81, 98, 3, -100, -127, -83, 17, 57, 118, 119, -41, -78, 57, + 38, -93, -35, -106, 89, -10, 126, 27, 88, -94, -32, 39, -59, -125, -74, -107, -119, -80, 14, -58, 122, + 68, -45, 73, -7, -31, -82, 122, 63, 113, -62, -44, -117, -40, 56, 84, -38, 22, -84, 33, -87, -112, + -13, 63, -45, 118, -96, 98, -82, -96, 98, -88, -122, -110, -17, 4, -81, -64}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_input_weights.h new file mode 100644 index 00000000..7bc4e38f --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_gate_input_weights.h @@ -0,0 +1,19 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_cell_gate_input_weights[242] = { + -106, -106, 87, 27, 2, -44, -70, 63, -115, -118, 9, 48, 49, 51, 93, -68, -121, -42, -77, + -83, 0, 35, -1, 16, -25, -110, 108, -18, -2, 106, -114, -43, 17, 67, 80, -125, -70, -100, + -123, -107, -119, -4, -50, 49, -38, -29, -18, -22, 30, -4, -91, -126, 119, -107, -1, -72, 1, + 90, -112, 89, 117, -60, 91, 54, -122, -1, 72, 64, 100, -20, -90, -59, 84, 117, -62, -10, + -115, -4, 68, -127, -121, -51, -88, -35, 13, 40, 29, -103, 60, -90, -50, 83, 97, -29, 47, + -21, -8, -18, -4, -101, 42, -79, -71, -34, 18, 116, -46, -46, 102, 45, -43, 98, 38, -98, + 101, -29, 91, -42, 46, -62, 124, -9, -43, -30, -111, -68, 67, 45, -31, -13, 117, -77, -105, + -35, -57, 39, -64, 95, 91, -81, 28, -39, -90, 109, 126, 127, -41, 64, 36, -99, 127, -94, + 76, 76, 122, 19, 118, -1, 3, -109, -79, 60, 84, -29, 108, 66, 91, -45, 17, 58, -112, + 10, -29, 107, 73, -112, 1, 1, 114, 67, 124, -50, -32, 43, -65, 88, 98, -54, -14, -98, + -120, 3, 112, 53, 4, 122, -59, 64, -105, -65, -70, -66, 95, 39, 85, 42, 43, -58, -105, + -115, 95, -78, 45, 51, 22, -21, 84, -100, 49, 79, 28, -70, 77, -3, -25, -65, 34, -126, + 87, 101, 99, -116, 71, -5, -116, 126, -89, -34, -120, -13, 117, -120}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_norm_coeff_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_norm_coeff_data.h deleted file mode 100644 index 062bb680..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_norm_coeff_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t *lstm_1_cell_norm_coeff = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_state_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_state_data.h deleted file mode 100644 index 43589949..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_state_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -int16_t lstm_1_cell_state[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_forget_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_forget_data.h deleted file mode 100644 index c7df28f9..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_forget_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int16_t *lstm_1_cell_to_forget = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_input_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_input_data.h deleted file mode 100644 index a27ae43e..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_input_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int16_t *lstm_1_cell_to_input = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_output_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_output_data.h deleted file mode 100644 index 30aaf78d..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/cell_to_output_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int16_t *lstm_1_cell_to_output = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/config_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/config_data.h index 28263946..ea916ff7 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/config_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/config_data.h @@ -1,38 +1,34 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once -#define LSTM_1_BUFFER_SIZE 11 -#define LSTM_1_INPUT_BATCHES 1 -#define LSTM_1_DST_SIZE 110 +#define LSTM_1_TIME_MAJOR true +#define LSTM_1_BATCH_SIZE 1 #define LSTM_1_TIME_STEPS 10 -#define LSTM_1_NUMBER_UNITS 11 -#define LSTM_1_NUMBER_INPUTS 22 -#define LSTM_1_TIME_MAJOR 1 -#define LSTM_1_IN_ACTIVATION_MIN -32768 -#define LSTM_1_IN_ACTIVATION_MAX 32767 -#define LSTM_1_IN_TO_INPUT_MULTIPLIER 1075906048 -#define LSTM_1_IN_TO_INPUT_SHIFT -2 -#define LSTM_1_IN_TO_FORGET_MULTIPLIER 1085883136 -#define LSTM_1_IN_TO_FORGET_SHIFT -2 -#define LSTM_1_IN_TO_CELL_MULTIPLIER 1084231552 -#define LSTM_1_IN_TO_CELL_SHIFT -2 -#define LSTM_1_IN_TO_OUTPUT_MULTIPLIER 1085274240 -#define LSTM_1_IN_TO_OUTPUT_SHIFT -2 -#define LSTM_1_RECURRENT_TO_INPUT_MULTIPLIER 1523696256 -#define LSTM_1_RECURRENT_TO_INPUT_SHIFT -2 -#define LSTM_1_RECURRENT_TO_FORGET_MULTIPLIER 1511291392 -#define LSTM_1_RECURRENT_TO_FORGET_SHIFT -2 -#define LSTM_1_RECURRENT_TO_CELL_MULTIPLIER 1523716992 -#define LSTM_1_RECURRENT_TO_CELL_SHIFT -2 -#define LSTM_1_RECURRENT_TO_OUTPUT_MULTIPLIER 1525092864 -#define LSTM_1_RECURRENT_TO_OUTPUT_SHIFT -2 -#define LSTM_1_FORGET_MULTIPLIER 1073741824 -#define LSTM_1_FORGET_SHIFT -14 -#define LSTM_1_INPUT_MULTIPLIER 1073741824 -#define LSTM_1_INPUT_SHIFT -17 -#define LSTM_1_HIDDEN_MULTIPLIER 1522160019 -#define LSTM_1_HIDDEN_SHIFT -22 -#define LSTM_1_HIDDEN_OFFSET -23 -#define LSTM_1_DATA_OFFSET 128 -#define LSTM_1_OUTPUT_STATE_OFFSET -23 -#define LSTM_1_CELL_STATE_SHIFT -12 +#define LSTM_1_INPUT_SIZE 22 +#define LSTM_1_HIDDEN_SIZE 11 +#define LSTM_1_CELL_SCALE_POWER -14 +#define LSTM_1_INPUT_ZERO_POINT 128 +#define LSTM_1_OUTPUT_ZERO_POINT 1 +#define LSTM_1_CELL_CLIP 32767 +#define LSTM_1_FORGET_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_1_FORGET_TO_CELL_SHIFT -14 +#define LSTM_1_INPUT_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_1_INPUT_TO_CELL_SHIFT -15 +#define LSTM_1_OUTPUT_MULTIPLIER 1441324494 +#define LSTM_1_OUTPUT_SHIFT -22 +#define LSTM_1_OUTPUT_GATE_HIDDEN_MULTIPLIER 1611693952 +#define LSTM_1_OUTPUT_GATE_HIDDEN_SHIFT -2 +#define LSTM_1_CELL_GATE_HIDDEN_MULTIPLIER 1599350272 +#define LSTM_1_CELL_GATE_HIDDEN_SHIFT -2 +#define LSTM_1_FORGET_GATE_HIDDEN_MULTIPLIER 1591598720 +#define LSTM_1_FORGET_GATE_HIDDEN_SHIFT -2 +#define LSTM_1_INPUT_GATE_HIDDEN_MULTIPLIER 1584295680 +#define LSTM_1_INPUT_GATE_HIDDEN_SHIFT -2 +#define LSTM_1_OUTPUT_GATE_INPUT_MULTIPLIER 1080487424 +#define LSTM_1_OUTPUT_GATE_INPUT_SHIFT -2 +#define LSTM_1_CELL_GATE_INPUT_MULTIPLIER 1082850560 +#define LSTM_1_CELL_GATE_INPUT_SHIFT -2 +#define LSTM_1_FORGET_GATE_INPUT_MULTIPLIER 1084475904 +#define LSTM_1_FORGET_GATE_INPUT_SHIFT -2 +#define LSTM_1_INPUT_GATE_INPUT_MULTIPLIER 1080990464 +#define LSTM_1_INPUT_GATE_INPUT_SHIFT -2 diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_bias.h new file mode 100644 index 00000000..acac0fb4 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_1_forget_gate_bias[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_bias_data.h deleted file mode 100644 index f7adf487..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_forget_gate_bias[11] = - {-23170, -13466, -6110, 22504, -22652, 25549, -26211, -32267, 15774, -29318, 6943}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_hidden_weights.h new file mode 100644 index 00000000..8fd0f493 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_hidden_weights.h @@ -0,0 +1,12 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_forget_gate_hidden_weights[121] = { + 126, 19, 121, 74, -99, 46, 49, 98, 97, -53, -51, -60, -77, 84, 127, -97, 50, 43, -74, 73, 11, + 85, 36, 54, 123, -5, -17, 120, 11, 120, -97, -44, -111, 63, 12, 48, 56, 32, -10, 115, 25, -127, + -43, -122, 42, 100, 3, -36, 70, -17, 71, -109, -89, 38, -53, 91, -34, -34, -36, 41, 30, 0, -127, + 45, -112, 32, 42, 1, 48, 42, 92, -66, 57, 70, -54, 26, 96, -104, 104, 50, 2, 65, -15, 94, + -109, 62, -116, -107, -76, -50, 12, 55, 12, 59, 107, -107, 90, -15, -40, 38, -45, 32, -85, -120, -42, + -80, -80, -88, -111, 107, -57, -88, 67, 76, -71, 23, -30, -54, 20, 123, -50}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_input_weights.h new file mode 100644 index 00000000..0e13e922 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_gate_input_weights.h @@ -0,0 +1,19 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_forget_gate_input_weights[242] = { + -81, -33, -29, -20, 87, -58, -99, 83, -79, -56, 58, 89, -76, 94, 80, -32, 34, 40, -74, + -84, -61, 8, 15, 64, -38, -23, 33, -51, 8, 96, -80, -50, -53, 74, 50, 123, -120, 31, + 94, 78, 54, -3, -24, 36, -55, 71, -119, -66, -106, -35, -15, -77, 32, 70, 9, 66, 75, + 73, 62, 32, -111, -11, 41, 110, 12, -101, -103, 60, -10, -2, -59, 55, -22, -126, -11, -29, + -112, 39, 0, -46, 42, -70, -97, -21, 52, -50, 54, -39, -111, 24, 83, 6, 67, -66, 125, + 127, -104, 31, 5, -117, -76, 100, 89, 81, 122, 22, 33, -64, 90, 58, 9, 46, -59, 104, + -56, 16, 41, 0, 111, -102, -39, 115, -95, -5, -11, -30, -40, 118, -54, 81, -7, -116, 93, + -111, 82, -54, 72, -2, 86, 27, -104, 2, -91, 11, -55, -77, 2, -36, -36, -96, -55, 121, + -25, 35, -20, -16, -101, -82, -22, 26, -122, 106, 98, 9, -37, 95, -85, 76, 1, 49, -96, + 29, 66, -64, 37, 122, -35, -115, 65, 1, -25, 106, 53, -43, -22, 72, -83, -43, -13, -84, + -46, -125, -101, 89, 116, 102, -10, 48, 42, -45, -32, 4, 49, 43, 93, 52, 30, -95, -99, + 119, 114, 63, 99, -60, -70, -15, -34, 75, -64, 86, -6, 2, -1, -90, -22, 71, 57, 3, + -44, 73, -79, 4, -22, -89, -89, -117, 34, -43, 18, -4, 7, -55}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_norm_coeff_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/forget_norm_coeff_data.h deleted file mode 100644 index e70544d5..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/forget_norm_coeff_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t *lstm_1_forget_norm_coeff = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_data.h deleted file mode 100644 index ad595f7e..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_data.h +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_input[220] = { - 121, -117, 50, -102, -68, -103, 9, -120, 48, 53, 25, 69, -77, 15, -34, 32, -70, 29, -118, -58, - -92, -17, -109, 96, -113, -5, 87, 45, -116, 98, 98, -41, 31, 40, 27, 65, -115, 35, 47, -96, - 20, 30, 101, 70, -16, 102, 70, -117, -22, -45, 49, 29, -38, 111, 35, 76, -91, 71, 1, 23, - -69, -32, -85, 13, 39, -32, -123, 69, 24, 110, -1, 22, 112, -79, 73, 125, 68, 53, -16, 100, - 24, 20, -61, 79, 88, 94, 8, -61, 26, 13, 21, 99, -119, -12, -100, -46, 79, 10, 26, 96, - -78, 75, -18, -42, 0, 65, -124, 43, 91, 42, -62, -95, 80, 19, -85, -42, -128, -106, -21, -90, - -75, 66, 94, -10, -122, -55, -8, -126, 51, 8, -21, 71, -93, 67, -23, 88, 3, -50, 16, 124, - -9, -69, 114, 73, 116, 113, 83, -3, -101, 34, -113, -18, -101, 13, -48, 48, 63, 56, -114, 80, - 8, -20, -23, 63, 115, -83, -59, -72, -21, -57, -97, -6, 100, 82, 118, 83, 126, -111, 36, -114, - 89, -38, 54, 113, 36, -1, -119, -122, -23, -71, -82, 87, 44, 101, -13, -3, -102, -97, 42, 44, - 61, 31, -89, -6, -33, -57, 16, -16, -27, -20, -52, -104, 120, 30, -125, -9, 96, 67, 77, 125}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_bias.h new file mode 100644 index 00000000..c02ef93d --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_1_input_gate_bias[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_bias_data.h deleted file mode 100644 index ed45a535..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_bias_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_input_gate_bias[11] = {-32410, -104, 21567, -21097, 12535, 259, 8401, 10604, 24974, 30367, -9986}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_hidden_weights.h new file mode 100644 index 00000000..555eb9b5 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_hidden_weights.h @@ -0,0 +1,12 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_input_gate_hidden_weights[121] = { + -109, -8, -126, 9, -104, 117, -37, -81, 55, 105, -113, 61, -50, 113, 99, -79, 112, 55, 56, 94, -36, + 35, 35, -88, -11, 89, -115, 22, -76, -19, 24, 114, 103, -110, 28, -31, -24, 109, 105, -13, 56, 30, + 56, -6, 92, -40, 47, -115, -93, 82, 64, 43, 81, 29, 37, 86, 4, -113, 64, 63, -91, -26, -24, + 17, -1, -62, -90, -71, 17, 56, -112, -9, 12, -55, 107, 96, -111, 126, 67, -51, -90, -77, 116, 17, + 117, -63, 116, -123, 115, -2, -126, 13, -123, 2, 14, 116, -55, -127, 48, -97, -84, -30, -31, 51, 28, + -109, -28, 42, -32, 19, -36, 94, 100, -12, -83, -40, 23, -127, -91, 31, -20}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_input_weights.h new file mode 100644 index 00000000..eef60210 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/input_gate_input_weights.h @@ -0,0 +1,19 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_input_gate_input_weights[242] = { + -76, -123, 48, 68, 29, 32, -88, -120, -72, 77, 16, -123, -55, 0, 42, -1, -34, -105, -109, + -6, -112, -20, 9, 40, 86, -119, 80, 118, -71, 72, -46, -121, 41, 60, -2, 73, 53, -70, + -98, -8, 32, -113, -37, 99, 122, 6, -106, 32, -106, -2, -20, 107, 100, -120, -107, -28, 104, + -46, -104, -47, -57, 46, -111, -107, -101, -95, -110, -66, -73, -76, -62, -19, 95, 96, 113, -56, + 79, -50, -65, -15, 95, 14, 101, 40, -86, 25, 106, 4, -47, -108, -90, -85, 3, -75, -67, + -112, 35, -55, -99, 65, 45, -102, 85, -3, -68, -83, -80, 25, -103, 24, 54, -19, 3, 2, + 78, 42, -26, -22, 64, -66, -5, -92, -79, -47, -45, 102, -99, -18, -114, -115, 54, -82, -118, + -52, -42, 89, 21, -20, 89, -95, 39, 59, 103, -12, -75, 50, 92, 85, -51, -97, 30, 100, + -1, -127, 75, -98, 46, 114, 115, -80, 5, -63, -7, 48, 33, -88, -4, -98, -65, -57, 33, + 58, 12, -86, -96, 51, -100, -65, 34, -80, 15, -26, -39, -87, 93, 54, -31, -24, 75, -72, + 127, 119, 13, 46, 43, 33, -115, 105, 61, -73, -108, -42, 98, 48, 105, 14, 113, -61, -103, + -40, -30, 47, 13, -50, 23, -1, 4, 109, 122, -40, 124, 77, -109, -87, -15, 69, -56, 114, + -99, -72, -93, 29, 108, -92, 49, 6, -11, -62, -60, -39, -76, -49}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_norm_coeff_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_norm_coeff_data.h deleted file mode 100644 index 0b9ac91c..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_norm_coeff_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t *lstm_1_input_norm_coeff = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_tensor.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_tensor.h new file mode 100644 index 00000000..4fbb64dd --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/input_tensor.h @@ -0,0 +1,17 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_input_tensor[220] = { + 111, -58, -104, 106, -50, 10, 103, 111, -78, 8, -51, -13, -68, -60, -30, 85, 94, 58, -54, -46, + 26, -96, 78, 33, 8, 111, 114, -46, -93, 115, 89, -19, 0, -119, -78, 41, -72, 1, -16, -14, + -105, -41, 26, -114, 88, -91, 31, 25, 0, -57, -98, 126, 64, 98, -33, -119, 70, -48, -72, 77, + -102, 21, 43, -6, -115, 117, 34, -25, 109, -5, 43, -63, 43, 75, -100, -48, 26, 107, -126, 71, + -59, 45, -104, -52, 41, -57, 122, 48, 73, -89, -91, 23, 0, 104, -23, -44, -46, -17, 11, -85, + 27, 24, -75, 118, 35, -82, 22, 3, -116, -6, 80, -6, -61, -111, 121, -33, 11, -10, 36, -16, + 41, -70, -17, 26, 9, -120, -27, 24, 34, -126, -96, 103, -85, 67, -33, 87, -71, 2, 64, -28, + -18, 61, 19, 40, 67, -33, 108, 100, -59, -40, -48, -105, 95, 93, -117, -66, 96, -78, 32, -28, + 49, -10, -91, -51, -19, 35, -56, 30, -70, -52, -80, 75, -2, -119, 105, -101, -16, 17, 79, 74, + 2, 67, -82, 19, -15, -83, 43, 2, -100, -19, -32, 43, 35, -14, -110, -72, -34, -25, 79, -33, + -64, 106, 71, 58, -36, 21, -37, -65, -41, 6, 74, -80, -116, 81, 92, -24, -19, 2, -119, -83}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_cell_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_cell_eff_bias_data.h deleted file mode 100644 index a8c39211..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_cell_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_input_to_cell_eff_bias[11] = - {-70974, 15629, 50174, -12269, -26876, 14328, 56938, -90951, 37206, 49150, 37019}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_cell_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_cell_w_data.h deleted file mode 100644 index bce86cc3..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_cell_w_data.h +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_input_to_cell_w[242] = { - -112, 13, 117, -90, -36, -7, -41, 19, -90, 44, 121, -52, -58, -77, -18, 126, -63, -105, -45, -53, 88, - -109, -99, -26, -36, 64, -3, -127, -109, 114, 59, 108, -56, 26, 102, -100, -48, -11, -90, 81, 49, 94, - -30, 107, 63, 65, 66, -74, -24, -1, -57, -109, -26, -75, 48, 93, -51, 8, 76, 94, 66, -76, -58, - -15, 98, 93, -95, 45, -23, 104, 60, -13, -35, -73, 10, -8, -51, -43, -100, 55, 101, -53, -85, 12, - -93, 0, 14, -59, -49, -3, 3, -74, -107, -124, -85, 72, -30, 104, -57, 18, 114, -93, -72, 22, 65, - 120, -34, -5, 120, 63, 3, -93, 69, 27, -124, -13, -93, 84, 32, -5, 88, -49, 93, 2, -72, -56, - 101, -30, 21, -1, -64, 54, 108, -86, -12, -88, 102, 39, 80, -12, 39, -1, 108, 10, -28, 31, -62, - 5, -107, 102, 56, -26, 3, 69, 115, -103, -73, -52, -96, 27, 102, -127, -118, -22, 45, 20, -60, -53, - -20, -47, -52, 43, -66, -114, -74, 0, -66, 80, 103, 28, 84, -17, -85, -81, 10, 109, -5, -2, -76, - 17, 85, -17, -51, 92, 76, -21, 7, -11, -87, 48, -27, -9, 124, 15, 120, -123, 64, -71, -59, 32, - -35, 90, 112, 67, 13, 13, 6, -1, 67, -89, 7, 93, 18, 125, 121, 48, -13, -91, 41, 30, 31, - -91, 65, 114, -98, -88, -6, -48, 18, 50, 115, 10}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_forget_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_forget_eff_bias_data.h deleted file mode 100644 index aba8cb81..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_forget_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_input_to_forget_eff_bias[11] = - {19454, 742, -39262, 13544, -61308, 48333, 43165, -115211, -17250, -34822, 33823}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_forget_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_forget_w_data.h deleted file mode 100644 index fb6dab68..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_forget_w_data.h +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_input_to_forget_w[242] = { - 63, 63, 113, 40, -74, -51, -21, 79, -91, 95, 110, -57, -95, -80, -26, -40, 0, 87, -99, - 102, 93, 122, -96, 62, 14, 40, -90, 14, 125, 3, -2, 50, 113, -37, -109, 24, -22, 38, - 29, -80, 21, -80, 71, 23, -109, 107, 118, -109, -5, -62, 112, -24, 41, -24, -75, 57, -2, - 118, 111, -112, -125, -3, -22, -17, -123, -111, 114, -96, 66, -95, -123, 126, 20, -22, -47, 72, - -118, 50, -122, 18, 99, 70, -126, 3, 96, -74, -60, 79, -40, -115, -84, -83, 90, -77, -113, - 60, 10, -111, 40, 69, -89, -83, -34, 14, 3, -97, 97, 71, 72, 98, 73, 20, -31, -5, - 27, -79, -95, -44, -48, 123, 12, -95, -92, 17, 119, 25, 77, 127, 56, -4, 18, -23, 74, - 73, 12, 82, 69, 105, -106, 6, 51, 21, 32, 28, 116, 123, -118, -124, -47, -12, 66, 65, - 69, -43, -122, -67, 80, -112, -46, -24, -47, -1, -28, -73, -113, 116, -18, -81, -33, -18, 105, - -116, -71, -68, 63, 26, -98, -96, -46, 68, 64, 82, -10, 55, -95, -89, 62, -13, -84, 46, - -23, -75, 89, -41, 53, -21, -51, -35, 56, -116, 13, -74, 73, -75, 32, -55, -81, 74, 91, - 110, -78, 67, 22, 23, -92, 3, 66, -98, 87, -91, 89, -93, 37, 118, 124, 34, -61, 78, - 85, 18, -17, -14, -21, 3, -77, -63, -105, 126, 83, -78, 26, -82}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_input_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_input_eff_bias_data.h deleted file mode 100644 index 6773e43c..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_input_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_input_to_input_eff_bias[11] = - {-123034, -15592, 20415, -22377, 65527, -19069, 31697, -19220, 96526, 111007, 17534}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_input_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_input_w_data.h deleted file mode 100644 index 3431c7c9..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_input_w_data.h +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_input_to_input_w[242] = { - -83, -99, -16, -47, -67, 80, -5, -85, -11, -108, 1, -44, -66, -100, 127, -123, 56, -65, 13, - 93, -124, -35, -93, -67, 36, 71, -50, -75, -48, 2, -97, 5, 45, 91, 75, 2, -83, -112, - 85, -65, 107, 62, 25, -37, -111, -74, -80, -26, -18, 76, -15, 50, -120, 75, 104, -76, 21, - 31, 65, -30, -116, 117, 123, 105, -42, -68, 31, -41, -58, 114, -28, 46, -103, -80, 34, 89, - 5, -90, 11, 86, -9, -102, 90, -54, 27, -29, 15, 36, 26, 16, 27, 64, 3, 51, 69, - 61, -123, 118, 23, -23, 60, 125, -87, -52, -108, 83, 94, 4, 93, -110, -35, -96, 124, 73, - -24, -121, -88, -62, 7, 87, 111, 38, 123, -88, 59, -27, -106, -60, -9, -112, 70, -15, -31, - -5, 88, 124, -44, 78, -81, 39, 78, -67, -113, -17, 81, 10, 8, 2, -8, 6, 40, 5, - -14, 3, 108, 69, 39, 64, 85, 64, 21, 52, -115, -99, -20, -61, -102, -122, 55, 18, -98, - -36, 0, -95, -78, 18, -81, -4, 33, 78, -23, 30, 124, 41, 71, 106, 101, 59, -81, -46, - -26, 92, 49, -6, 97, -37, -111, 93, 67, 126, 63, -36, 12, -29, 100, 44, 16, 77, -47, - 105, -54, 115, 17, 19, 99, 37, 44, -66, 29, -108, -53, 87, -30, -77, -44, 123, -111, 71, - -42, 34, 14, 91, 12, 118, 74, 64, -106, 106, -1, 6, -102, -19}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_output_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_output_eff_bias_data.h deleted file mode 100644 index 9ba660c8..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_output_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_input_to_output_eff_bias[11] = - {-37894, 15877, 85451, -15991, 37318, 38600, -31336, -20295, -76464, 56669, -2404}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_output_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_output_w_data.h deleted file mode 100644 index ef8e04f1..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/input_to_output_w_data.h +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_input_to_output_w[242] = { - -59, 85, -25, 59, -52, -15, 21, -113, -114, -7, -16, -78, -58, -59, -20, -46, 24, 4, -69, - 56, 25, -13, 107, 48, -102, 24, -41, -75, 97, 70, 44, 17, -116, 54, -101, 10, 8, -36, - -66, -44, -111, 114, 22, 70, 62, 48, -16, -6, 67, 121, 55, -72, 120, 58, 80, -105, -98, - 51, 93, -115, 110, 79, -4, -18, -51, 11, 117, -62, -4, 93, 23, 32, -60, 42, -121, 54, - 54, -83, 63, 55, -35, -8, -76, -114, 24, -108, 81, 45, 44, -15, 100, 52, -22, 25, 23, - -48, -38, -30, -127, 69, 18, -4, 84, 97, 16, 61, -52, 20, 70, 39, 69, -78, 78, -43, - -110, 95, 94, -50, 77, -5, -78, 21, 23, -32, 46, 40, -105, 17, 65, 40, 12, 0, 30, - -88, 119, 123, -120, -118, 21, 33, -58, 73, -117, -52, -10, -93, 72, -16, 49, -114, -94, 10, - 15, -78, -120, 10, -90, -9, -94, -28, -76, 80, -91, -63, -10, 78, -24, 104, 71, -17, 27, - 122, -5, 46, 27, -120, -21, -51, -29, -63, -67, 96, -115, 24, -117, -127, -52, 59, 73, 3, - 49, 33, -47, -20, -12, -16, 28, -4, -79, -94, -96, 123, -120, -57, 13, -18, 28, -48, 68, - 102, 24, 114, -118, 124, 60, -41, 97, 78, 11, 40, 38, 120, -91, -86, 9, -94, 120, -60, - 98, -119, -50, 49, -43, -82, -6, -38, 113, -98, -25, 113, -27, -101}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output.h new file mode 100644 index 00000000..2ce072d1 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/output.h @@ -0,0 +1,11 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_output[110] = { + -2, -25, -29, -21, 3, -3, 19, 17, 9, -14, -7, -5, -64, -13, -42, 4, 50, -9, 17, 18, -82, 4, + -7, -105, -21, -9, 7, 0, -9, 15, 50, -103, 2, -5, -116, -5, -12, 11, 30, 65, 11, 73, -124, 1, + -14, -81, -2, -29, 15, 3, 93, 3, 35, -125, 1, -15, -113, -6, -53, 21, 21, 31, 4, 94, -128, -1, + -7, -127, -6, -46, 28, 13, 81, 12, 41, -128, 1, -2, -128, -3, -32, 29, 42, 81, 10, 82, -106, 1, + -4, -69, -6, -59, 29, 61, 10, 10, 54, -128, 1, -6, -109, -12, -27, 22, 52, 27, 7, 24, -76, -3}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_bias.h new file mode 100644 index 00000000..47010250 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_1_output_gate_bias[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_bias_data.h deleted file mode 100644 index 324e2dbc..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_output_gate_bias[11] = - {22266, 16773, 25291, -17527, -11578, 16072, 21528, 3001, -28336, 29661, 30876}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_hidden_weights.h new file mode 100644 index 00000000..c8e148f7 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_hidden_weights.h @@ -0,0 +1,12 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_output_gate_hidden_weights[121] = { + 65, -78, 24, -111, -46, 103, 85, 101, -29, 116, 47, 48, 113, -126, -118, 86, -101, -91, 89, 51, -100, + -4, -48, 11, 69, 45, 31, -27, -88, 98, 23, -105, 86, 80, -71, -39, 61, -93, -58, 80, 121, -29, + 80, -53, 85, -49, -57, -1, 43, -90, 55, -114, 120, 81, 45, -30, -14, -33, 55, -27, 81, 64, 59, + -17, -22, 69, -88, -99, -117, -96, -96, -35, 90, -94, 67, -75, 63, 52, 70, 34, -61, 99, 80, -98, + -126, 12, 90, 126, -40, -10, 103, -54, 25, -64, 19, -126, 23, -58, -109, -40, -65, 14, 100, -1, -125, + 56, -103, 62, 54, 106, -127, 43, 63, 16, -99, 45, -107, -7, -13, 112, -66}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_input_weights.h new file mode 100644 index 00000000..727d87fe --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/output_gate_input_weights.h @@ -0,0 +1,19 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_1_output_gate_input_weights[242] = { + 101, 0, -92, -70, 83, -115, 123, -79, -94, -49, 110, -41, 123, -13, 105, -113, 78, -91, 64, + -48, 37, 120, 55, -1, 62, -98, 48, -112, 126, 24, -49, 12, 48, -106, 87, -63, 64, 116, + -54, 87, -42, -50, 23, -78, 62, 103, -76, 111, -37, 7, 26, 0, -38, 92, -125, 75, -47, + 65, 14, -70, -79, 123, 0, -106, -116, 38, -36, 74, -48, -64, 117, 74, 34, 23, 13, 23, + 112, 34, 17, -127, 41, -62, 97, -17, -75, -32, -52, -73, 105, 72, -47, 32, -117, 74, 72, + 28, -1, -94, -56, 121, -15, 114, 10, 72, -20, 113, -73, -122, 82, 81, 118, 16, -112, 116, + -87, -35, 116, -108, 45, -123, 126, -33, 63, 102, -15, -69, 55, 118, 9, -68, 85, 115, -25, + -126, 108, -98, -18, 13, 127, 11, -122, 49, -117, -85, 35, 36, -56, 59, -73, -62, 127, 7, + 17, 59, 4, -82, -24, 116, -121, -101, -45, -10, -29, 16, 42, 24, -105, -66, 60, -53, -125, + 111, -102, 40, 24, -73, 70, 12, 111, -14, 10, -21, 1, -67, -21, -79, -127, -44, -93, 37, + 32, -40, -121, 65, 17, -44, 20, 68, 41, -20, 100, -18, 94, 22, -7, 56, 107, 83, 3, + -49, 6, 35, 82, 75, -115, -93, -60, -104, -59, 66, 25, -68, -102, -104, 116, -121, -12, 55, + 35, 2, -66, -59, -36, -86, -6, 103, -46, -118, 41, 80, -3, -58}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_norm_coeff_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_norm_coeff_data.h deleted file mode 100644 index 58db3fa0..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/output_norm_coeff_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t *lstm_1_output_norm_coeff = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_ref_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_ref_data.h deleted file mode 100644 index d0b3ac83..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/output_ref_data.h +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_output_ref[110] = { - -24, -26, 42, -30, -91, 13, 9, -29, -16, 74, -38, -24, 37, 46, -38, -25, -10, -9, -37, -12, 110, 47, - -25, 52, 113, -35, -15, -22, 36, -41, -16, 101, 81, -26, 78, 119, -27, -83, -54, 14, -31, -19, 127, 79, - -27, 98, 118, -25, 66, -48, 61, -36, -9, 127, 85, -29, 100, 104, -71, 36, -24, 40, -28, 21, 121, 60, - -26, 113, 127, -39, -50, -33, 15, -47, -3, 120, 52, -31, 118, 127, -59, 34, -65, 42, -42, -11, 100, 53, - -26, 84, 67, -47, 36, -65, 29, -40, -16, 58, 101, -29, 85, 116, -73, -12, -115, 32, -41, -1, 104, 56}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/output_state_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/output_state_data.h deleted file mode 100644 index 8c1d1a91..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/output_state_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -int8_t lstm_1_output_state[11] = {-23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/projection_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/projection_bias_data.h deleted file mode 100644 index 2cdf2f40..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/projection_bias_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t *lstm_1_projection_bias = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/projection_weights_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/projection_weights_data.h deleted file mode 100644 index daa15c33..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/projection_weights_data.h +++ /dev/null @@ -1,6 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t *lstm_1_projection_weights = NULL; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_cell_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_cell_w_data.h deleted file mode 100644 index 4ad4495f..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_cell_w_data.h +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_recurrent_input_to_cell_w[121] = { - 119, -7, -15, -96, -39, 87, -17, 17, 77, -113, 50, -26, 91, 53, 14, 56, 84, 73, -61, 118, -9, - -50, -72, 30, -72, -18, 41, 13, 14, 41, 26, 5, -40, -15, 94, -16, 80, -11, -66, -30, 25, -115, - -51, -93, -5, 41, 96, 97, -52, -101, 54, 16, -73, 96, -55, -63, -127, -9, -83, -114, 7, 32, 70, - -17, -70, -40, 116, -10, -9, 20, -36, -14, 40, 25, 127, -63, -18, 74, -51, -125, -53, 119, -83, 75, - 0, -77, -60, -10, 74, -54, -37, 92, -7, -105, -38, 52, 23, 20, 52, 39, -74, 50, -4, 62, -87, - 64, -62, 72, 37, -68, -14, 92, -111, -80, 24, 18, -86, -59, -32, 125, 15}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_forget_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_forget_w_data.h deleted file mode 100644 index f6ad4f00..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_forget_w_data.h +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_recurrent_input_to_forget_w[121] = { - 110, -108, -7, -84, 96, 93, -39, -46, -107, 73, 66, -74, 107, 49, 14, 27, 37, -74, -97, -69, 22, - 78, 47, 124, -103, -74, -120, -107, 71, 3, 81, 127, 86, 69, -68, 7, -119, -67, -9, 8, 60, 78, - 33, -59, 26, 64, 13, -51, 7, 0, 118, 37, 123, -104, -71, -18, 113, -107, -40, 33, 23, -42, -40, - 74, -57, 50, -22, -45, -120, 68, -11, -6, 36, 103, -73, 51, -3, -41, -22, -92, 92, -20, 122, -127, - -54, 73, 6, -47, -75, -74, 118, -19, -12, -97, 42, 31, -59, -45, -36, -108, 41, 91, -49, -1, -9, - 79, 68, 36, 13, -66, 102, 126, -3, -17, 58, -87, 120, 6, 68, 95, 65}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_input_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_input_w_data.h deleted file mode 100644 index ba796abf..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_input_w_data.h +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_recurrent_input_to_input_w[121] = { - 98, -54, 29, 95, -124, -26, 17, 6, 17, 65, -105, 24, -101, -115, 49, 15, -32, 100, 51, -54, 125, - -43, -47, 39, -76, -114, 61, -106, 38, -115, 7, 38, 111, 1, -28, 117, 93, 121, -103, -37, -88, 121, - 95, 65, 50, 121, -66, 28, -125, -30, -19, -15, -70, -59, -119, -107, -43, 122, -68, -123, -101, -22, 127, - 81, -63, -126, -96, 74, -111, -102, -127, 61, -12, -60, 91, -109, 24, 3, -86, 6, -19, -51, -48, -113, - -50, 16, -5, -31, -76, -14, -24, 47, 112, -6, -19, 54, 51, 21, 122, 117, 118, -9, 11, 121, -84, - -74, 86, -90, 66, 51, -19, 10, 94, -60, 75, 57, -84, -30, -22, -3, 55}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_output_w_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_output_w_data.h deleted file mode 100644 index 62b117c4..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_input_to_output_w_data.h +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int8_t lstm_1_recurrent_input_to_output_w[121] = { - 9, -100, 91, -34, 118, -95, 69, 47, 8, 79, 67, 6, 66, 122, -52, -3, 11, 57, -93, -70, 6, - 48, 7, 90, 44, -18, 74, -114, 57, -5, -110, 76, -117, -121, 59, -113, 68, 94, -64, 75, -81, 17, - -85, -65, -85, -13, -40, -5, -121, 26, -29, 54, -113, 37, -6, 127, -67, -12, 127, -23, -85, -32, 38, - 23, -123, 58, 108, -80, 68, -120, -101, 114, -107, 4, 84, 40, 85, -3, 123, 104, 125, -55, 91, 34, - -120, -80, -106, 9, -110, 48, 49, -36, 53, -94, 23, -23, -65, -26, -58, 82, -21, -20, 94, -31, 86, - 12, -89, 114, -62, 126, 27, 8, 45, -54, -122, 95, 7, -83, 19, 24, 44}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_cell_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_cell_eff_bias_data.h deleted file mode 100644 index 06b79d01..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_cell_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_recurrent_to_cell_eff_bias[11] = - {1449, 7889, -736, -4554, 2622, -9522, 4094, -4393, 1656, 667, -2484}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_forget_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_forget_eff_bias_data.h deleted file mode 100644 index 599b9096..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_forget_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_recurrent_to_forget_eff_bias[11] = - {1081, 460, 3105, -1541, 3726, -253, -506, -2530, -5198, 2185, 12259}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_input_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_input_eff_bias_data.h deleted file mode 100644 index 3de075dc..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_input_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_recurrent_to_input_eff_bias[11] = - {414, 437, -3772, 8211, -6992, -7429, -8441, -8694, 6164, 7199, 1679}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_output_eff_bias_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_output_eff_bias_data.h deleted file mode 100644 index 2f4d8378..00000000 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/recurrent_to_output_eff_bias_data.h +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#pragma once -#include - -const int32_t lstm_1_recurrent_to_output_eff_bias[11] = - {5957, 2254, -368, -4968, -6785, 713, 2185, 2806, -5497, 6693, 230}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1/test_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1/test_data.h index f1ab6ed2..ff07f2a6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1/test_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1/test_data.h @@ -1,36 +1,15 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#include "cell_gate_bias_data.h" -#include "cell_norm_coeff_data.h" -#include "cell_state_data.h" -#include "cell_to_forget_data.h" -#include "cell_to_input_data.h" -#include "cell_to_output_data.h" +#include "cell_gate_bias.h" +#include "cell_gate_hidden_weights.h" +#include "cell_gate_input_weights.h" #include "config_data.h" -#include "forget_gate_bias_data.h" -#include "forget_norm_coeff_data.h" -#include "input_data.h" -#include "input_gate_bias_data.h" -#include "input_norm_coeff_data.h" -#include "input_to_cell_eff_bias_data.h" -#include "input_to_cell_w_data.h" -#include "input_to_forget_eff_bias_data.h" -#include "input_to_forget_w_data.h" -#include "input_to_input_eff_bias_data.h" -#include "input_to_input_w_data.h" -#include "input_to_output_eff_bias_data.h" -#include "input_to_output_w_data.h" -#include "output_gate_bias_data.h" -#include "output_norm_coeff_data.h" -#include "output_ref_data.h" -#include "output_state_data.h" -#include "projection_bias_data.h" -#include "projection_weights_data.h" -#include "recurrent_input_to_cell_w_data.h" -#include "recurrent_input_to_forget_w_data.h" -#include "recurrent_input_to_input_w_data.h" -#include "recurrent_input_to_output_w_data.h" -#include "recurrent_to_cell_eff_bias_data.h" -#include "recurrent_to_forget_eff_bias_data.h" -#include "recurrent_to_input_eff_bias_data.h" -#include "recurrent_to_output_eff_bias_data.h" +#include "forget_gate_bias.h" +#include "forget_gate_hidden_weights.h" +#include "forget_gate_input_weights.h" +#include "input_gate_bias.h" +#include "input_gate_hidden_weights.h" +#include "input_gate_input_weights.h" +#include "input_tensor.h" +#include "output.h" +#include "output_gate_bias.h" +#include "output_gate_hidden_weights.h" +#include "output_gate_input_weights.h" diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_bias.h index 8306e32b..101e4669 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_bias.h @@ -1,7 +1,7 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int64_t lstm_1_s16_cell_gate_bias[11] = - {20142, 23563, 15741, 25098, 29041, 25327, 12730, 19511, 21749, 13563, 31032}; \ No newline at end of file + {2219, 19108, 17648, 18851, 8593, 23362, 27636, 15840, 9124, 25116, 25897}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_hidden_weights.h index ba8777b4..0a0b2334 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_hidden_weights.h @@ -1,12 +1,12 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_cell_gate_hidden_weights[121] = { - 99, -84, 84, -14, -61, 94, -60, 67, -85, 56, -108, 69, 53, -34, 103, 75, 97, -101, -84, -100, 89, - -105, 124, -83, 4, 42, -9, -18, 17, -32, -37, -117, 94, -105, 125, -92, 73, 122, -50, 31, -66, 123, - 2, 36, 118, -19, -98, 108, -67, -56, 77, 15, -61, -5, -25, -19, 106, -121, -102, -81, -54, 35, 80, - 39, -7, -115, 107, 38, 30, -28, 85, -12, 111, -124, 54, 0, -9, 39, -35, 102, -45, 22, 83, -39, - -94, -96, -60, 30, -101, 48, 108, -56, -78, -110, 13, 70, 49, -44, -75, -52, 78, 102, -57, -26, -97, - -95, 18, -77, -128, 50, -76, 37, -68, -63, 76, 107, 56, 115, -108, -74, 34}; \ No newline at end of file + 9, -42, -45, 73, -86, 69, -21, -68, 50, 62, -7, -48, -82, 84, 71, 40, 33, -12, 86, -97, -45, + 92, -127, 68, 11, -121, 71, -82, -35, -24, 35, 21, -94, -76, -106, 105, 94, 83, 45, 18, -33, 93, + 26, -34, -124, 80, -107, -120, 42, 113, -76, -76, 50, -52, -5, 25, 84, 81, 84, -42, 49, 92, -23, + -83, 69, -20, -62, 9, 36, -80, -90, 55, 2, -96, 109, -66, -3, -4, 47, -10, -88, 122, 4, 27, + 79, -96, -72, 110, -106, 93, -59, -18, 14, 20, -35, -77, 22, -108, -58, -124, 110, -4, 110, -32, -35, + 18, 95, 126, 30, 0, 11, -89, 51, -16, 17, 71, -116, -14, -73, -3, -126}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_input_weights.h index 83c21cc1..248a4193 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/cell_gate_input_weights.h @@ -1,19 +1,19 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_cell_gate_input_weights[242] = { - -66, 25, 6, 53, -50, 29, -127, -102, -15, 112, -13, 60, -87, -92, -108, 28, 81, -17, -16, - 54, -40, -109, -105, -60, -26, -71, -116, -76, -104, 48, 108, 118, 74, -124, 81, -111, -16, -117, - -91, 25, 38, 121, -19, -1, 109, 39, 77, -76, 99, 34, 2, 45, 26, 9, -111, -62, 73, - -127, 2, -8, -115, 110, -47, 114, -51, -23, 111, -84, -112, 27, -101, 13, 67, 95, 118, -46, - 37, -51, 116, -98, 87, 0, 109, 119, -102, -122, 79, 110, -47, -114, -121, -77, -45, -94, -1, - 5, -74, -40, -74, 41, -67, 16, -115, -20, 0, 27, 78, 29, -116, -114, -119, -43, -50, -31, - -121, -52, -42, -91, -24, -82, -24, -23, -106, 40, 62, -36, -102, 7, -79, -12, 56, 16, 79, - -29, -39, -74, 118, 6, -46, -115, 100, -38, 33, 70, 0, -41, 111, -28, 42, -9, -113, -22, - -15, -96, 81, -37, 88, -77, 47, 111, -39, 85, 79, 97, 62, -74, 91, -112, -62, 78, -5, - 52, -64, -97, 38, -98, 84, -88, -59, -2, -107, -91, 12, -56, 51, 32, 0, 78, -14, -14, - -7, 124, -85, -122, 52, 42, -9, 10, 19, 20, -8, 79, 104, 14, -56, 1, 124, 81, 69, - -20, -62, -105, -67, 69, -25, 88, -15, -108, 47, -111, -26, 87, 25, -98, 19, -4, 68, 4, - 47, -115, -18, -40, 87, 50, -79, -104, -122, -77, -64, 125, -93, -75}; \ No newline at end of file + 46, 34, -121, -34, -19, -63, 96, 43, 60, 83, 9, 28, -110, -113, -57, -6, -33, 12, -28, + -7, -44, 97, 50, 83, -19, -89, 114, -23, 71, -72, 36, 88, -3, 1, -100, -74, -1, 95, + 93, 3, 49, 68, 121, 52, -14, 24, -78, -18, -64, 14, 79, 118, -80, 60, -35, 63, -22, + -34, -66, -59, 71, -120, -94, 13, 81, -80, -104, -52, -78, -102, -123, -28, 126, -1, 50, 91, + -17, 79, -23, -104, 77, -106, 101, -37, -47, 108, -48, -19, 105, -51, 40, -9, -18, 95, 120, + 119, -25, 0, -122, -61, 103, 117, 44, -44, 108, -55, 10, 58, 90, -45, -27, -20, -95, 78, + 95, 100, 47, -28, 123, 107, -65, 94, -77, -121, 46, -42, 108, 28, -37, 39, 67, -62, -75, + 70, 84, 75, -57, 38, -90, 24, -40, -21, 107, 32, 14, -53, 1, 25, -20, -50, -75, 121, + -26, 14, 80, 23, 84, 8, -3, 38, -7, 101, 107, -61, -35, 12, -16, -16, 77, 82, -66, + -128, -98, -100, -112, -19, -17, -73, -119, 50, -8, 75, 4, 69, -52, 85, 13, -21, 26, -111, + -54, 44, 47, -3, -35, 73, -55, -67, 32, -86, 68, 107, 107, 71, 87, 42, 5, 38, 38, + -54, 63, 111, 43, 24, 112, 106, -13, -47, 106, 54, 35, 75, -19, -35, 61, -60, -25, -30, + -69, 59, 9, -4, 106, 97, -72, -87, -106, -124, -126, -122, -7, 59}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/config_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/config_data.h index a0b0925c..faea2026 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/config_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/config_data.h @@ -1,34 +1,34 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once -#define lstm_1_s16_time_major true -#define lstm_1_s16_batch_size 1 -#define lstm_1_s16_time_steps 10 -#define lstm_1_s16_input_size 22 -#define lstm_1_s16_hidden_size 11 -#define lstm_1_s16_cell_scale_power -9 -#define lstm_1_s16_output_zero_point 0 -#define lstm_1_s16_input_zero_point 0 -#define lstm_1_s16_cell_clip 32767 -#define lstm_1_s16_forget_to_cell_multiplier 1073741824 -#define lstm_1_s16_forget_to_cell_shift -14 -#define lstm_1_s16_input_to_cell_multiplier 1107260824 -#define lstm_1_s16_input_to_cell_shift -20 -#define lstm_1_s16_output_multiplier 1213629630 -#define lstm_1_s16_output_shift -16 -#define lstm_1_s16_output_gate_hidden_multiplier 1898861718 -#define lstm_1_s16_output_gate_hidden_shift -11 -#define lstm_1_s16_cell_gate_hidden_multiplier 1891079498 -#define lstm_1_s16_cell_gate_hidden_shift -11 -#define lstm_1_s16_forget_gate_hidden_multiplier 1103129707 -#define lstm_1_s16_forget_gate_hidden_shift -11 -#define lstm_1_s16_input_gate_hidden_multiplier 1470839610 -#define lstm_1_s16_input_gate_hidden_shift -12 -#define lstm_1_s16_output_gate_input_multiplier 1106912731 -#define lstm_1_s16_output_gate_input_shift -8 -#define lstm_1_s16_cell_gate_input_multiplier 1407915316 -#define lstm_1_s16_cell_gate_input_shift -11 -#define lstm_1_s16_forget_gate_input_multiplier 1606965412 -#define lstm_1_s16_forget_gate_input_shift -9 -#define lstm_1_s16_input_gate_input_multiplier 1177308497 -#define lstm_1_s16_input_gate_input_shift -8 +#define LSTM_1_S16_TIME_MAJOR true +#define LSTM_1_S16_BATCH_SIZE 1 +#define LSTM_1_S16_TIME_STEPS 10 +#define LSTM_1_S16_INPUT_SIZE 22 +#define LSTM_1_S16_HIDDEN_SIZE 11 +#define LSTM_1_S16_CELL_SCALE_POWER -9 +#define LSTM_1_S16_OUTPUT_ZERO_POINT 0 +#define LSTM_1_S16_INPUT_ZERO_POINT 0 +#define LSTM_1_S16_CELL_CLIP 32767 +#define LSTM_1_S16_FORGET_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_1_S16_FORGET_TO_CELL_SHIFT -14 +#define LSTM_1_S16_INPUT_TO_CELL_MULTIPLIER 1197688178 +#define LSTM_1_S16_INPUT_TO_CELL_SHIFT -20 +#define LSTM_1_S16_OUTPUT_MULTIPLIER 1351257732 +#define LSTM_1_S16_OUTPUT_SHIFT -19 +#define LSTM_1_S16_OUTPUT_GATE_HIDDEN_MULTIPLIER 1350737615 +#define LSTM_1_S16_OUTPUT_GATE_HIDDEN_SHIFT -8 +#define LSTM_1_S16_CELL_GATE_HIDDEN_MULTIPLIER 1114839066 +#define LSTM_1_S16_CELL_GATE_HIDDEN_SHIFT -9 +#define LSTM_1_S16_FORGET_GATE_HIDDEN_MULTIPLIER 1085133323 +#define LSTM_1_S16_FORGET_GATE_HIDDEN_SHIFT -8 +#define LSTM_1_S16_INPUT_GATE_HIDDEN_MULTIPLIER 1710701326 +#define LSTM_1_S16_INPUT_GATE_HIDDEN_SHIFT -8 +#define LSTM_1_S16_OUTPUT_GATE_INPUT_MULTIPLIER 1819526307 +#define LSTM_1_S16_OUTPUT_GATE_INPUT_SHIFT -12 +#define LSTM_1_S16_CELL_GATE_INPUT_MULTIPLIER 1951202553 +#define LSTM_1_S16_CELL_GATE_INPUT_SHIFT -10 +#define LSTM_1_S16_FORGET_GATE_INPUT_MULTIPLIER 1572134572 +#define LSTM_1_S16_FORGET_GATE_INPUT_SHIFT -9 +#define LSTM_1_S16_INPUT_GATE_INPUT_MULTIPLIER 1957187837 +#define LSTM_1_S16_INPUT_GATE_INPUT_SHIFT -9 diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_bias.h index bfa39ece..f9593814 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_bias.h @@ -1,6 +1,7 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_1_s16_forget_gate_bias[11] = {8691, 24230, 5069, 6375, 13615, 17184, 3326, 27937, 5850, 1018, 15410}; \ No newline at end of file +const int64_t lstm_1_s16_forget_gate_bias[11] = + {9708, 25603, 19505, 13324, 27023, 11390, 13461, 11823, 21776, 25576, 6262}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_hidden_weights.h index cc2f7476..34d323fc 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_hidden_weights.h @@ -1,12 +1,12 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_forget_gate_hidden_weights[121] = { - 59, 122, -110, 124, -13, 123, 42, 108, 71, -65, 116, -23, 62, -80, 96, 111, -27, 42, -34, -13, -39, - -119, 107, -44, -71, 91, 21, -28, 20, 96, -76, 23, 74, 23, -118, 95, -72, -47, 87, 111, -41, 68, - 7, 113, 66, 9, -36, 24, 126, -4, 2, -36, 52, 50, 108, 35, -22, 18, -114, -65, -16, -112, -52, - 35, 113, -77, 82, -120, 92, 61, -91, 104, -28, 74, -37, 55, -64, 106, -38, 48, -105, -127, -8, -110, - -109, -42, -71, 121, -24, -3, 30, -40, -29, -111, -63, 66, 119, 25, -75, -52, 93, -50, 15, -107, -11, - -108, -43, 23, 50, 45, 7, -90, 13, -125, 98, -118, -9, 125, -80, -66, -14}; \ No newline at end of file + -94, 35, -33, -97, 1, -106, -99, -85, 28, 24, -72, 118, 19, -116, -25, 90, 2, -1, 14, -110, -15, + 78, -27, -42, 56, 31, 8, 103, 89, -105, 32, 105, 85, 95, -99, -48, 61, 102, 31, 34, -63, -97, + 34, 38, 119, 99, 76, -4, -115, -54, 88, 59, -104, -87, -34, -87, 22, -117, 34, -39, 58, -97, 81, + 63, -115, -58, -38, -62, 69, -8, 3, -20, -79, -57, 69, -10, -17, 30, 45, 102, -51, 80, 14, 95, + -40, 16, -85, 92, 53, 8, -69, 31, -36, 122, 3, 50, 96, -71, 123, -1, 92, -88, 62, 70, 30, + -101, -2, 60, -79, -105, 57, -92, -12, -84, -91, 86, -124, -16, 80, -60, 55}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_input_weights.h index 2537dcfa..915f380a 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/forget_gate_input_weights.h @@ -1,19 +1,19 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_forget_gate_input_weights[242] = { - -56, -78, 96, -62, -38, -48, -92, -47, 4, 121, -38, -82, -39, 55, -53, -15, 53, -19, 89, - 77, -28, 73, 22, 112, 18, 71, -27, -110, -16, 16, -119, -33, 1, -52, -16, 92, -21, -7, - 108, -75, -16, 44, -55, -70, -106, -37, 40, 60, 86, -120, 80, -103, 25, -121, 27, -23, 57, - -39, -101, 111, 2, 25, 77, 4, -69, 13, 104, -64, -4, -3, 79, -114, -68, -57, -74, 103, - -120, -87, 112, -59, 44, 27, 49, -87, -37, 121, -83, -74, -109, 75, 28, 102, 110, -11, -113, - -30, -65, -86, 59, -125, -95, -76, 121, 31, 90, 123, -76, -15, -100, 39, 21, 117, 40, -106, - -72, 5, 83, -11, -121, 123, 52, 123, -77, 12, 23, 22, 44, 98, -50, 58, -48, 90, 78, - 125, -32, 7, -81, 18, 116, 38, 81, -14, 23, 77, -90, 109, -3, 52, -21, -40, -105, -121, - 10, -11, 38, 38, 21, -71, -97, -41, 99, -7, 31, 9, -23, -78, 58, -31, 19, -98, -63, - -19, -95, -10, 23, -35, -116, -74, -72, -91, 119, 62, -111, -120, -114, -117, 100, 90, -87, -20, - -6, -49, 66, 34, 54, -73, -76, 95, -73, 40, 95, 39, 64, 44, -109, 40, 15, -40, -94, - 6, -45, 54, 40, 45, 69, -103, 88, 112, 85, -63, -127, 3, -30, -78, -80, -118, 100, 83, - -94, 23, 24, -33, 23, -78, 37, 47, -3, 26, -108, 81, -86, 107}; \ No newline at end of file + 68, 109, 76, 42, 46, -120, -74, -42, -111, 119, -29, 89, 126, 100, -78, -70, -17, 1, -19, + 83, -5, -23, -81, 43, -39, 23, -104, -29, 63, 9, 35, -39, 43, -37, -18, 73, -98, 10, + -7, -36, 51, -24, 40, -1, -7, -78, -70, -6, 31, 15, -22, 59, 85, -128, -73, 63, -7, + -124, 60, -76, 11, 50, -102, -22, 39, -59, 72, 89, 110, -2, 83, 99, -125, -39, 56, 18, + 92, -66, -120, -38, 67, 10, -99, -24, -49, -127, -38, -11, 23, -77, -75, -90, -17, -90, 104, + 12, -93, 19, -30, -51, -39, 7, -88, -8, -110, -43, 116, -124, -84, 98, 77, 42, 109, -2, + -19, -113, 6, -85, 79, 77, 94, 84, -127, 107, 100, 28, -107, -103, -122, 32, 28, 76, 58, + 87, -79, -67, 48, 54, -66, -40, -109, 86, -70, 102, 47, 111, -14, 87, 106, 32, -31, 4, + -109, -101, -63, 93, -112, 115, -114, 75, 93, -88, 67, 118, -61, 126, 83, 93, 12, 100, -34, + 93, -56, -28, 61, -13, -55, -120, 18, -107, 52, 12, 104, 32, 101, -55, -51, -123, 35, -48, + 76, -36, 102, -14, -35, -8, -81, -100, 56, 46, 20, -109, -37, 25, 71, 94, 112, -46, -37, + 66, 31, -66, -99, 98, 104, 27, 2, -111, 48, 48, 28, -73, -103, 122, 81, 53, 37, -71, + -112, 77, 7, 42, 47, 111, 86, 83, 57, -3, -66, 3, 61, -74}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_bias.h index 5573eb00..44a4540e 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_1_s16_input_gate_bias[11] = {13543, 1638, 25244, 3970, 6981, 29954, 4375, 16836, 30316, 6762, 4189}; \ No newline at end of file +const int64_t lstm_1_s16_input_gate_bias[11] = {4446, 889, 1522, 4229, 26084, 21921, 6510, 10899, 17648, 30456, 14799}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_hidden_weights.h index 17652417..9a36d556 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_hidden_weights.h @@ -1,12 +1,12 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_input_gate_hidden_weights[121] = { - 110, -92, 49, 101, -32, -85, -5, -7, -92, 90, -52, -116, 2, -16, -70, -43, -93, 9, 62, 4, 24, - 104, -36, 35, -21, -50, -92, 90, -14, -49, -60, 63, -36, -22, -121, -47, 65, 93, -121, 107, -87, 36, - -122, -118, 21, 13, -75, -3, -39, -39, 24, -82, 4, 38, 122, -59, 2, 89, 20, 68, -65, 27, 95, - -123, -61, 84, 22, -111, 106, -66, -24, 51, -75, -83, 53, 19, -79, 6, 12, -19, 0, -4, 19, 122, - -101, -56, -1, 46, -12, 34, -128, 75, 90, -67, -108, -121, -13, 89, -24, 42, -108, 12, -20, -75, 19, - -43, -44, -83, 97, -41, -58, -9, -19, -107, 54, 21, 27, 59, -49, -13, 87}; \ No newline at end of file + 36, 0, -59, -70, -31, 80, -105, 90, -31, -90, 91, 123, 124, -114, 84, 107, -125, -89, -34, 22, 39, + 122, 94, -99, -34, 33, 6, 111, 22, -53, 121, -108, -60, 0, -53, 122, 82, -44, -31, 101, 4, 100, + 45, -34, -2, 53, 67, 47, -64, -80, -79, 126, -93, -18, 83, 65, 8, 8, 24, 6, -6, -100, 46, + 114, 91, 44, -31, -47, 75, 11, -17, -114, -36, -98, -80, 33, 57, -50, -47, -105, -25, 117, 19, 37, + 92, -66, -113, 57, 100, 27, -93, 65, 71, -77, -39, -89, 74, 84, 73, 42, -42, 48, -39, -119, 73, + -2, 90, 35, -43, -121, -67, 87, 117, 13, -50, -48, -17, 37, 111, -41, 121}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_input_weights.h index 74548f4e..158dd0a8 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_gate_input_weights.h @@ -1,19 +1,19 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_input_gate_input_weights[242] = { - 58, -27, -78, 32, -77, -64, -79, 118, 59, -60, -38, 27, 48, -27, -79, -4, 110, -126, -20, - -119, 29, 76, 63, -63, 26, -108, -87, 29, 80, -52, 87, -3, 24, 36, 32, 53, 75, -113, - -83, 107, 41, 108, -54, 30, 115, 7, -60, -38, -106, -50, -114, -15, -112, 75, -21, -55, -3, - -28, -73, 26, 126, 34, 116, -126, 72, -63, 106, -25, -73, 65, 63, -19, -112, -45, 107, 65, - -55, -48, 74, 66, -117, 108, 110, 95, -86, 29, 34, -43, 121, 82, 43, -63, 66, 77, 122, - 10, -24, -115, -112, -60, 118, 19, -61, 85, -97, -85, 5, -41, 24, 93, 58, 58, 2, 99, - 38, 6, -88, 30, 114, -20, -104, 44, 98, -68, 35, -23, -68, 11, -104, -33, 54, -10, -106, - 6, 118, 15, 64, 29, -111, 109, -5, 43, 37, 99, -96, 86, 119, 54, 36, -112, 126, -120, - 92, 79, 120, -25, 38, -44, -70, -77, 110, 65, -110, 23, -104, -81, -104, 94, -45, -112, 40, - 69, -46, 22, -32, 45, -56, 93, -92, -30, -61, 55, 47, 15, 117, -113, 11, 22, 28, -118, - 0, -42, -119, 29, 123, -17, -51, -99, -91, 120, -1, -29, -99, -117, 93, 91, 91, -68, -65, - -88, 87, 77, -35, 27, 58, 71, -33, -58, 69, 119, 94, 112, 72, 57, 78, -42, 100, 84, - -112, 45, 25, 8, 30, -19, -83, 8, 79, 124, -88, -119, 92, 81}; \ No newline at end of file + 2, 121, -17, -40, 102, 72, 116, 5, 96, -39, -127, -27, -78, -54, -83, 48, -92, -117, 112, + -80, -87, 53, 3, 46, 0, 76, 117, 72, -78, -104, 70, -122, 46, 96, 69, -66, -24, -122, + -29, 88, -85, 2, 17, 60, -110, 102, 98, 96, -30, -83, 114, -32, -56, -1, -127, -54, -17, + -118, -12, 63, 8, -108, -74, -30, 46, 63, 87, 79, 65, -69, -23, -90, -55, -112, 122, -33, + 43, 66, -83, 71, 65, -54, 26, 56, 32, 85, -105, -55, -115, 98, 120, -109, -66, -111, -90, + -82, -15, 61, 94, -35, -110, -111, 24, -63, -87, -128, 34, -64, 50, 93, 38, 115, -31, -85, + 11, -109, 115, 120, -72, -76, 3, 2, -73, -83, -90, 36, 54, 70, 30, 40, 6, 112, -85, + -116, 38, 39, 76, 80, 70, 25, -20, 68, -26, -52, 12, 18, 57, -128, -98, 79, -121, -12, + 66, -18, -20, -73, 113, 25, 74, -71, -120, -94, -32, 13, -75, -52, -42, 5, -3, 17, 110, + 10, -109, -5, 113, 61, 74, 18, 16, 120, -32, 45, -41, -7, 88, -105, 109, -43, -86, 88, + -71, 76, 32, -70, -124, 43, -28, 14, -89, -55, 53, 107, -46, 0, 56, 68, -45, 69, 109, + 35, 4, -127, 67, -118, 12, -25, 66, -13, -83, -122, -46, 42, -40, 28, -79, -59, -4, -53, + 61, -112, 34, 42, 56, -110, 2, -56, -116, 3, -40, -113, 116, 26}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_tensor.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_tensor.h new file mode 100644 index 00000000..42adead5 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/input_tensor.h @@ -0,0 +1,22 @@ +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int16_t lstm_1_s16_input_tensor[220] = { + -14750, -14805, 17093, -12191, -6630, 489, 2111, -25494, 26873, 1611, -20129, -29251, 11289, 25676, + -11983, -14433, 24058, 16855, -9371, -30095, 21004, 12580, 18091, 25281, 18880, -22969, 380, 25436, + -18891, -12313, -3409, -5634, -1305, -31724, -6925, 10829, -24743, -29679, 28502, 4333, -4253, 28177, + 7538, 14825, -31023, 19510, 7188, -14960, 23634, 5775, 21652, 581, -17125, 9466, -23357, 8765, + 8447, -31209, 21299, -7566, 21654, -21553, 12301, -26100, 11835, 17951, -13170, 1038, 30922, -29895, + 13956, 7882, -4268, -1765, 665, 15847, 28417, -32409, 24335, -14724, 24806, 1353, -314, 15297, + 8159, 4008, 12012, -4768, -20738, -12838, -17567, 12480, 31111, -18996, -22516, 28916, 11803, -11757, + -10021, 19160, 22397, 17395, 19624, 18763, -6126, -4252, 32729, 19807, 22573, 22953, -23774, 19288, + 17744, -18043, 1325, 11487, -26278, -8640, -28760, -7121, -10941, 1189, -1804, -10987, 27975, 361, + -13259, -7394, 21024, 2605, 8408, -8366, -1325, 25043, -2990, -15347, 9700, 22019, 8344, -3365, + 7818, 21961, 4788, 30638, 32273, -16744, 23628, 21307, -17421, 11289, -8934, -27361, -32627, 27056, + -18022, 1049, -2546, 4228, 23162, 5348, -23611, 18955, -15975, -31843, 11838, -19023, 26685, 8248, + -14336, -10138, -21780, -23116, -11152, 4524, -1529, -22901, -4250, -10339, 22152, -22044, 28922, -22935, + 1798, 45, -25135, -13494, 9138, 18543, -23685, 31372, -30170, -7753, -13352, 32104, 9443, 3579, + 29783, 18420, -22878, -14696, -8789, 5085, 26883, -28962, -17577, 12094, -16948, -6294, 24339, 21377, + 18558, -15416, 28559, -32237, -12586, -3991, -24951, -1818, 29439, -5549}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output.h index 0c867fb9..6013993c 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output.h @@ -1,13 +1,12 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int16_t lstm_1_s16_output[110] = { - -318, 2734, 1144, 2729, -1234, 1629, -44, 1369, -8, -10, 15, -19, 384, 2444, 1079, 0, - 713, -162, 252, -19, -542, 164, 109, 100, -2191, 24, 0, 189, -2293, -456, 9, -460, - 1051, 470, 120, -4504, 259, -2564, 146, -2036, 971, 1754, 332, -2445, 923, -257, -1112, -1547, - -69, 797, -954, -2815, 35, -2393, -4818, 672, 4690, -181, -146, -536, -84, -917, -190, -3255, - 0, -1013, 1482, 328, -3916, -83, -1429, -2188, -215, -7, -2003, 825, -32, -1072, -341, -260, - -8, -758, 1097, 1027, -1, -1078, 11, -46, -134, -1857, -194, -561, 1380, -1835, -30, -65, - 0, -10, 236, -171, -1609, -2539, -1146, -348, -81, -275, 52, -7, 2, -1087}; \ No newline at end of file + -174, -22, -368, -146, 280, -5, -387, -409, -173, 10, 389, -250, 546, -74, -477, 637, -367, -299, -396, + -491, 10, 32, 120, 539, 391, -135, 517, 498, -271, -266, -511, 207, 246, 1, 360, -19, -181, 269, + 105, 238, -347, -352, 574, -43, -244, 170, -90, -42, 117, 83, 76, -447, -111, 233, -202, -472, 87, + -339, -206, -395, -82, 227, -216, -46, -488, -161, 335, 116, -295, -117, -456, 48, 318, -267, -9, -434, + 294, -32, -377, -304, -138, -196, -74, 537, 175, 275, -292, 504, -54, 79, -90, -359, -362, -547, -256, + -589, -117, -137, 377, -59, -436, 134, -147, -507, -521, 525, -514, -55, 131, 502}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_bias.h index a4a36292..c4615150 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_bias.h @@ -1,7 +1,7 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int64_t lstm_1_s16_output_gate_bias[11] = - {8300, 1579, 11812, 11224, 18423, 11748, 9932, 26717, 23831, 11737, 10113}; \ No newline at end of file + {3386, 25702, 22854, 31977, 23431, 1826, 7498, 17318, 6993, 10245, 30917}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_hidden_weights.h index 41efc9b4..db682b33 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_hidden_weights.h @@ -1,12 +1,12 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_output_gate_hidden_weights[121] = { - -45, -67, -20, 112, -54, 13, 107, 74, -96, -111, 120, -102, -12, -21, 123, 62, 98, -19, -12, 32, -55, - 72, 59, -34, 40, 13, -89, 27, 72, -119, 96, 119, 26, -37, 64, 110, 45, -99, 86, -101, -7, -12, - 80, 80, 1, 13, 114, -24, -96, 67, -17, 92, 8, 43, 28, 97, 85, -69, -112, -82, 125, -13, -84, - -16, 67, 79, 55, 29, -64, -127, 14, -26, -67, -11, 21, -44, -16, 27, 5, 95, -120, -126, -33, 67, - 25, -112, 44, 16, -80, -8, -119, 63, -63, 124, 80, 24, 8, 96, -112, 82, -3, -43, 94, -83, 120, - 10, 8, -128, 108, -126, -63, 82, 52, -68, -51, -98, 66, -86, 114, -47, 46}; \ No newline at end of file + -56, 99, 51, 100, 82, 39, 99, -66, 33, -31, 97, 35, 18, -24, -76, 44, -100, -40, -71, 10, -109, + -63, 96, 57, -90, -38, -8, 90, 20, -45, -7, 38, -52, 18, 71, -71, -100, -60, -93, 33, 95, 121, + -4, 63, -41, 0, -105, 92, -14, -35, -91, 123, -74, 5, 11, -9, -84, -14, 57, 74, 116, 13, -24, + -34, 4, -44, 100, -125, -58, 9, 103, -60, -99, -50, 95, -111, -94, -53, -32, 92, -80, 37, 0, 88, + 25, -106, -20, -22, -11, 125, 83, -8, 73, 29, 88, 72, -70, -113, 106, 39, 116, -100, -27, -61, 59, + 9, -44, -93, -8, 65, -16, -69, -77, 6, -29, 41, 41, 89, 91, -44, -54}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_input_weights.h index 0b7e3439..d47e2b33 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/output_gate_input_weights.h @@ -1,18 +1,19 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_1_s16_output_gate_input_weights[242] = { - -33, 89, 114, -9, -30, -112, -117, -4, 78, -28, 94, -22, 47, 73, 54, 28, -59, -96, -107, -22, -51, - -1, -21, 61, 38, 118, 112, 18, -63, 111, -95, 100, 78, -78, -31, 21, -23, 12, 126, 122, 86, 12, - 12, 107, 57, -75, 20, -74, -105, 53, 25, -110, -35, -62, -5, 87, 123, -31, -92, 72, -112, -26, 90, - -83, 101, -80, 44, -1, 80, 22, -30, -122, -97, 46, 29, 52, 19, 117, 89, -105, -16, 66, -39, 32, - -108, 81, -83, 29, 107, -119, -30, 77, 11, 53, 101, -8, 99, 90, 85, -26, 30, -26, -10, -40, -45, - -118, -98, -71, 1, 11, 85, -62, -97, 117, 56, 29, -62, -90, -81, -62, -27, 23, 124, -84, -18, -88, - 72, -84, 1, -34, -76, -27, -57, -46, 123, -118, -58, 42, 108, -46, -91, 13, 87, -127, -18, -57, 68, - -73, -49, -20, -24, 111, 19, 84, -96, -38, 66, -45, -14, -47, 78, 13, -19, 17, -65, 32, 90, -45, - 86, -79, 28, 124, -96, -56, -102, 35, -67, -101, 106, 100, 79, 112, 19, 66, 53, -58, -28, -15, 50, - -62, 54, 5, -52, -91, -122, -34, -111, 69, 83, 83, 39, -69, -98, 99, -88, -122, 18, 67, -48, 110, - -63, -93, 5, 71, 117, -83, -9, 75, -43, -101, -108, -54, 43, 2, -101, -68, 26, -24, 81, -12, -111, - -40, -54, 37, 63, 51, -11, 4, 61, 41, 70, -63}; \ No newline at end of file + -115, -80, -74, 24, -124, 62, -7, 24, -38, 102, -125, 78, 81, 50, 51, 90, 51, -56, -1, + 3, 1, 5, 86, 120, 10, -102, -114, 69, 95, 29, -107, 111, 74, -44, -20, -79, 123, -101, + 76, -97, 74, -39, 8, 8, -36, 4, -14, 107, -76, -85, -93, -57, -36, -96, -107, 22, 64, + -49, -85, -119, -33, -4, -105, 118, -21, -16, 22, 100, 73, 122, -122, -55, -90, -97, 121, -88, + -16, -127, 16, -116, -127, 13, 41, 68, -105, -88, 35, -127, 94, 91, -51, 23, -28, 48, -125, + 107, -56, -104, 79, -119, 106, -31, 15, -98, 63, -62, 55, 97, -22, 102, 3, -16, 8, 48, + 105, 11, -83, 14, -89, 17, 74, 2, 126, 77, 13, -118, 20, -50, -6, -56, -88, 103, -9, + -101, -85, 110, 79, -20, -127, 54, -17, 123, 87, 28, -53, 78, -26, 77, -78, 57, -66, 117, + -45, 86, -8, 35, 24, -69, 39, 50, 37, 105, 25, -118, 111, 66, 34, 79, 41, 66, -122, + 11, -76, -104, -4, 26, 54, 118, 42, 102, 26, 84, 67, -48, -120, -98, -127, 64, -78, -117, + 67, -60, -53, -52, 51, 126, 31, -27, -84, 13, -46, -30, 103, 114, -33, -61, -113, 111, -62, + -120, -89, -119, 12, -23, 113, 7, 3, 113, -51, 62, 120, 70, -106, -122, -99, -90, 34, 100, + 79, -46, -9, -69, -15, 11, -127, -123, 90, -7, -41, -45, 31, 41}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/test_data.h b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/test_data.h index 8355af79..ff07f2a6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_1_s16/test_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_1_s16/test_data.h @@ -5,10 +5,10 @@ #include "forget_gate_bias.h" #include "forget_gate_hidden_weights.h" #include "forget_gate_input_weights.h" -#include "input.h" #include "input_gate_bias.h" #include "input_gate_hidden_weights.h" #include "input_gate_input_weights.h" +#include "input_tensor.h" #include "output.h" #include "output_gate_bias.h" #include "output_gate_hidden_weights.h" diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_bias.h new file mode 100644 index 00000000..a913a8f6 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_2_cell_gate_bias[7] = {0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_hidden_weights.h new file mode 100644 index 00000000..c6cd7697 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_hidden_weights.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_cell_gate_hidden_weights[49] = {68, 49, 123, 23, 33, 73, -28, 42, -14, -50, 29, -45, 113, + -118, -53, -30, -8, 28, 4, -86, 74, 111, 68, -16, 117, 62, + -69, 119, 58, 45, -14, 120, 18, 127, -8, -77, -54, 73, -101, + 42, -10, -86, -18, 50, -62, 125, 104, 91, -86}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_input_weights.h new file mode 100644 index 00000000..58c90fe1 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/cell_gate_input_weights.h @@ -0,0 +1,8 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_cell_gate_input_weights[42] = { + 72, 39, 21, -87, -75, -127, -118, 64, -95, -16, 66, 11, 79, -91, -59, -81, -94, -61, 95, -53, 30, + -48, -125, -97, -28, -42, 115, 1, -58, 102, 114, -40, -21, -127, -101, -68, -84, 36, -108, 115, -57, -116}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/config_data.h b/Tests/UnitTest/TestCases/TestData/lstm_2/config_data.h index da8a0fb4..32e6aa80 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2/config_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/config_data.h @@ -1,38 +1,34 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once -#define LSTM_2_BUFFER_SIZE 7 -#define LSTM_2_INPUT_BATCHES 1 -#define LSTM_2_DST_SIZE 63 +#define LSTM_2_TIME_MAJOR false +#define LSTM_2_BATCH_SIZE 1 #define LSTM_2_TIME_STEPS 9 -#define LSTM_2_NUMBER_UNITS 7 -#define LSTM_2_NUMBER_INPUTS 6 -#define LSTM_2_TIME_MAJOR 0 -#define LSTM_2_IN_ACTIVATION_MIN -32768 -#define LSTM_2_IN_ACTIVATION_MAX 32767 -#define LSTM_2_IN_TO_INPUT_MULTIPLIER 2146016128 -#define LSTM_2_IN_TO_INPUT_SHIFT -3 -#define LSTM_2_IN_TO_FORGET_MULTIPLIER 2131870080 -#define LSTM_2_IN_TO_FORGET_SHIFT -3 -#define LSTM_2_IN_TO_CELL_MULTIPLIER 1079288192 -#define LSTM_2_IN_TO_CELL_SHIFT -2 -#define LSTM_2_IN_TO_OUTPUT_MULTIPLIER 1077017984 -#define LSTM_2_IN_TO_OUTPUT_SHIFT -2 -#define LSTM_2_RECURRENT_TO_INPUT_MULTIPLIER 1351661952 -#define LSTM_2_RECURRENT_TO_INPUT_SHIFT -3 -#define LSTM_2_RECURRENT_TO_FORGET_MULTIPLIER 1367683200 -#define LSTM_2_RECURRENT_TO_FORGET_SHIFT -3 -#define LSTM_2_RECURRENT_TO_CELL_MULTIPLIER 1374072192 -#define LSTM_2_RECURRENT_TO_CELL_SHIFT -3 -#define LSTM_2_RECURRENT_TO_OUTPUT_MULTIPLIER 1379062144 -#define LSTM_2_RECURRENT_TO_OUTPUT_SHIFT -3 -#define LSTM_2_FORGET_MULTIPLIER 1073741824 -#define LSTM_2_FORGET_SHIFT -14 -#define LSTM_2_INPUT_MULTIPLIER 1073741824 -#define LSTM_2_INPUT_SHIFT -17 -#define LSTM_2_HIDDEN_MULTIPLIER 1667670651 -#define LSTM_2_HIDDEN_SHIFT -21 -#define LSTM_2_HIDDEN_OFFSET -24 -#define LSTM_2_DATA_OFFSET 128 -#define LSTM_2_OUTPUT_STATE_OFFSET -24 -#define LSTM_2_CELL_STATE_SHIFT -12 +#define LSTM_2_INPUT_SIZE 6 +#define LSTM_2_HIDDEN_SIZE 7 +#define LSTM_2_CELL_SCALE_POWER -14 +#define LSTM_2_INPUT_ZERO_POINT 128 +#define LSTM_2_OUTPUT_ZERO_POINT 89 +#define LSTM_2_CELL_CLIP 32767 +#define LSTM_2_FORGET_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_2_FORGET_TO_CELL_SHIFT -14 +#define LSTM_2_INPUT_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_2_INPUT_TO_CELL_SHIFT -15 +#define LSTM_2_OUTPUT_MULTIPLIER 1593352338 +#define LSTM_2_OUTPUT_SHIFT -21 +#define LSTM_2_OUTPUT_GATE_HIDDEN_MULTIPLIER 1458041984 +#define LSTM_2_OUTPUT_GATE_HIDDEN_SHIFT -3 +#define LSTM_2_CELL_GATE_HIDDEN_MULTIPLIER 1456329216 +#define LSTM_2_CELL_GATE_HIDDEN_SHIFT -3 +#define LSTM_2_FORGET_GATE_HIDDEN_MULTIPLIER 1457613056 +#define LSTM_2_FORGET_GATE_HIDDEN_SHIFT -3 +#define LSTM_2_INPUT_GATE_HIDDEN_MULTIPLIER 1450946560 +#define LSTM_2_INPUT_GATE_HIDDEN_SHIFT -3 +#define LSTM_2_OUTPUT_GATE_INPUT_MULTIPLIER 2123904128 +#define LSTM_2_OUTPUT_GATE_INPUT_SHIFT -3 +#define LSTM_2_CELL_GATE_INPUT_MULTIPLIER 2038601728 +#define LSTM_2_CELL_GATE_INPUT_SHIFT -3 +#define LSTM_2_FORGET_GATE_INPUT_MULTIPLIER 2045329536 +#define LSTM_2_FORGET_GATE_INPUT_SHIFT -3 +#define LSTM_2_INPUT_GATE_INPUT_MULTIPLIER 2105589248 +#define LSTM_2_INPUT_GATE_INPUT_SHIFT -3 diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_bias.h new file mode 100644 index 00000000..3e6066e7 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_2_forget_gate_bias[7] = {0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_hidden_weights.h new file mode 100644 index 00000000..ed94d193 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_hidden_weights.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_forget_gate_hidden_weights[49] = { + -122, 0, 125, 76, -123, 102, 123, -13, 64, 9, -2, 77, 47, -112, -56, 79, 116, + 106, -64, -90, 4, 10, -31, -19, 41, -114, -75, -85, 51, 79, 101, 69, -46, -16, + -27, 109, 37, 108, -80, 0, 127, 81, 41, 19, -66, 49, -65, 82, -37}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_input_weights.h new file mode 100644 index 00000000..2cafda3e --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/forget_gate_input_weights.h @@ -0,0 +1,8 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_forget_gate_input_weights[42] = { + -108, 82, -54, 43, -96, -57, 51, -107, -40, 10, 38, 60, 65, 106, 23, -88, 42, -125, -87, -127, -41, + -122, 13, 124, -77, 7, 122, -117, -122, -62, -37, 114, -88, -4, -41, -46, 33, 25, 70, -66, 119, -40}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_bias.h new file mode 100644 index 00000000..9038d7fa --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_2_input_gate_bias[7] = {0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_hidden_weights.h new file mode 100644 index 00000000..a3020913 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_hidden_weights.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_input_gate_hidden_weights[49] = {-30, -123, -2, -30, 33, 127, -88, -24, -4, 6, 91, -46, 48, + -18, -37, 15, -118, -67, -60, 125, 105, 63, 45, 62, -63, 7, + 60, 61, -15, -112, 43, 28, -38, 87, 62, -18, 79, -37, 103, + 1, -124, 3, 97, 34, -53, 2, -64, 47, -94}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_input_weights.h new file mode 100644 index 00000000..727429dc --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/input_gate_input_weights.h @@ -0,0 +1,8 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_input_gate_input_weights[42] = { + -112, -125, -66, 60, -48, 71, 77, 127, 99, 12, -5, -29, 5, 51, 36, 14, 34, -57, -74, 34, 110, + -91, 87, -53, 85, 7, 56, -49, 61, 45, -112, -88, 66, -81, -42, 80, 41, -10, 17, 93, -18, 82}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/input_tensor.h b/Tests/UnitTest/TestCases/TestData/lstm_2/input_tensor.h new file mode 100644 index 00000000..f2412ebf --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/input_tensor.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_input_tensor[54] = {32, 26, 48, 79, -109, -91, 91, -6, 96, 54, 24, 68, -5, -58, + 21, 86, 103, 70, 117, 66, 93, 5, -97, 73, 65, 1, 15, -33, + -71, 107, -103, -123, 40, 49, -101, -128, 0, -51, 93, -119, -126, -102, + -23, -43, -95, -92, -73, 60, -107, 49, 87, -46, 36, 125}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/output.h b/Tests/UnitTest/TestCases/TestData/lstm_2/output.h new file mode 100644 index 00000000..e1686b9e --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/output.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_output[63] = {87, 19, -2, 79, 127, 52, 70, 74, -33, -72, 8, 127, 27, -23, 34, -46, + -53, -42, 122, 24, -51, 73, -11, -51, -17, 127, 74, -62, 61, -8, -43, -34, + 127, 77, -113, 1, -7, -3, 13, 127, 71, 29, 72, 3, -10, 40, 127, 127, + -7, 44, 40, -11, -22, 127, 90, -83, 48, 101, -91, -60, 127, 8, -98}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_bias.h new file mode 100644 index 00000000..128ba93b --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_2_output_gate_bias[7] = {0, 0, 0, 0, 0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_hidden_weights.h new file mode 100644 index 00000000..36d80235 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_hidden_weights.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_output_gate_hidden_weights[49] = { + -111, 127, -34, -17, 52, 2, -91, 36, -117, -57, -29, -48, -119, -16, 98, 64, -92, + 105, 22, 38, 55, 110, 22, -127, -93, -37, -29, 71, -13, 117, 102, -117, 87, 18, + -100, -3, -37, -95, -49, -41, 9, 8, 99, 63, 38, -98, 88, 34, 17}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_input_weights.h new file mode 100644 index 00000000..e215e247 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/output_gate_input_weights.h @@ -0,0 +1,8 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_2_output_gate_input_weights[42] = { + -55, -86, -98, 39, 44, -101, 65, -127, -118, 67, 105, -84, -67, 50, 121, -67, 32, 86, 117, 18, -103, + 5, 47, 79, 92, 80, 105, -30, 115, -20, 6, 111, 101, -46, 4, -121, 28, 5, -83, -119, 43, 121}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2/test_data.h b/Tests/UnitTest/TestCases/TestData/lstm_2/test_data.h index f1ab6ed2..ff07f2a6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2/test_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2/test_data.h @@ -1,36 +1,15 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#include "cell_gate_bias_data.h" -#include "cell_norm_coeff_data.h" -#include "cell_state_data.h" -#include "cell_to_forget_data.h" -#include "cell_to_input_data.h" -#include "cell_to_output_data.h" +#include "cell_gate_bias.h" +#include "cell_gate_hidden_weights.h" +#include "cell_gate_input_weights.h" #include "config_data.h" -#include "forget_gate_bias_data.h" -#include "forget_norm_coeff_data.h" -#include "input_data.h" -#include "input_gate_bias_data.h" -#include "input_norm_coeff_data.h" -#include "input_to_cell_eff_bias_data.h" -#include "input_to_cell_w_data.h" -#include "input_to_forget_eff_bias_data.h" -#include "input_to_forget_w_data.h" -#include "input_to_input_eff_bias_data.h" -#include "input_to_input_w_data.h" -#include "input_to_output_eff_bias_data.h" -#include "input_to_output_w_data.h" -#include "output_gate_bias_data.h" -#include "output_norm_coeff_data.h" -#include "output_ref_data.h" -#include "output_state_data.h" -#include "projection_bias_data.h" -#include "projection_weights_data.h" -#include "recurrent_input_to_cell_w_data.h" -#include "recurrent_input_to_forget_w_data.h" -#include "recurrent_input_to_input_w_data.h" -#include "recurrent_input_to_output_w_data.h" -#include "recurrent_to_cell_eff_bias_data.h" -#include "recurrent_to_forget_eff_bias_data.h" -#include "recurrent_to_input_eff_bias_data.h" -#include "recurrent_to_output_eff_bias_data.h" +#include "forget_gate_bias.h" +#include "forget_gate_hidden_weights.h" +#include "forget_gate_input_weights.h" +#include "input_gate_bias.h" +#include "input_gate_hidden_weights.h" +#include "input_gate_input_weights.h" +#include "input_tensor.h" +#include "output.h" +#include "output_gate_bias.h" +#include "output_gate_hidden_weights.h" +#include "output_gate_input_weights.h" diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_bias.h index 5a89575f..9dae0d2f 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_2_s16_cell_gate_bias[7] = {19513, 13891, 21356, 10099, 17079, 31695, 8446}; \ No newline at end of file +const int64_t lstm_2_s16_cell_gate_bias[7] = {23473, 5516, 21033, 6678, 24543, 11119, 16378}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_hidden_weights.h index 7320ed78..5b68c784 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_hidden_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_cell_gate_hidden_weights[49] = { - 103, -81, -66, 119, 103, 58, -7, -56, -41, -99, 2, 12, -23, 77, -79, -4, 56, - 113, -2, -52, -77, 8, -6, 68, 77, 125, 106, -66, 88, 27, 117, 12, -44, 41, - -6, -119, 52, -82, -7, -5, -57, 71, 7, -62, -115, -108, -1, 119, 94}; \ No newline at end of file + -12, -22, -12, -110, -25, 22, -7, 90, -7, -116, -37, -63, -37, 10, -64, -72, -64, + 24, 81, -90, 49, -103, -55, -104, -44, -85, 103, 121, 121, -75, 113, -14, -83, 106, + 36, 14, -83, 117, 26, -17, 96, -21, -63, -52, 2, 67, 28, 9, 119}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_input_weights.h index abffd05c..1aa1653c 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/cell_gate_input_weights.h @@ -1,8 +1,8 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_cell_gate_input_weights[42] = { - -62, 75, 47, 104, 59, 76, 48, 52, 13, 68, -69, 93, 8, 8, -95, 26, -76, -49, 108, 81, -92, - -104, 80, -118, -87, 25, 112, -56, -14, 61, -10, -26, 43, -118, -86, -108, -27, 26, -40, 77, -63, -125}; \ No newline at end of file + 17, 68, -89, 86, -126, 123, -79, -40, 109, -58, 60, 39, 57, 1, -123, 85, -34, -96, -127, 83, 32, + -125, -63, 102, -45, -118, 116, 31, -80, -84, 68, 79, -19, 75, 5, 0, -123, 97, 42, -55, 115, 85}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/config_data.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/config_data.h index 3c54682d..0a5b1162 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/config_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/config_data.h @@ -1,34 +1,34 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once -#define lstm_2_s16_time_major false -#define lstm_2_s16_batch_size 1 -#define lstm_2_s16_time_steps 9 -#define lstm_2_s16_input_size 6 -#define lstm_2_s16_hidden_size 7 -#define lstm_2_s16_cell_scale_power -9 -#define lstm_2_s16_output_zero_point 0 -#define lstm_2_s16_input_zero_point 0 -#define lstm_2_s16_cell_clip 32767 -#define lstm_2_s16_forget_to_cell_multiplier 1073741824 -#define lstm_2_s16_forget_to_cell_shift -14 -#define lstm_2_s16_input_to_cell_multiplier 1316479598 -#define lstm_2_s16_input_to_cell_shift -20 -#define lstm_2_s16_output_multiplier 1956298507 -#define lstm_2_s16_output_shift -17 -#define lstm_2_s16_output_gate_hidden_multiplier 1549742675 -#define lstm_2_s16_output_gate_hidden_shift -11 -#define lstm_2_s16_cell_gate_hidden_multiplier 1564226251 -#define lstm_2_s16_cell_gate_hidden_shift -12 -#define lstm_2_s16_forget_gate_hidden_multiplier 1670439145 -#define lstm_2_s16_forget_gate_hidden_shift -12 -#define lstm_2_s16_input_gate_hidden_multiplier 1164720936 -#define lstm_2_s16_input_gate_hidden_shift -10 -#define lstm_2_s16_output_gate_input_multiplier 1924775430 -#define lstm_2_s16_output_gate_input_shift -10 -#define lstm_2_s16_cell_gate_input_multiplier 1582330722 -#define lstm_2_s16_cell_gate_input_shift -11 -#define lstm_2_s16_forget_gate_input_multiplier 1281215547 -#define lstm_2_s16_forget_gate_input_shift -9 -#define lstm_2_s16_input_gate_input_multiplier 1578394576 -#define lstm_2_s16_input_gate_input_shift -9 +#define LSTM_2_S16_TIME_MAJOR false +#define LSTM_2_S16_BATCH_SIZE 1 +#define LSTM_2_S16_TIME_STEPS 9 +#define LSTM_2_S16_INPUT_SIZE 6 +#define LSTM_2_S16_HIDDEN_SIZE 7 +#define LSTM_2_S16_CELL_SCALE_POWER -9 +#define LSTM_2_S16_OUTPUT_ZERO_POINT 0 +#define LSTM_2_S16_INPUT_ZERO_POINT 0 +#define LSTM_2_S16_CELL_CLIP 32767 +#define LSTM_2_S16_FORGET_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_2_S16_FORGET_TO_CELL_SHIFT -14 +#define LSTM_2_S16_INPUT_TO_CELL_MULTIPLIER 1508742446 +#define LSTM_2_S16_INPUT_TO_CELL_SHIFT -20 +#define LSTM_2_S16_OUTPUT_MULTIPLIER 1277193666 +#define LSTM_2_S16_OUTPUT_SHIFT -19 +#define LSTM_2_S16_OUTPUT_GATE_HIDDEN_MULTIPLIER 1628729057 +#define LSTM_2_S16_OUTPUT_GATE_HIDDEN_SHIFT -8 +#define LSTM_2_S16_CELL_GATE_HIDDEN_MULTIPLIER 1608393053 +#define LSTM_2_S16_CELL_GATE_HIDDEN_SHIFT -8 +#define LSTM_2_S16_FORGET_GATE_HIDDEN_MULTIPLIER 1785870907 +#define LSTM_2_S16_FORGET_GATE_HIDDEN_SHIFT -9 +#define LSTM_2_S16_INPUT_GATE_HIDDEN_MULTIPLIER 1571418500 +#define LSTM_2_S16_INPUT_GATE_HIDDEN_SHIFT -9 +#define LSTM_2_S16_OUTPUT_GATE_INPUT_MULTIPLIER 1095131314 +#define LSTM_2_S16_OUTPUT_GATE_INPUT_SHIFT -10 +#define LSTM_2_S16_CELL_GATE_INPUT_MULTIPLIER 1104525823 +#define LSTM_2_S16_CELL_GATE_INPUT_SHIFT -9 +#define LSTM_2_S16_FORGET_GATE_INPUT_MULTIPLIER 1669538425 +#define LSTM_2_S16_FORGET_GATE_INPUT_SHIFT -11 +#define LSTM_2_S16_INPUT_GATE_INPUT_MULTIPLIER 1382334870 +#define LSTM_2_S16_INPUT_GATE_INPUT_SHIFT -10 diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_bias.h index a673376e..35e2b3dd 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_2_s16_forget_gate_bias[7] = {20964, 16982, 16930, 22508, 31250, 30498, 16337}; \ No newline at end of file +const int64_t lstm_2_s16_forget_gate_bias[7] = {6728, 23106, 31577, 11102, 16513, 1557, 12710}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_hidden_weights.h index 7990b6cd..ab0f8fe8 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_hidden_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_forget_gate_hidden_weights[49] = { - 118, 14, 8, -95, -3, -65, 2, -67, 41, 104, 18, 51, 21, -4, -86, 31, 56, - -60, -75, 74, 73, -12, 115, 1, -109, -119, 96, 15, -31, -37, 25, 0, -22, -24, - 95, 30, -6, 23, -25, -59, 105, -84, 102, -16, 19, -118, 42, -124, -38}; \ No newline at end of file + -45, 61, -128, 26, 105, -74, -1, -44, 59, -54, 104, 22, -124, 3, 68, -2, 53, + 95, 90, 46, 68, -82, -89, 71, -116, -86, 29, 11, -66, -121, -44, -9, -111, -127, + -97, -37, -68, 47, 72, -33, 70, 69, -122, 111, -73, -22, 61, 121, -16}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_input_weights.h index d639622f..73277d0f 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/forget_gate_input_weights.h @@ -1,8 +1,8 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_forget_gate_input_weights[42] = { - -37, -21, 118, -39, 90, -97, -99, 73, 59, -12, 1, -74, -39, -125, -60, 101, 68, -22, -65, 47, 55, - 114, 86, 48, 57, -72, -103, 103, -3, 78, 123, -51, 78, -100, -100, -54, -25, -40, -21, 33, 60, -107}; \ No newline at end of file + 22, -120, -77, 15, 27, -47, -18, 111, 114, -108, -8, 113, 79, -83, 11, -127, -3, 66, -105, -67, 68, + -81, 12, 74, 70, 26, -53, 126, -61, -127, -48, -3, 56, -33, 15, 36, 42, -121, -39, 6, -23, 111}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_bias.h index c2b86290..a3da8fca 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_2_s16_input_gate_bias[7] = {28793, 9909, 4344, 1117, 3627, 30848, 32766}; \ No newline at end of file +const int64_t lstm_2_s16_input_gate_bias[7] = {4929, 26252, 4706, 25792, 21604, 26746, 4602}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_hidden_weights.h index 4fc2d2ba..67a80f95 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_hidden_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_input_gate_hidden_weights[49] = { - 3, 53, -35, -6, -43, -23, -98, 16, -114, -96, 15, 40, 80, -82, 109, -22, 13, - 117, 90, 87, -52, 58, -46, 106, 34, -90, -63, -121, 106, 122, -101, 55, 7, 51, - -55, 7, 124, 53, 97, -96, -9, -61, -25, 123, -69, -1, -55, 69, -104}; \ No newline at end of file + -19, 95, 113, -121, -92, 113, 16, -51, -73, -84, -67, -5, 0, -32, -7, -118, -97, + -99, -76, 123, -32, -82, 15, -38, -67, -111, -127, 123, 1, 15, 84, 92, -58, -116, + -121, -21, -8, 8, -113, 0, 53, 112, 77, 31, -33, -103, 86, -59, 46}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_input_weights.h index 37d25b83..c293623a 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_gate_input_weights.h @@ -1,8 +1,8 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_input_gate_input_weights[42] = { - 83, 92, 125, 94, -48, 9, 118, 97, -55, -91, 102, -33, 107, 93, -3, 93, -122, 89, 117, 65, 89, - 80, -120, -87, 101, 34, 70, -7, 103, -55, -96, 82, 121, 58, 17, -28, 78, -96, 107, -127, -40, 26}; \ No newline at end of file + 78, -39, -121, -86, -55, -57, 55, -3, 84, -15, 84, 93, -10, 24, 33, 42, 26, -68, 83, -94, 6, + -52, 55, -112, 120, 36, -110, 33, -30, 116, -46, -78, -126, 107, 117, -118, 44, -56, -29, -115, -92, -116}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_tensor.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_tensor.h new file mode 100644 index 00000000..dda4ddf3 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/input_tensor.h @@ -0,0 +1,10 @@ +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int16_t lstm_2_s16_input_tensor[54] = { + -29777, -9739, -629, 31652, 56, 28025, 30334, 29344, 2411, 4139, -20543, 7011, -32014, 26553, + 12370, -14345, 24740, 1578, -17929, 10155, -15181, 29648, -23676, 8695, -24737, -28564, -18424, -24972, + 21845, -14567, -9961, -13024, 23555, -27789, -32728, 16980, -12842, -21337, -8911, 15242, 16140, -31776, + -6039, -19629, -7731, 8750, -1471, -6971, 7662, 27382, 22046, 8067, -24664, -31810}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output.h index 70f397c1..6cfad460 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output.h @@ -1,10 +1,10 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int16_t lstm_2_s16_output[63] = {1163, 635, -271, 765, -382, -1332, 230, -197, 83, 1107, 452, -1470, -597, - 433, 915, 1438, -536, 235, -44, -1806, 51, 367, 15, 92, 1041, -668, - -646, -282, -912, -703, 283, 1122, -585, 71, 239, 19, 34, -123, 1358, - 10, 266, 221, -49, -169, 0, 1190, -1863, -84, 304, 151, 313, 73, - -379, -2443, -498, -115, -164, 305, 28, -1771, -415, 981, 674}; \ No newline at end of file +const int16_t lstm_2_s16_output[63] = {118, 179, -108, 110, 104, -39, 181, 452, -301, 94, 39, -368, 179, + -124, -1, 295, -327, 396, -319, -12, 229, 248, -87, 92, 259, -167, + 199, 38, -271, 124, 12, 241, 11, -342, 305, -50, 490, -279, 204, + 343, -439, 152, -430, 103, 253, -396, 231, -299, -192, -301, 0, 295, + -418, 299, -293, -363, -146, -247, 292, -273, 412, 15, -279}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_bias.h index 0ec709fc..86a93534 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_2_s16_output_gate_bias[7] = {5138, 5363, 14184, 3723, 23687, 28588, 26805}; \ No newline at end of file +const int64_t lstm_2_s16_output_gate_bias[7] = {26376, 13695, 26594, 32716, 18931, 34, 711}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_hidden_weights.h index 69b797d5..b230e8f1 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_hidden_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_output_gate_hidden_weights[49] = { - 29, -8, -81, -77, -33, 23, 74, -78, 68, -77, 22, -74, 95, 112, 13, 97, -124, - -106, -3, -122, 110, -124, -74, 47, 97, 11, 44, 8, -100, 91, -103, 85, 68, 13, - 28, 119, -94, -74, -39, -15, -45, 60, 23, 37, 52, 70, 83, 111, -9}; \ No newline at end of file + -101, -76, -14, -50, -31, -17, -62, 24, 36, -14, 122, 47, -106, 125, 40, -96, 7, + 92, 75, 0, 24, -103, 56, -109, 25, 97, 28, -116, -72, 71, 88, 50, 79, -68, + 105, 66, -103, -128, -90, 114, 38, 76, -87, -90, 1, -78, -123, 78, 114}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_input_weights.h index 6263cf16..cffd607b 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/output_gate_input_weights.h @@ -1,8 +1,8 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_2_s16_output_gate_input_weights[42] = { - -83, -37, -5, -58, 37, -85, 37, 121, 112, -12, -104, -55, 116, -43, 33, -108, -15, 79, 8, -34, -64, - -12, -63, 20, 90, -89, -126, -49, -43, -16, 81, 65, 78, -7, -63, -92, -91, 8, -108, -8, 37, -67}; \ No newline at end of file + 115, -15, -27, -10, 21, -118, 6, 115, 123, -5, -36, 22, 72, -46, -4, -94, 69, -9, -105, 73, -89, + 70, 104, -102, -24, 98, 5, -93, -7, 73, -46, 77, 31, -81, -124, -46, -32, -86, 35, 100, 125, 33}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/test_data.h b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/test_data.h index 8355af79..ff07f2a6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_2_s16/test_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_2_s16/test_data.h @@ -5,10 +5,10 @@ #include "forget_gate_bias.h" #include "forget_gate_hidden_weights.h" #include "forget_gate_input_weights.h" -#include "input.h" #include "input_gate_bias.h" #include "input_gate_hidden_weights.h" #include "input_gate_input_weights.h" +#include "input_tensor.h" #include "output.h" #include "output_gate_bias.h" #include "output_gate_hidden_weights.h" diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_bias.h new file mode 100644 index 00000000..83d8bfb7 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_one_time_step_cell_gate_bias[3] = {0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_hidden_weights.h new file mode 100644 index 00000000..8ba6ca2d --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_hidden_weights.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_cell_gate_hidden_weights[9] = {-99, -51, 7, -50, 60, 78, 119, 12, 127}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_input_weights.h new file mode 100644 index 00000000..676fba6c --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/cell_gate_input_weights.h @@ -0,0 +1,10 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_cell_gate_input_weights[66] = { + -10, -49, 4, 123, -63, -31, 77, -48, 78, -116, 102, 109, 108, 31, -80, -31, 54, + -13, -103, -40, 27, -116, -72, 39, -77, -81, -118, 106, 57, 81, -65, -38, -21, -38, + -106, -7, 127, -62, 104, -81, -29, 82, 76, -101, 7, -122, -82, 39, 88, -83, -121, + 16, -123, 19, -65, -71, 20, -109, -118, 117, 38, -29, -126, 37, 7, 70}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/config_data.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/config_data.h index d719d33b..1419d680 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/config_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/config_data.h @@ -1,38 +1,34 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once -#define LSTM_ONE_TIME_STEP_BUFFER_SIZE 9 -#define LSTM_ONE_TIME_STEP_INPUT_BATCHES 3 -#define LSTM_ONE_TIME_STEP_DST_SIZE 9 +#define LSTM_ONE_TIME_STEP_TIME_MAJOR false +#define LSTM_ONE_TIME_STEP_BATCH_SIZE 3 #define LSTM_ONE_TIME_STEP_TIME_STEPS 1 -#define LSTM_ONE_TIME_STEP_NUMBER_UNITS 3 -#define LSTM_ONE_TIME_STEP_NUMBER_INPUTS 22 -#define LSTM_ONE_TIME_STEP_TIME_MAJOR 0 -#define LSTM_ONE_TIME_STEP_IN_ACTIVATION_MIN -32768 -#define LSTM_ONE_TIME_STEP_IN_ACTIVATION_MAX 32767 -#define LSTM_ONE_TIME_STEP_IN_TO_INPUT_MULTIPLIER 2118812544 -#define LSTM_ONE_TIME_STEP_IN_TO_INPUT_SHIFT -3 -#define LSTM_ONE_TIME_STEP_IN_TO_FORGET_MULTIPLIER 2143159040 -#define LSTM_ONE_TIME_STEP_IN_TO_FORGET_SHIFT -3 -#define LSTM_ONE_TIME_STEP_IN_TO_CELL_MULTIPLIER 1079340672 -#define LSTM_ONE_TIME_STEP_IN_TO_CELL_SHIFT -2 -#define LSTM_ONE_TIME_STEP_IN_TO_OUTPUT_MULTIPLIER 2144143488 -#define LSTM_ONE_TIME_STEP_IN_TO_OUTPUT_SHIFT -3 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_INPUT_MULTIPLIER 1158760960 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_INPUT_SHIFT -3 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_FORGET_MULTIPLIER 1197046528 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_FORGET_SHIFT -3 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_CELL_MULTIPLIER 1244768512 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_CELL_SHIFT -3 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_OUTPUT_MULTIPLIER 1216274304 -#define LSTM_ONE_TIME_STEP_RECURRENT_TO_OUTPUT_SHIFT -3 -#define LSTM_ONE_TIME_STEP_FORGET_MULTIPLIER 1073741824 -#define LSTM_ONE_TIME_STEP_FORGET_SHIFT -14 -#define LSTM_ONE_TIME_STEP_INPUT_MULTIPLIER 1073741824 -#define LSTM_ONE_TIME_STEP_INPUT_SHIFT -13 -#define LSTM_ONE_TIME_STEP_HIDDEN_MULTIPLIER 1828318324 -#define LSTM_ONE_TIME_STEP_HIDDEN_SHIFT -21 -#define LSTM_ONE_TIME_STEP_HIDDEN_OFFSET -16 -#define LSTM_ONE_TIME_STEP_DATA_OFFSET 128 -#define LSTM_ONE_TIME_STEP_OUTPUT_STATE_OFFSET -16 -#define LSTM_ONE_TIME_STEP_CELL_STATE_SHIFT -16 +#define LSTM_ONE_TIME_STEP_INPUT_SIZE 22 +#define LSTM_ONE_TIME_STEP_HIDDEN_SIZE 3 +#define LSTM_ONE_TIME_STEP_CELL_SCALE_POWER -15 +#define LSTM_ONE_TIME_STEP_INPUT_ZERO_POINT 128 +#define LSTM_ONE_TIME_STEP_OUTPUT_ZERO_POINT 71 +#define LSTM_ONE_TIME_STEP_CELL_CLIP 32767 +#define LSTM_ONE_TIME_STEP_FORGET_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_ONE_TIME_STEP_FORGET_TO_CELL_SHIFT -14 +#define LSTM_ONE_TIME_STEP_INPUT_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_ONE_TIME_STEP_INPUT_TO_CELL_SHIFT -14 +#define LSTM_ONE_TIME_STEP_OUTPUT_MULTIPLIER 1233130888 +#define LSTM_ONE_TIME_STEP_OUTPUT_SHIFT -21 +#define LSTM_ONE_TIME_STEP_OUTPUT_GATE_HIDDEN_MULTIPLIER 1736887168 +#define LSTM_ONE_TIME_STEP_OUTPUT_GATE_HIDDEN_SHIFT -3 +#define LSTM_ONE_TIME_STEP_CELL_GATE_HIDDEN_MULTIPLIER 1684773504 +#define LSTM_ONE_TIME_STEP_CELL_GATE_HIDDEN_SHIFT -3 +#define LSTM_ONE_TIME_STEP_FORGET_GATE_HIDDEN_MULTIPLIER 1861966848 +#define LSTM_ONE_TIME_STEP_FORGET_GATE_HIDDEN_SHIFT -3 +#define LSTM_ONE_TIME_STEP_INPUT_GATE_HIDDEN_MULTIPLIER 1794864512 +#define LSTM_ONE_TIME_STEP_INPUT_GATE_HIDDEN_SHIFT -3 +#define LSTM_ONE_TIME_STEP_OUTPUT_GATE_INPUT_MULTIPLIER 2081761536 +#define LSTM_ONE_TIME_STEP_OUTPUT_GATE_INPUT_SHIFT -3 +#define LSTM_ONE_TIME_STEP_CELL_GATE_INPUT_MULTIPLIER 1073872640 +#define LSTM_ONE_TIME_STEP_CELL_GATE_INPUT_SHIFT -2 +#define LSTM_ONE_TIME_STEP_FORGET_GATE_INPUT_MULTIPLIER 2146049024 +#define LSTM_ONE_TIME_STEP_FORGET_GATE_INPUT_SHIFT -3 +#define LSTM_ONE_TIME_STEP_INPUT_GATE_INPUT_MULTIPLIER 2075965824 +#define LSTM_ONE_TIME_STEP_INPUT_GATE_INPUT_SHIFT -3 diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_bias.h new file mode 100644 index 00000000..dc7cd7ef --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_one_time_step_forget_gate_bias[3] = {0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_hidden_weights.h new file mode 100644 index 00000000..5a0d59e7 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_hidden_weights.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_forget_gate_hidden_weights[9] = {-127, -19, -47, 126, -116, -42, 53, 94, -57}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_input_weights.h new file mode 100644 index 00000000..a77b5034 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/forget_gate_input_weights.h @@ -0,0 +1,10 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_forget_gate_input_weights[66] = { + 100, 45, -118, 119, -74, -111, 56, 67, 71, -120, 39, 40, -78, 3, -39, 44, -20, + 5, 108, -66, 127, 9, -125, -97, 64, 6, -25, 72, -34, -65, 38, -44, -62, 63, + 3, -100, -100, 83, -78, 119, -28, -117, 90, -103, -76, 73, -70, 105, -2, -123, -119, + -72, -55, -88, 117, -120, -97, 106, 42, 66, 72, 67, 126, -106, -9, -84}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_bias.h new file mode 100644 index 00000000..7cacf79d --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_one_time_step_input_gate_bias[3] = {0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_hidden_weights.h new file mode 100644 index 00000000..ba2a1f2b --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_hidden_weights.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_input_gate_hidden_weights[9] = {-54, 103, 102, 102, -47, -127, -112, -96, -6}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_input_weights.h new file mode 100644 index 00000000..c0a0f511 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_gate_input_weights.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_input_gate_input_weights[66] = { + -117, 21, 105, -105, 101, 107, 78, -105, -63, -109, 84, -104, 75, 36, -14, 58, -127, -92, 20, 28, -99, 65, + -10, 87, -125, -15, 29, -39, 58, 123, 87, -83, -58, -82, 126, -47, -107, 73, 9, -56, -8, 84, 81, -70, + -16, 62, 8, 29, -74, 34, 13, -70, 45, 102, 0, 48, 84, -36, 13, 65, -71, 105, -32, 38, -70, -11}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_tensor.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_tensor.h new file mode 100644 index 00000000..26150083 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/input_tensor.h @@ -0,0 +1,10 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_input_tensor[66] = { + -23, -6, -10, -93, -39, -101, -72, 110, -94, -74, -61, 122, -51, 25, 115, 68, 2, + -43, -49, 122, -78, -106, 10, 63, -69, -19, 100, -73, -36, 42, 102, 106, -3, 32, + -109, -29, -68, 64, -120, -49, -78, 16, -90, 67, 18, -84, 7, -123, -113, -79, 74, + 127, -113, -29, -96, 35, 0, 31, 44, -35, 110, 60, -92, -40, 97, -120}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output.h new file mode 100644 index 00000000..50538caa --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_output[9] = {48, 127, -93, 5, 43, -89, 83, 127, -70}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_bias.h new file mode 100644 index 00000000..b5e4dfd1 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_bias.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int32_t lstm_one_time_step_output_gate_bias[3] = {0, 0, 0}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_hidden_weights.h new file mode 100644 index 00000000..4ca197dc --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_hidden_weights.h @@ -0,0 +1,6 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_output_gate_hidden_weights[9] = {109, -108, 118, 63, -69, 8, -127, -38, 59}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_input_weights.h new file mode 100644 index 00000000..675befb8 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/output_gate_input_weights.h @@ -0,0 +1,9 @@ +// Generated by generate_test_data.py using tensorflow version 2.17.0 (Keras version 2.17.0). +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int8_t lstm_one_time_step_output_gate_input_weights[66] = { + 75, 20, 88, 90, 48, 22, -121, 124, 99, -17, 7, 51, 39, -7, 124, -52, 17, -35, 45, 87, 75, -38, + -18, -7, 58, -79, -110, 123, -63, -76, -71, -26, -109, 44, 70, 34, 35, 35, -8, 89, -60, 113, -120, -40, + 103, 105, 11, 7, 35, 79, 111, 87, -66, 1, 92, 33, 78, 127, 116, -124, 26, 5, 89, 117, -115, -68}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/test_data.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/test_data.h index f1ab6ed2..ff07f2a6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/test_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step/test_data.h @@ -1,36 +1,15 @@ -// Generated by test_settings.py using tensorflow version 2.15.0 (Keras version 2.15.0). -// Interpreter from tflite_micro version 0.dev20231214171620-g47f77ab and revision None. -#include "cell_gate_bias_data.h" -#include "cell_norm_coeff_data.h" -#include "cell_state_data.h" -#include "cell_to_forget_data.h" -#include "cell_to_input_data.h" -#include "cell_to_output_data.h" +#include "cell_gate_bias.h" +#include "cell_gate_hidden_weights.h" +#include "cell_gate_input_weights.h" #include "config_data.h" -#include "forget_gate_bias_data.h" -#include "forget_norm_coeff_data.h" -#include "input_data.h" -#include "input_gate_bias_data.h" -#include "input_norm_coeff_data.h" -#include "input_to_cell_eff_bias_data.h" -#include "input_to_cell_w_data.h" -#include "input_to_forget_eff_bias_data.h" -#include "input_to_forget_w_data.h" -#include "input_to_input_eff_bias_data.h" -#include "input_to_input_w_data.h" -#include "input_to_output_eff_bias_data.h" -#include "input_to_output_w_data.h" -#include "output_gate_bias_data.h" -#include "output_norm_coeff_data.h" -#include "output_ref_data.h" -#include "output_state_data.h" -#include "projection_bias_data.h" -#include "projection_weights_data.h" -#include "recurrent_input_to_cell_w_data.h" -#include "recurrent_input_to_forget_w_data.h" -#include "recurrent_input_to_input_w_data.h" -#include "recurrent_input_to_output_w_data.h" -#include "recurrent_to_cell_eff_bias_data.h" -#include "recurrent_to_forget_eff_bias_data.h" -#include "recurrent_to_input_eff_bias_data.h" -#include "recurrent_to_output_eff_bias_data.h" +#include "forget_gate_bias.h" +#include "forget_gate_hidden_weights.h" +#include "forget_gate_input_weights.h" +#include "input_gate_bias.h" +#include "input_gate_hidden_weights.h" +#include "input_gate_input_weights.h" +#include "input_tensor.h" +#include "output.h" +#include "output_gate_bias.h" +#include "output_gate_hidden_weights.h" +#include "output_gate_input_weights.h" diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_bias.h index 9c2539a5..b9c9c1e7 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_one_time_step_s16_cell_gate_bias[3] = {20195, 27538, 32653}; \ No newline at end of file +const int64_t lstm_one_time_step_s16_cell_gate_bias[3] = {26225, 25324, 21861}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_hidden_weights.h index 39f4ea18..3663ec33 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_hidden_weights.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int8_t lstm_one_time_step_s16_cell_gate_hidden_weights[9] = {96, 122, 83, -16, 68, -124, -120, 18, -57}; \ No newline at end of file +const int8_t lstm_one_time_step_s16_cell_gate_hidden_weights[9] = {-31, -52, -40, -17, -57, -60, -4, -112, 94}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_input_weights.h index 931d2608..a7d45df6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/cell_gate_input_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_one_time_step_s16_cell_gate_input_weights[66] = { - 87, 101, 93, 23, -94, -70, -51, -59, -76, -21, -16, -37, 122, -91, -112, -111, -46, -68, -38, 15, -38, 74, - -97, -9, -61, -7, -4, 94, 105, -112, -123, -18, -29, 49, 42, -13, 34, 83, 106, 60, -24, 96, 48, -86, - 66, 97, -90, -21, 101, -90, -6, 78, -1, 41, 2, 8, 11, -123, -79, -12, -36, -25, -37, -127, 73, 100}; \ No newline at end of file + 25, 115, -105, -116, 96, 101, -111, 51, 75, 99, 44, 14, 15, 30, 13, -85, 114, -57, -7, 60, 15, -116, + 42, -8, 86, 46, 90, -23, -73, 80, -82, 53, 100, 103, 107, 69, 97, -31, 120, -73, -91, -44, -71, 82, + 70, -70, -93, -38, 0, -98, -14, -93, -107, 120, 52, 33, -127, -124, -44, -118, -64, 48, 110, -32, 84, 79}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/config_data.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/config_data.h index 1ee11ca3..cb700942 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/config_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/config_data.h @@ -1,34 +1,34 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once -#define lstm_one_time_step_s16_time_major false -#define lstm_one_time_step_s16_batch_size 3 -#define lstm_one_time_step_s16_time_steps 1 -#define lstm_one_time_step_s16_input_size 22 -#define lstm_one_time_step_s16_hidden_size 3 -#define lstm_one_time_step_s16_cell_scale_power -10 -#define lstm_one_time_step_s16_output_zero_point 0 -#define lstm_one_time_step_s16_input_zero_point 0 -#define lstm_one_time_step_s16_cell_clip 32767 -#define lstm_one_time_step_s16_forget_to_cell_multiplier 1073741824 -#define lstm_one_time_step_s16_forget_to_cell_shift -14 -#define lstm_one_time_step_s16_input_to_cell_multiplier 1899594203 -#define lstm_one_time_step_s16_input_to_cell_shift -20 -#define lstm_one_time_step_s16_output_multiplier 1713359477 -#define lstm_one_time_step_s16_output_shift -17 -#define lstm_one_time_step_s16_output_gate_hidden_multiplier 1328489832 -#define lstm_one_time_step_s16_output_gate_hidden_shift -11 -#define lstm_one_time_step_s16_cell_gate_hidden_multiplier 1181032973 -#define lstm_one_time_step_s16_cell_gate_hidden_shift -10 -#define lstm_one_time_step_s16_forget_gate_hidden_multiplier 2122276288 -#define lstm_one_time_step_s16_forget_gate_hidden_shift -12 -#define lstm_one_time_step_s16_input_gate_hidden_multiplier 1120396508 -#define lstm_one_time_step_s16_input_gate_hidden_shift -10 -#define lstm_one_time_step_s16_output_gate_input_multiplier 1673987981 -#define lstm_one_time_step_s16_output_gate_input_shift -10 -#define lstm_one_time_step_s16_cell_gate_input_multiplier 1551228863 -#define lstm_one_time_step_s16_cell_gate_input_shift -8 -#define lstm_one_time_step_s16_forget_gate_input_multiplier 1681427928 -#define lstm_one_time_step_s16_forget_gate_input_shift -11 -#define lstm_one_time_step_s16_input_gate_input_multiplier 1677707955 -#define lstm_one_time_step_s16_input_gate_input_shift -8 +#define LSTM_ONE_TIME_STEP_S16_TIME_MAJOR false +#define LSTM_ONE_TIME_STEP_S16_BATCH_SIZE 3 +#define LSTM_ONE_TIME_STEP_S16_TIME_STEPS 1 +#define LSTM_ONE_TIME_STEP_S16_INPUT_SIZE 22 +#define LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE 3 +#define LSTM_ONE_TIME_STEP_S16_CELL_SCALE_POWER -10 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_ZERO_POINT 0 +#define LSTM_ONE_TIME_STEP_S16_INPUT_ZERO_POINT 0 +#define LSTM_ONE_TIME_STEP_S16_CELL_CLIP 32767 +#define LSTM_ONE_TIME_STEP_S16_FORGET_TO_CELL_MULTIPLIER 1073741824 +#define LSTM_ONE_TIME_STEP_S16_FORGET_TO_CELL_SHIFT -14 +#define LSTM_ONE_TIME_STEP_S16_INPUT_TO_CELL_MULTIPLIER 1565038806 +#define LSTM_ONE_TIME_STEP_S16_INPUT_TO_CELL_SHIFT -20 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_MULTIPLIER 1524093023 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_SHIFT -17 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_HIDDEN_MULTIPLIER 1945843269 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_HIDDEN_SHIFT -13 +#define LSTM_ONE_TIME_STEP_S16_CELL_GATE_HIDDEN_MULTIPLIER 1437693116 +#define LSTM_ONE_TIME_STEP_S16_CELL_GATE_HIDDEN_SHIFT -10 +#define LSTM_ONE_TIME_STEP_S16_FORGET_GATE_HIDDEN_MULTIPLIER 1852888973 +#define LSTM_ONE_TIME_STEP_S16_FORGET_GATE_HIDDEN_SHIFT -11 +#define LSTM_ONE_TIME_STEP_S16_INPUT_GATE_HIDDEN_MULTIPLIER 2023305183 +#define LSTM_ONE_TIME_STEP_S16_INPUT_GATE_HIDDEN_SHIFT -11 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_INPUT_MULTIPLIER 1844224047 +#define LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_INPUT_SHIFT -10 +#define LSTM_ONE_TIME_STEP_S16_CELL_GATE_INPUT_MULTIPLIER 1083993912 +#define LSTM_ONE_TIME_STEP_S16_CELL_GATE_INPUT_SHIFT -8 +#define LSTM_ONE_TIME_STEP_S16_FORGET_GATE_INPUT_MULTIPLIER 1649555954 +#define LSTM_ONE_TIME_STEP_S16_FORGET_GATE_INPUT_SHIFT -8 +#define LSTM_ONE_TIME_STEP_S16_INPUT_GATE_INPUT_MULTIPLIER 1700784399 +#define LSTM_ONE_TIME_STEP_S16_INPUT_GATE_INPUT_SHIFT -8 diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_bias.h index ee744c92..047a8443 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_one_time_step_s16_forget_gate_bias[3] = {2956, 21127, 23202}; \ No newline at end of file +const int64_t lstm_one_time_step_s16_forget_gate_bias[3] = {14529, 13118, 1628}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_hidden_weights.h index 1c2e881b..ab1f6610 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_hidden_weights.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int8_t lstm_one_time_step_s16_forget_gate_hidden_weights[9] = {43, 123, -49, -80, 18, -113, 97, 41, 74}; \ No newline at end of file +const int8_t lstm_one_time_step_s16_forget_gate_hidden_weights[9] = {104, -91, 102, 30, 25, 41, 48, -59, 14}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_input_weights.h index 883e0c9b..0a6f17a5 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/forget_gate_input_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_one_time_step_s16_forget_gate_input_weights[66] = { - 25, -38, 56, -13, 108, -21, 92, -97, 118, 105, 101, -2, -44, 123, -17, -23, 3, 92, 118, -115, -18, 78, - 27, 103, -108, -41, -8, 37, -115, 55, 59, 56, 15, 76, -119, 18, -72, 124, 20, -8, -29, 75, 66, 28, - 51, -44, 42, -13, 101, 41, -102, 30, -118, -55, -19, 13, -106, 19, 19, 118, 106, -79, -15, -125, 29, -109}; \ No newline at end of file + -95, -28, -62, -60, 123, -123, -7, 115, -116, 94, -4, 113, -72, 87, -28, 57, 32, 22, 49, -61, 19, 124, + -51, -27, 122, 3, 118, -127, -76, -126, -39, 63, 81, 57, 24, -92, -97, -36, 74, 126, 72, 35, -48, 122, + 117, 37, -69, -68, -126, 22, 69, 90, -29, -101, -110, 34, 79, 117, -52, 80, 117, -69, 12, -119, 1, 4}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_bias.h index 10828957..71095ac9 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_one_time_step_s16_input_gate_bias[3] = {20943, 5502, 20939}; \ No newline at end of file +const int64_t lstm_one_time_step_s16_input_gate_bias[3] = {29790, 27638, 11906}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_hidden_weights.h index a7953bf8..ebe57b93 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_hidden_weights.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int8_t lstm_one_time_step_s16_input_gate_hidden_weights[9] = {76, 36, 15, 85, 17, 55, 33, 25, -31}; \ No newline at end of file +const int8_t lstm_one_time_step_s16_input_gate_hidden_weights[9] = {-10, -61, 87, 27, 23, -112, 1, -48, -108}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_input_weights.h index 74270d4e..78d32cb5 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_gate_input_weights.h @@ -1,9 +1,9 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_one_time_step_s16_input_gate_input_weights[66] = { - 18, -27, 78, 115, 101, -86, 106, 102, 23, 30, 13, -90, -89, -67, 51, 11, -97, -34, -113, 87, 88, 15, - 55, -55, -116, -11, -72, 101, -107, 59, -29, -119, 109, -4, 120, -22, 4, 57, 26, -87, 79, 19, 81, 28, - -126, 96, 115, -100, 27, 34, 14, 78, 84, 28, -56, -67, 75, 33, -93, -70, 19, 76, 103, -47, 35, 69}; \ No newline at end of file + 38, 119, 54, 16, -100, 83, -106, 47, -115, 121, 33, 123, 78, 37, -88, -62, -106, -125, -86, -25, -44, -116, + 64, -54, -110, 50, -126, -88, -35, 45, 40, -72, -76, -72, 14, 21, -42, -9, -29, 44, 79, 47, -4, -47, + -67, -33, -5, 63, -49, -88, -80, 49, 60, 92, 78, 48, 48, -126, 63, -61, 9, -74, -45, 53, -52, 9}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_tensor.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_tensor.h new file mode 100644 index 00000000..f2d57c71 --- /dev/null +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/input_tensor.h @@ -0,0 +1,11 @@ +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. +#pragma once +#include + +const int16_t lstm_one_time_step_s16_input_tensor[66] = { + -16287, 4696, -6961, 3357, 15595, 31576, 26251, 1813, 2173, 28737, 32330, -18617, 298, -25281, + -11062, -22277, 26496, -26545, 4746, -22222, 6730, 27855, 21135, 19110, -25974, -15651, -5091, 10542, + 7763, -8311, 29626, 8996, 11264, -8997, -27220, -2225, 4152, -23729, -25959, -4246, -6581, 3501, + 1592, -23307, -19126, -18534, -15138, 7605, -14916, 30437, 5699, -14390, -29697, 14755, 16755, 6981, + -1749, 14744, -4448, -3969, -17400, 5413, 15101, 32302, -25096, 27324}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output.h index d2858128..82a3b096 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int16_t lstm_one_time_step_s16_output[9] = {2054, 0, 0, 1138, 129, 0, -61, -2801, 225}; \ No newline at end of file +const int16_t lstm_one_time_step_s16_output[9] = {646, 0, 1189, 2742, -3109, 696, -2134, -69, 1808}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_bias.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_bias.h index 0fc61ce6..d1def7bb 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_bias.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_bias.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int64_t lstm_one_time_step_s16_output_gate_bias[3] = {32739, 16303, 29216}; \ No newline at end of file +const int64_t lstm_one_time_step_s16_output_gate_bias[3] = {30715, 11734, 9928}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_hidden_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_hidden_weights.h index 3f105f76..25fbc72f 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_hidden_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_hidden_weights.h @@ -1,6 +1,6 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include -const int8_t lstm_one_time_step_s16_output_gate_hidden_weights[9] = {63, 24, 19, 25, 71, -107, 75, -20, 80}; \ No newline at end of file +const int8_t lstm_one_time_step_s16_output_gate_hidden_weights[9] = {82, -35, -112, -37, 97, -102, -99, 84, -72}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_input_weights.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_input_weights.h index 246948eb..640a1a74 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_input_weights.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/output_gate_input_weights.h @@ -1,9 +1,10 @@ -// Generated by RefactoredTestGen/test.py using flatc version 23.5.26 -// Interpreter from tflite_micro runtime version 0.dev20240224054047-gcfa4c91. +// Generated by generate_test_data.py using flatc version 2.0.6 +// Interpreter from tflite_micro runtime version 0.dev20240814215812-g07e7f33. #pragma once #include const int8_t lstm_one_time_step_s16_output_gate_input_weights[66] = { - 107, 18, 61, 4, 27, 96, 76, -43, -48, -63, -25, 18, -58, -69, 101, -75, -36, 68, 61, 126, 122, 78, - 90, -88, -36, 115, -6, -28, 99, 96, 55, -108, -34, 70, 102, 116, 98, -103, -55, 76, 98, -78, -53, 81, - -47, 66, 98, -128, 103, -98, -124, -25, -37, -19, -60, 4, 46, 28, 90, 88, -90, -71, 124, 52, 58, 83}; \ No newline at end of file + 67, -47, -127, -110, 116, -2, 122, -26, 91, -110, 11, -35, -5, 109, -51, 20, -83, + -14, 24, -75, -104, 116, 43, 36, -83, -112, 24, 116, -116, 56, 121, 89, 96, -106, + -4, -65, 37, 100, -118, -47, -40, -65, -24, -18, -5, -110, 23, 83, 30, 120, -30, + 55, -47, -99, -38, -9, -11, 82, 10, -127, -29, 40, 100, -57, -71, -95}; diff --git a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/test_data.h b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/test_data.h index 8355af79..ff07f2a6 100644 --- a/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/test_data.h +++ b/Tests/UnitTest/TestCases/TestData/lstm_one_time_step_s16/test_data.h @@ -5,10 +5,10 @@ #include "forget_gate_bias.h" #include "forget_gate_hidden_weights.h" #include "forget_gate_input_weights.h" -#include "input.h" #include "input_gate_bias.h" #include "input_gate_hidden_weights.h" #include "input_gate_input_weights.h" +#include "input_tensor.h" #include "output.h" #include "output_gate_bias.h" #include "output_gate_hidden_weights.h" diff --git a/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s16/test_arm_lstm_unidirectional_s16.c b/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s16/test_arm_lstm_unidirectional_s16.c index 83abb468..462ed55e 100644 --- a/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s16/test_arm_lstm_unidirectional_s16.c +++ b/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s16/test_arm_lstm_unidirectional_s16.c @@ -27,7 +27,7 @@ #include // update the buffer size if adding a unit test with larger buffer. -#define LARGEST_BUFFER_SIZE lstm_1_s16_hidden_size *lstm_1_s16_batch_size *lstm_1_s16_time_steps +#define LARGEST_BUFFER_SIZE LSTM_1_S16_HIDDEN_SIZE *LSTM_1_S16_BATCH_SIZE *LSTM_1_S16_TIME_STEPS int16_t buffer1[LARGEST_BUFFER_SIZE]; int16_t buffer2[LARGEST_BUFFER_SIZE]; @@ -35,135 +35,135 @@ int16_t buffer3[LARGEST_BUFFER_SIZE]; void lstm_1_s16(void) { - int16_t output[lstm_1_s16_batch_size * lstm_1_s16_time_steps * lstm_1_s16_hidden_size] = {0}; + int16_t output[LSTM_1_S16_BATCH_SIZE * LSTM_1_S16_TIME_STEPS * LSTM_1_S16_HIDDEN_SIZE] = {0}; const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS; const int16_t *output_ref = &lstm_1_s16_output[0]; - const int32_t output_ref_size = lstm_1_s16_batch_size * lstm_1_s16_time_steps * lstm_1_s16_hidden_size; + const int32_t output_ref_size = LSTM_1_S16_BATCH_SIZE * LSTM_1_S16_TIME_STEPS * LSTM_1_S16_HIDDEN_SIZE; - int64_t input_data_kernel_sum[lstm_1_s16_hidden_size]; - int64_t forget_data_kernel_sum[lstm_1_s16_hidden_size]; - int64_t cell_data_kernel_sum[lstm_1_s16_hidden_size]; - int64_t output_data_kernel_sum[lstm_1_s16_hidden_size]; + int64_t input_data_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; + int64_t forget_data_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; + int64_t cell_data_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; + int64_t output_data_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; - int64_t input_hidden_kernel_sum[lstm_1_s16_hidden_size]; - int64_t forget_hidden_kernel_sum[lstm_1_s16_hidden_size]; - int64_t cell_hidden_kernel_sum[lstm_1_s16_hidden_size]; - int64_t output_hidden_kernel_sum[lstm_1_s16_hidden_size]; + int64_t input_hidden_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; + int64_t forget_hidden_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; + int64_t cell_hidden_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; + int64_t output_hidden_kernel_sum[LSTM_1_S16_HIDDEN_SIZE]; arm_vector_sum_s8_s64(&input_data_kernel_sum[0], - lstm_1_s16_input_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_INPUT_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_input_gate_input_weights[0], - lstm_1_s16_input_zero_point, + LSTM_1_S16_INPUT_ZERO_POINT, &lstm_1_s16_input_gate_bias[0]); arm_vector_sum_s8_s64(&forget_data_kernel_sum[0], - lstm_1_s16_input_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_INPUT_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_forget_gate_input_weights[0], - lstm_1_s16_input_zero_point, + LSTM_1_S16_INPUT_ZERO_POINT, &lstm_1_s16_forget_gate_bias[0]); arm_vector_sum_s8_s64(&cell_data_kernel_sum[0], - lstm_1_s16_input_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_INPUT_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_cell_gate_input_weights[0], - lstm_1_s16_input_zero_point, + LSTM_1_S16_INPUT_ZERO_POINT, &lstm_1_s16_cell_gate_bias[0]); arm_vector_sum_s8_s64(&output_data_kernel_sum[0], - lstm_1_s16_input_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_INPUT_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_output_gate_input_weights[0], - lstm_1_s16_input_zero_point, + LSTM_1_S16_INPUT_ZERO_POINT, &lstm_1_s16_output_gate_bias[0]); arm_vector_sum_s8_s64(&input_hidden_kernel_sum[0], - lstm_1_s16_hidden_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_HIDDEN_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_input_gate_hidden_weights[0], - -lstm_1_s16_output_zero_point, + -LSTM_1_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&forget_hidden_kernel_sum[0], - lstm_1_s16_hidden_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_HIDDEN_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_forget_gate_hidden_weights[0], - -lstm_1_s16_output_zero_point, + -LSTM_1_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&cell_hidden_kernel_sum[0], - lstm_1_s16_hidden_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_HIDDEN_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_cell_gate_hidden_weights[0], - -lstm_1_s16_output_zero_point, + -LSTM_1_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&output_hidden_kernel_sum[0], - lstm_1_s16_hidden_size, - lstm_1_s16_hidden_size, + LSTM_1_S16_HIDDEN_SIZE, + LSTM_1_S16_HIDDEN_SIZE, &lstm_1_s16_output_gate_hidden_weights[0], - -lstm_1_s16_output_zero_point, + -LSTM_1_S16_OUTPUT_ZERO_POINT, NULL); // INPUT GATE - const cmsis_nn_lstm_gate gate_input = {lstm_1_s16_input_gate_input_multiplier, - lstm_1_s16_input_gate_input_shift, + const cmsis_nn_lstm_gate gate_input = {LSTM_1_S16_INPUT_GATE_INPUT_MULTIPLIER, + LSTM_1_S16_INPUT_GATE_INPUT_SHIFT, &lstm_1_s16_input_gate_input_weights[0], &input_data_kernel_sum[0], - lstm_1_s16_input_gate_hidden_multiplier, - lstm_1_s16_input_gate_hidden_shift, + LSTM_1_S16_INPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_1_S16_INPUT_GATE_HIDDEN_SHIFT, &lstm_1_s16_input_gate_hidden_weights[0], &input_hidden_kernel_sum[0], &lstm_1_s16_input_gate_bias[0], ARM_SIGMOID}; // FORGET GATE - const cmsis_nn_lstm_gate gate_forget = {lstm_1_s16_forget_gate_input_multiplier, - lstm_1_s16_forget_gate_input_shift, + const cmsis_nn_lstm_gate gate_forget = {LSTM_1_S16_FORGET_GATE_INPUT_MULTIPLIER, + LSTM_1_S16_FORGET_GATE_INPUT_SHIFT, &lstm_1_s16_forget_gate_input_weights[0], &forget_data_kernel_sum[0], - lstm_1_s16_forget_gate_hidden_multiplier, - lstm_1_s16_forget_gate_hidden_shift, + LSTM_1_S16_FORGET_GATE_HIDDEN_MULTIPLIER, + LSTM_1_S16_FORGET_GATE_HIDDEN_SHIFT, &lstm_1_s16_forget_gate_hidden_weights[0], &forget_hidden_kernel_sum[0], &lstm_1_s16_forget_gate_bias[0], ARM_SIGMOID}; // CELL GATE - const cmsis_nn_lstm_gate gate_cell = {lstm_1_s16_cell_gate_input_multiplier, - lstm_1_s16_cell_gate_input_shift, + const cmsis_nn_lstm_gate gate_cell = {LSTM_1_S16_CELL_GATE_INPUT_MULTIPLIER, + LSTM_1_S16_CELL_GATE_INPUT_SHIFT, &lstm_1_s16_cell_gate_input_weights[0], &cell_data_kernel_sum[0], - lstm_1_s16_cell_gate_hidden_multiplier, - lstm_1_s16_cell_gate_hidden_shift, + LSTM_1_S16_CELL_GATE_HIDDEN_MULTIPLIER, + LSTM_1_S16_CELL_GATE_HIDDEN_SHIFT, &lstm_1_s16_cell_gate_hidden_weights[0], &cell_hidden_kernel_sum[0], &lstm_1_s16_cell_gate_bias[0], ARM_TANH}; // OUTPUT GATE - const cmsis_nn_lstm_gate gate_output = {lstm_1_s16_output_gate_input_multiplier, - lstm_1_s16_output_gate_input_shift, + const cmsis_nn_lstm_gate gate_output = {LSTM_1_S16_OUTPUT_GATE_INPUT_MULTIPLIER, + LSTM_1_S16_OUTPUT_GATE_INPUT_SHIFT, &lstm_1_s16_output_gate_input_weights[0], &output_data_kernel_sum[0], - lstm_1_s16_output_gate_hidden_multiplier, - lstm_1_s16_output_gate_hidden_shift, + LSTM_1_S16_OUTPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_1_S16_OUTPUT_GATE_HIDDEN_SHIFT, &lstm_1_s16_output_gate_hidden_weights[0], &output_hidden_kernel_sum[0], &lstm_1_s16_output_gate_bias[0], ARM_SIGMOID}; // LSTM DATA - const cmsis_nn_lstm_params params = {lstm_1_s16_time_major, - lstm_1_s16_batch_size, - lstm_1_s16_time_steps, - lstm_1_s16_input_size, - lstm_1_s16_hidden_size, - lstm_1_s16_input_zero_point, - lstm_1_s16_forget_to_cell_multiplier, - lstm_1_s16_forget_to_cell_shift, - lstm_1_s16_input_to_cell_multiplier, - lstm_1_s16_input_to_cell_shift, - lstm_1_s16_cell_clip, - lstm_1_s16_cell_scale_power, - lstm_1_s16_output_multiplier, - lstm_1_s16_output_shift, - lstm_1_s16_output_zero_point, + const cmsis_nn_lstm_params params = {LSTM_1_S16_TIME_MAJOR, + LSTM_1_S16_BATCH_SIZE, + LSTM_1_S16_TIME_STEPS, + LSTM_1_S16_INPUT_SIZE, + LSTM_1_S16_HIDDEN_SIZE, + LSTM_1_S16_INPUT_ZERO_POINT, + LSTM_1_S16_FORGET_TO_CELL_MULTIPLIER, + LSTM_1_S16_FORGET_TO_CELL_SHIFT, + LSTM_1_S16_INPUT_TO_CELL_MULTIPLIER, + LSTM_1_S16_INPUT_TO_CELL_SHIFT, + LSTM_1_S16_CELL_CLIP, + LSTM_1_S16_CELL_SCALE_POWER, + LSTM_1_S16_OUTPUT_MULTIPLIER, + LSTM_1_S16_OUTPUT_SHIFT, + LSTM_1_S16_OUTPUT_ZERO_POINT, gate_forget, gate_input, gate_cell, @@ -174,142 +174,142 @@ void lstm_1_s16(void) buffers.temp2 = buffer2; buffers.cell_state = buffer3; - arm_cmsis_nn_status result = arm_lstm_unidirectional_s16(lstm_1_s16_input, output, ¶ms, &buffers); + arm_cmsis_nn_status result = arm_lstm_unidirectional_s16(lstm_1_s16_input_tensor, output, ¶ms, &buffers); TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_TRUE(validate_s16(output, output_ref, output_ref_size)); } void lstm_2_s16(void) { - int16_t output[lstm_2_s16_batch_size * lstm_2_s16_time_steps * lstm_2_s16_hidden_size] = {0}; + int16_t output[LSTM_2_S16_BATCH_SIZE * LSTM_2_S16_TIME_STEPS * LSTM_2_S16_HIDDEN_SIZE] = {0}; const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS; const int16_t *output_ref = &lstm_2_s16_output[0]; - const int32_t output_ref_size = lstm_2_s16_batch_size * lstm_2_s16_time_steps * lstm_2_s16_hidden_size; + const int32_t output_ref_size = LSTM_2_S16_BATCH_SIZE * LSTM_2_S16_TIME_STEPS * LSTM_2_S16_HIDDEN_SIZE; - int64_t input_data_kernel_sum[lstm_2_s16_hidden_size]; - int64_t forget_data_kernel_sum[lstm_2_s16_hidden_size]; - int64_t cell_data_kernel_sum[lstm_2_s16_hidden_size]; - int64_t output_data_kernel_sum[lstm_2_s16_hidden_size]; + int64_t input_data_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; + int64_t forget_data_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; + int64_t cell_data_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; + int64_t output_data_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; - int64_t input_hidden_kernel_sum[lstm_2_s16_hidden_size]; - int64_t forget_hidden_kernel_sum[lstm_2_s16_hidden_size]; - int64_t cell_hidden_kernel_sum[lstm_2_s16_hidden_size]; - int64_t output_hidden_kernel_sum[lstm_2_s16_hidden_size]; + int64_t input_hidden_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; + int64_t forget_hidden_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; + int64_t cell_hidden_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; + int64_t output_hidden_kernel_sum[LSTM_2_S16_HIDDEN_SIZE]; arm_vector_sum_s8_s64(&input_data_kernel_sum[0], - lstm_2_s16_input_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_INPUT_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_input_gate_input_weights[0], - lstm_2_s16_input_zero_point, + LSTM_2_S16_INPUT_ZERO_POINT, &lstm_2_s16_input_gate_bias[0]); arm_vector_sum_s8_s64(&forget_data_kernel_sum[0], - lstm_2_s16_input_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_INPUT_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_forget_gate_input_weights[0], - lstm_2_s16_input_zero_point, + LSTM_2_S16_INPUT_ZERO_POINT, &lstm_2_s16_forget_gate_bias[0]); arm_vector_sum_s8_s64(&cell_data_kernel_sum[0], - lstm_2_s16_input_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_INPUT_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_cell_gate_input_weights[0], - lstm_2_s16_input_zero_point, + LSTM_2_S16_INPUT_ZERO_POINT, &lstm_2_s16_cell_gate_bias[0]); arm_vector_sum_s8_s64(&output_data_kernel_sum[0], - lstm_2_s16_input_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_INPUT_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_output_gate_input_weights[0], - lstm_2_s16_input_zero_point, + LSTM_2_S16_INPUT_ZERO_POINT, &lstm_2_s16_output_gate_bias[0]); arm_vector_sum_s8_s64(&input_hidden_kernel_sum[0], - lstm_2_s16_hidden_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_HIDDEN_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_input_gate_hidden_weights[0], - -lstm_2_s16_output_zero_point, + -LSTM_2_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&forget_hidden_kernel_sum[0], - lstm_2_s16_hidden_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_HIDDEN_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_forget_gate_hidden_weights[0], - -lstm_2_s16_output_zero_point, + -LSTM_2_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&cell_hidden_kernel_sum[0], - lstm_2_s16_hidden_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_HIDDEN_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_cell_gate_hidden_weights[0], - -lstm_2_s16_output_zero_point, + -LSTM_2_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&output_hidden_kernel_sum[0], - lstm_2_s16_hidden_size, - lstm_2_s16_hidden_size, + LSTM_2_S16_HIDDEN_SIZE, + LSTM_2_S16_HIDDEN_SIZE, &lstm_2_s16_output_gate_hidden_weights[0], - -lstm_2_s16_output_zero_point, + -LSTM_2_S16_OUTPUT_ZERO_POINT, NULL); // INPUT GATE - const cmsis_nn_lstm_gate gate_input = {lstm_2_s16_input_gate_input_multiplier, - lstm_2_s16_input_gate_input_shift, + const cmsis_nn_lstm_gate gate_input = {LSTM_2_S16_INPUT_GATE_INPUT_MULTIPLIER, + LSTM_2_S16_INPUT_GATE_INPUT_SHIFT, &lstm_2_s16_input_gate_input_weights[0], &input_data_kernel_sum[0], - lstm_2_s16_input_gate_hidden_multiplier, - lstm_2_s16_input_gate_hidden_shift, + LSTM_2_S16_INPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_2_S16_INPUT_GATE_HIDDEN_SHIFT, &lstm_2_s16_input_gate_hidden_weights[0], &input_hidden_kernel_sum[0], &lstm_2_s16_input_gate_bias[0], ARM_SIGMOID}; // FORGET GATE - const cmsis_nn_lstm_gate gate_forget = {lstm_2_s16_forget_gate_input_multiplier, - lstm_2_s16_forget_gate_input_shift, + const cmsis_nn_lstm_gate gate_forget = {LSTM_2_S16_FORGET_GATE_INPUT_MULTIPLIER, + LSTM_2_S16_FORGET_GATE_INPUT_SHIFT, &lstm_2_s16_forget_gate_input_weights[0], &forget_data_kernel_sum[0], - lstm_2_s16_forget_gate_hidden_multiplier, - lstm_2_s16_forget_gate_hidden_shift, + LSTM_2_S16_FORGET_GATE_HIDDEN_MULTIPLIER, + LSTM_2_S16_FORGET_GATE_HIDDEN_SHIFT, &lstm_2_s16_forget_gate_hidden_weights[0], &forget_hidden_kernel_sum[0], &lstm_2_s16_forget_gate_bias[0], ARM_SIGMOID}; // CELL GATE - const cmsis_nn_lstm_gate gate_cell = {lstm_2_s16_cell_gate_input_multiplier, - lstm_2_s16_cell_gate_input_shift, + const cmsis_nn_lstm_gate gate_cell = {LSTM_2_S16_CELL_GATE_INPUT_MULTIPLIER, + LSTM_2_S16_CELL_GATE_INPUT_SHIFT, &lstm_2_s16_cell_gate_input_weights[0], &cell_data_kernel_sum[0], - lstm_2_s16_cell_gate_hidden_multiplier, - lstm_2_s16_cell_gate_hidden_shift, + LSTM_2_S16_CELL_GATE_HIDDEN_MULTIPLIER, + LSTM_2_S16_CELL_GATE_HIDDEN_SHIFT, &lstm_2_s16_cell_gate_hidden_weights[0], &cell_hidden_kernel_sum[0], &lstm_2_s16_cell_gate_bias[0], ARM_TANH}; // OUTPUT GATE - const cmsis_nn_lstm_gate gate_output = {lstm_2_s16_output_gate_input_multiplier, - lstm_2_s16_output_gate_input_shift, + const cmsis_nn_lstm_gate gate_output = {LSTM_2_S16_OUTPUT_GATE_INPUT_MULTIPLIER, + LSTM_2_S16_OUTPUT_GATE_INPUT_SHIFT, &lstm_2_s16_output_gate_input_weights[0], &output_data_kernel_sum[0], - lstm_2_s16_output_gate_hidden_multiplier, - lstm_2_s16_output_gate_hidden_shift, + LSTM_2_S16_OUTPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_2_S16_OUTPUT_GATE_HIDDEN_SHIFT, &lstm_2_s16_output_gate_hidden_weights[0], &output_hidden_kernel_sum[0], &lstm_2_s16_output_gate_bias[0], ARM_SIGMOID}; // LSTM DATA - const cmsis_nn_lstm_params params = {lstm_2_s16_time_major, - lstm_2_s16_batch_size, - lstm_2_s16_time_steps, - lstm_2_s16_input_size, - lstm_2_s16_hidden_size, - lstm_2_s16_input_zero_point, - lstm_2_s16_forget_to_cell_multiplier, - lstm_2_s16_forget_to_cell_shift, - lstm_2_s16_input_to_cell_multiplier, - lstm_2_s16_input_to_cell_shift, - lstm_2_s16_cell_clip, - lstm_2_s16_cell_scale_power, - lstm_2_s16_output_multiplier, - lstm_2_s16_output_shift, - lstm_2_s16_output_zero_point, + const cmsis_nn_lstm_params params = {LSTM_2_S16_TIME_MAJOR, + LSTM_2_S16_BATCH_SIZE, + LSTM_2_S16_TIME_STEPS, + LSTM_2_S16_INPUT_SIZE, + LSTM_2_S16_HIDDEN_SIZE, + LSTM_2_S16_INPUT_ZERO_POINT, + LSTM_2_S16_FORGET_TO_CELL_MULTIPLIER, + LSTM_2_S16_FORGET_TO_CELL_SHIFT, + LSTM_2_S16_INPUT_TO_CELL_MULTIPLIER, + LSTM_2_S16_INPUT_TO_CELL_SHIFT, + LSTM_2_S16_CELL_CLIP, + LSTM_2_S16_CELL_SCALE_POWER, + LSTM_2_S16_OUTPUT_MULTIPLIER, + LSTM_2_S16_OUTPUT_SHIFT, + LSTM_2_S16_OUTPUT_ZERO_POINT, gate_forget, gate_input, gate_cell, @@ -320,144 +320,144 @@ void lstm_2_s16(void) buffers.temp2 = buffer2; buffers.cell_state = buffer3; - arm_cmsis_nn_status result = arm_lstm_unidirectional_s16(lstm_2_s16_input, output, ¶ms, &buffers); + arm_cmsis_nn_status result = arm_lstm_unidirectional_s16(lstm_2_s16_input_tensor, output, ¶ms, &buffers); TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_TRUE(validate_s16(output, output_ref, output_ref_size)); } void lstm_one_time_step_s16(void) { - int16_t output[lstm_one_time_step_s16_batch_size * lstm_one_time_step_s16_time_steps * - lstm_one_time_step_s16_hidden_size] = {0}; + int16_t output[LSTM_ONE_TIME_STEP_S16_BATCH_SIZE * LSTM_ONE_TIME_STEP_S16_TIME_STEPS * + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE] = {0}; const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS; const int16_t *output_ref = &lstm_one_time_step_s16_output[0]; const int32_t output_ref_size = - lstm_one_time_step_s16_batch_size * lstm_one_time_step_s16_time_steps * lstm_one_time_step_s16_hidden_size; + LSTM_ONE_TIME_STEP_S16_BATCH_SIZE * LSTM_ONE_TIME_STEP_S16_TIME_STEPS * LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE; - int64_t input_data_kernel_sum[lstm_one_time_step_s16_hidden_size]; - int64_t forget_data_kernel_sum[lstm_one_time_step_s16_hidden_size]; - int64_t cell_data_kernel_sum[lstm_one_time_step_s16_hidden_size]; - int64_t output_data_kernel_sum[lstm_one_time_step_s16_hidden_size]; + int64_t input_data_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; + int64_t forget_data_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; + int64_t cell_data_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; + int64_t output_data_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; - int64_t input_hidden_kernel_sum[lstm_one_time_step_s16_hidden_size]; - int64_t forget_hidden_kernel_sum[lstm_one_time_step_s16_hidden_size]; - int64_t cell_hidden_kernel_sum[lstm_one_time_step_s16_hidden_size]; - int64_t output_hidden_kernel_sum[lstm_one_time_step_s16_hidden_size]; + int64_t input_hidden_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; + int64_t forget_hidden_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; + int64_t cell_hidden_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; + int64_t output_hidden_kernel_sum[LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE]; arm_vector_sum_s8_s64(&input_data_kernel_sum[0], - lstm_one_time_step_s16_input_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_INPUT_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_input_gate_input_weights[0], - lstm_one_time_step_s16_input_zero_point, + LSTM_ONE_TIME_STEP_S16_INPUT_ZERO_POINT, &lstm_one_time_step_s16_input_gate_bias[0]); arm_vector_sum_s8_s64(&forget_data_kernel_sum[0], - lstm_one_time_step_s16_input_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_INPUT_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_forget_gate_input_weights[0], - lstm_one_time_step_s16_input_zero_point, + LSTM_ONE_TIME_STEP_S16_INPUT_ZERO_POINT, &lstm_one_time_step_s16_forget_gate_bias[0]); arm_vector_sum_s8_s64(&cell_data_kernel_sum[0], - lstm_one_time_step_s16_input_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_INPUT_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_cell_gate_input_weights[0], - lstm_one_time_step_s16_input_zero_point, + LSTM_ONE_TIME_STEP_S16_INPUT_ZERO_POINT, &lstm_one_time_step_s16_cell_gate_bias[0]); arm_vector_sum_s8_s64(&output_data_kernel_sum[0], - lstm_one_time_step_s16_input_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_INPUT_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_output_gate_input_weights[0], - lstm_one_time_step_s16_input_zero_point, + LSTM_ONE_TIME_STEP_S16_INPUT_ZERO_POINT, &lstm_one_time_step_s16_output_gate_bias[0]); arm_vector_sum_s8_s64(&input_hidden_kernel_sum[0], - lstm_one_time_step_s16_hidden_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_input_gate_hidden_weights[0], - -lstm_one_time_step_s16_output_zero_point, + -LSTM_ONE_TIME_STEP_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&forget_hidden_kernel_sum[0], - lstm_one_time_step_s16_hidden_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_forget_gate_hidden_weights[0], - -lstm_one_time_step_s16_output_zero_point, + -LSTM_ONE_TIME_STEP_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&cell_hidden_kernel_sum[0], - lstm_one_time_step_s16_hidden_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_cell_gate_hidden_weights[0], - -lstm_one_time_step_s16_output_zero_point, + -LSTM_ONE_TIME_STEP_S16_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8_s64(&output_hidden_kernel_sum[0], - lstm_one_time_step_s16_hidden_size, - lstm_one_time_step_s16_hidden_size, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, &lstm_one_time_step_s16_output_gate_hidden_weights[0], - -lstm_one_time_step_s16_output_zero_point, + -LSTM_ONE_TIME_STEP_S16_OUTPUT_ZERO_POINT, NULL); // INPUT GATE - const cmsis_nn_lstm_gate gate_input = {lstm_one_time_step_s16_input_gate_input_multiplier, - lstm_one_time_step_s16_input_gate_input_shift, + const cmsis_nn_lstm_gate gate_input = {LSTM_ONE_TIME_STEP_S16_INPUT_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_INPUT_GATE_INPUT_SHIFT, &lstm_one_time_step_s16_input_gate_input_weights[0], &input_data_kernel_sum[0], - lstm_one_time_step_s16_input_gate_hidden_multiplier, - lstm_one_time_step_s16_input_gate_hidden_shift, + LSTM_ONE_TIME_STEP_S16_INPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_INPUT_GATE_HIDDEN_SHIFT, &lstm_one_time_step_s16_input_gate_hidden_weights[0], &input_hidden_kernel_sum[0], &lstm_one_time_step_s16_input_gate_bias[0], ARM_SIGMOID}; // FORGET GATE - const cmsis_nn_lstm_gate gate_forget = {lstm_one_time_step_s16_forget_gate_input_multiplier, - lstm_one_time_step_s16_forget_gate_input_shift, + const cmsis_nn_lstm_gate gate_forget = {LSTM_ONE_TIME_STEP_S16_FORGET_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_FORGET_GATE_INPUT_SHIFT, &lstm_one_time_step_s16_forget_gate_input_weights[0], &forget_data_kernel_sum[0], - lstm_one_time_step_s16_forget_gate_hidden_multiplier, - lstm_one_time_step_s16_forget_gate_hidden_shift, + LSTM_ONE_TIME_STEP_S16_FORGET_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_FORGET_GATE_HIDDEN_SHIFT, &lstm_one_time_step_s16_forget_gate_hidden_weights[0], &forget_hidden_kernel_sum[0], &lstm_one_time_step_s16_forget_gate_bias[0], ARM_SIGMOID}; // CELL GATE - const cmsis_nn_lstm_gate gate_cell = {lstm_one_time_step_s16_cell_gate_input_multiplier, - lstm_one_time_step_s16_cell_gate_input_shift, + const cmsis_nn_lstm_gate gate_cell = {LSTM_ONE_TIME_STEP_S16_CELL_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_CELL_GATE_INPUT_SHIFT, &lstm_one_time_step_s16_cell_gate_input_weights[0], &cell_data_kernel_sum[0], - lstm_one_time_step_s16_cell_gate_hidden_multiplier, - lstm_one_time_step_s16_cell_gate_hidden_shift, + LSTM_ONE_TIME_STEP_S16_CELL_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_CELL_GATE_HIDDEN_SHIFT, &lstm_one_time_step_s16_cell_gate_hidden_weights[0], &cell_hidden_kernel_sum[0], &lstm_one_time_step_s16_cell_gate_bias[0], ARM_TANH}; // OUTPUT GATE - const cmsis_nn_lstm_gate gate_output = {lstm_one_time_step_s16_output_gate_input_multiplier, - lstm_one_time_step_s16_output_gate_input_shift, + const cmsis_nn_lstm_gate gate_output = {LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_INPUT_SHIFT, &lstm_one_time_step_s16_output_gate_input_weights[0], &output_data_kernel_sum[0], - lstm_one_time_step_s16_output_gate_hidden_multiplier, - lstm_one_time_step_s16_output_gate_hidden_shift, + LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_OUTPUT_GATE_HIDDEN_SHIFT, &lstm_one_time_step_s16_output_gate_hidden_weights[0], &output_hidden_kernel_sum[0], &lstm_one_time_step_s16_output_gate_bias[0], ARM_SIGMOID}; // LSTM DATA - const cmsis_nn_lstm_params params = {lstm_one_time_step_s16_time_major, - lstm_one_time_step_s16_batch_size, - lstm_one_time_step_s16_time_steps, - lstm_one_time_step_s16_input_size, - lstm_one_time_step_s16_hidden_size, - lstm_one_time_step_s16_input_zero_point, - lstm_one_time_step_s16_forget_to_cell_multiplier, - lstm_one_time_step_s16_forget_to_cell_shift, - lstm_one_time_step_s16_input_to_cell_multiplier, - lstm_one_time_step_s16_input_to_cell_shift, - lstm_one_time_step_s16_cell_clip, - lstm_one_time_step_s16_cell_scale_power, - lstm_one_time_step_s16_output_multiplier, - lstm_one_time_step_s16_output_shift, - lstm_one_time_step_s16_output_zero_point, + const cmsis_nn_lstm_params params = {LSTM_ONE_TIME_STEP_S16_TIME_MAJOR, + LSTM_ONE_TIME_STEP_S16_BATCH_SIZE, + LSTM_ONE_TIME_STEP_S16_TIME_STEPS, + LSTM_ONE_TIME_STEP_S16_INPUT_SIZE, + LSTM_ONE_TIME_STEP_S16_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_S16_INPUT_ZERO_POINT, + LSTM_ONE_TIME_STEP_S16_FORGET_TO_CELL_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_FORGET_TO_CELL_SHIFT, + LSTM_ONE_TIME_STEP_S16_INPUT_TO_CELL_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_INPUT_TO_CELL_SHIFT, + LSTM_ONE_TIME_STEP_S16_CELL_CLIP, + LSTM_ONE_TIME_STEP_S16_CELL_SCALE_POWER, + LSTM_ONE_TIME_STEP_S16_OUTPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_S16_OUTPUT_SHIFT, + LSTM_ONE_TIME_STEP_S16_OUTPUT_ZERO_POINT, gate_forget, gate_input, gate_cell, @@ -468,7 +468,8 @@ void lstm_one_time_step_s16(void) buffers.temp2 = buffer2; buffers.cell_state = buffer3; - arm_cmsis_nn_status result = arm_lstm_unidirectional_s16(lstm_one_time_step_s16_input, output, ¶ms, &buffers); + arm_cmsis_nn_status result = + arm_lstm_unidirectional_s16(lstm_one_time_step_s16_input_tensor, output, ¶ms, &buffers); TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_TRUE(validate_s16(output, output_ref, output_ref_size)); diff --git a/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/Unity/unity_test_arm_lstm_unidirectional_s8.c b/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/Unity/unity_test_arm_lstm_unidirectional_s8.c index 28dadf9b..157c3b96 100644 --- a/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/Unity/unity_test_arm_lstm_unidirectional_s8.c +++ b/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/Unity/unity_test_arm_lstm_unidirectional_s8.c @@ -44,6 +44,6 @@ void setUp(void) */ void tearDown(void) {} -void test_lstm_1_arm_lstm_unidirectional_s8(void) { lstm_1_arm_lstm_unidirectional_s8(); } -void test_lstm_2_arm_lstm_unidirectional_s8(void) { lstm_2_arm_lstm_unidirectional_s8(); } -void test_lstm_one_time_step_arm_lstm_unidirectional_s8(void) { lstm_one_time_step_arm_lstm_unidirectional_s8(); } +void test_lstm_1_arm_lstm_unidirectional_s8(void) { lstm_1(); } +void test_lstm_2_arm_lstm_unidirectional_s8(void) { lstm_2(); } +void test_lstm_one_time_step_arm_lstm_unidirectional_s8(void) { lstm_one_time_step(); } diff --git a/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/test_arm_lstm_unidirectional_s8.c b/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/test_arm_lstm_unidirectional_s8.c index 1d132686..c3bdaf46 100644 --- a/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/test_arm_lstm_unidirectional_s8.c +++ b/Tests/UnitTest/TestCases/test_arm_lstm_unidirectional_s8/test_arm_lstm_unidirectional_s8.c @@ -27,469 +27,449 @@ #include "../TestData/lstm_one_time_step/test_data.h" #include "../Utils/validate.h" -#if (LSTM_2_BUFFER_SIZE > LSTM_1_BUFFER_SIZE) || (LSTM_1_BUFFER_SIZE < LSTM_ONE_TIME_STEP_BUFFER_SIZE) - #error "Test buffers too small." -#endif +// update the buffer size if adding a unit test with larger buffer. +#define LARGEST_BUFFER_SIZE LSTM_1_HIDDEN_SIZE *LSTM_1_BATCH_SIZE *LSTM_1_TIME_STEPS -// Update the buffer size if adding a unit test with larger buffer. -#define LARGEST_BUFFER_SIZE LSTM_1_BUFFER_SIZE +int8_t buffer1[LARGEST_BUFFER_SIZE]; +int8_t buffer2[LARGEST_BUFFER_SIZE]; +int8_t buffer3[LARGEST_BUFFER_SIZE]; -int16_t buffer1[LARGEST_BUFFER_SIZE]; -int16_t buffer2[LARGEST_BUFFER_SIZE]; -int16_t buffer3[LARGEST_BUFFER_SIZE]; - -void lstm_1_arm_lstm_unidirectional_s8(void) +void lstm_1(void) { - int8_t output[LSTM_1_DST_SIZE] = {0}; + int8_t output[LSTM_1_BATCH_SIZE * LSTM_1_TIME_STEPS * LSTM_1_HIDDEN_SIZE] = {0}; const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS; - const int8_t *output_ref = lstm_1_output_ref; - const int32_t output_ref_size = LSTM_1_DST_SIZE; - - // Calculate kernel sums if using MVE-extension - int32_t input_data_kernel_sum[LSTM_1_NUMBER_UNITS]; - int32_t forget_data_kernel_sum[LSTM_1_NUMBER_UNITS]; - int32_t cell_data_kernel_sum[LSTM_1_NUMBER_UNITS]; - int32_t output_data_kernel_sum[LSTM_1_NUMBER_UNITS]; + const int8_t *output_ref = &lstm_1_output[0]; + const int32_t output_ref_size = LSTM_1_BATCH_SIZE * LSTM_1_TIME_STEPS * LSTM_1_HIDDEN_SIZE; - int32_t input_hidden_kernel_sum[LSTM_1_NUMBER_UNITS]; - int32_t forget_hidden_kernel_sum[LSTM_1_NUMBER_UNITS]; - int32_t cell_hidden_kernel_sum[LSTM_1_NUMBER_UNITS]; - int32_t output_hidden_kernel_sum[LSTM_1_NUMBER_UNITS]; + int32_t input_data_kernel_sum[LSTM_1_HIDDEN_SIZE]; + int32_t forget_data_kernel_sum[LSTM_1_HIDDEN_SIZE]; + int32_t cell_data_kernel_sum[LSTM_1_HIDDEN_SIZE]; + int32_t output_data_kernel_sum[LSTM_1_HIDDEN_SIZE]; - int32_t size_data = LSTM_1_NUMBER_INPUTS; - int32_t size_hidden = LSTM_1_NUMBER_UNITS; + int32_t input_hidden_kernel_sum[LSTM_1_HIDDEN_SIZE]; + int32_t forget_hidden_kernel_sum[LSTM_1_HIDDEN_SIZE]; + int32_t cell_hidden_kernel_sum[LSTM_1_HIDDEN_SIZE]; + int32_t output_hidden_kernel_sum[LSTM_1_HIDDEN_SIZE]; arm_vector_sum_s8(&input_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_1_input_to_input_w[0], - LSTM_1_DATA_OFFSET, + LSTM_1_INPUT_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_input_gate_input_weights[0], + LSTM_1_INPUT_ZERO_POINT, &lstm_1_input_gate_bias[0]); arm_vector_sum_s8(&forget_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_1_input_to_forget_w[0], - LSTM_1_DATA_OFFSET, + LSTM_1_INPUT_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_forget_gate_input_weights[0], + LSTM_1_INPUT_ZERO_POINT, &lstm_1_forget_gate_bias[0]); arm_vector_sum_s8(&cell_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_1_input_to_cell_w[0], - LSTM_1_DATA_OFFSET, + LSTM_1_INPUT_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_cell_gate_input_weights[0], + LSTM_1_INPUT_ZERO_POINT, &lstm_1_cell_gate_bias[0]); arm_vector_sum_s8(&output_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_1_input_to_output_w[0], - LSTM_1_DATA_OFFSET, + LSTM_1_INPUT_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_output_gate_input_weights[0], + LSTM_1_INPUT_ZERO_POINT, &lstm_1_output_gate_bias[0]); arm_vector_sum_s8(&input_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_1_recurrent_input_to_input_w[0], - -LSTM_1_HIDDEN_OFFSET, + LSTM_1_HIDDEN_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_input_gate_hidden_weights[0], + -LSTM_1_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&forget_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_1_recurrent_input_to_forget_w[0], - -LSTM_1_HIDDEN_OFFSET, + LSTM_1_HIDDEN_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_forget_gate_hidden_weights[0], + -LSTM_1_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&cell_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_1_recurrent_input_to_cell_w[0], - -LSTM_1_HIDDEN_OFFSET, + LSTM_1_HIDDEN_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_cell_gate_hidden_weights[0], + -LSTM_1_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&output_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_1_recurrent_input_to_output_w[0], - -LSTM_1_HIDDEN_OFFSET, + LSTM_1_HIDDEN_SIZE, + LSTM_1_HIDDEN_SIZE, + &lstm_1_output_gate_hidden_weights[0], + -LSTM_1_OUTPUT_ZERO_POINT, NULL); // INPUT GATE - const cmsis_nn_lstm_gate gate_input = {LSTM_1_IN_TO_INPUT_MULTIPLIER, - LSTM_1_IN_TO_INPUT_SHIFT, - &lstm_1_input_to_input_w[0], + const cmsis_nn_lstm_gate gate_input = {LSTM_1_INPUT_GATE_INPUT_MULTIPLIER, + LSTM_1_INPUT_GATE_INPUT_SHIFT, + &lstm_1_input_gate_input_weights[0], &input_data_kernel_sum[0], - LSTM_1_RECURRENT_TO_INPUT_MULTIPLIER, - LSTM_1_RECURRENT_TO_INPUT_SHIFT, - &lstm_1_recurrent_input_to_input_w[0], + LSTM_1_INPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_1_INPUT_GATE_HIDDEN_SHIFT, + &lstm_1_input_gate_hidden_weights[0], &input_hidden_kernel_sum[0], &lstm_1_input_gate_bias[0], ARM_SIGMOID}; // FORGET GATE - const cmsis_nn_lstm_gate gate_forget = {LSTM_1_IN_TO_FORGET_MULTIPLIER, - LSTM_1_IN_TO_FORGET_SHIFT, - &lstm_1_input_to_forget_w[0], + const cmsis_nn_lstm_gate gate_forget = {LSTM_1_FORGET_GATE_INPUT_MULTIPLIER, + LSTM_1_FORGET_GATE_INPUT_SHIFT, + &lstm_1_forget_gate_input_weights[0], &forget_data_kernel_sum[0], - LSTM_1_RECURRENT_TO_FORGET_MULTIPLIER, - LSTM_1_RECURRENT_TO_FORGET_SHIFT, - &lstm_1_recurrent_input_to_forget_w[0], + LSTM_1_FORGET_GATE_HIDDEN_MULTIPLIER, + LSTM_1_FORGET_GATE_HIDDEN_SHIFT, + &lstm_1_forget_gate_hidden_weights[0], &forget_hidden_kernel_sum[0], &lstm_1_forget_gate_bias[0], ARM_SIGMOID}; // CELL GATE - const cmsis_nn_lstm_gate gate_cell = {LSTM_1_IN_TO_CELL_MULTIPLIER, - LSTM_1_IN_TO_CELL_SHIFT, - &lstm_1_input_to_cell_w[0], + const cmsis_nn_lstm_gate gate_cell = {LSTM_1_CELL_GATE_INPUT_MULTIPLIER, + LSTM_1_CELL_GATE_INPUT_SHIFT, + &lstm_1_cell_gate_input_weights[0], &cell_data_kernel_sum[0], - LSTM_1_RECURRENT_TO_CELL_MULTIPLIER, - LSTM_1_RECURRENT_TO_CELL_SHIFT, - &lstm_1_recurrent_input_to_cell_w[0], + LSTM_1_CELL_GATE_HIDDEN_MULTIPLIER, + LSTM_1_CELL_GATE_HIDDEN_SHIFT, + &lstm_1_cell_gate_hidden_weights[0], &cell_hidden_kernel_sum[0], &lstm_1_cell_gate_bias[0], ARM_TANH}; // OUTPUT GATE - const cmsis_nn_lstm_gate gate_output = {LSTM_1_IN_TO_OUTPUT_MULTIPLIER, - LSTM_1_IN_TO_OUTPUT_SHIFT, - &lstm_1_input_to_output_w[0], + const cmsis_nn_lstm_gate gate_output = {LSTM_1_OUTPUT_GATE_INPUT_MULTIPLIER, + LSTM_1_OUTPUT_GATE_INPUT_SHIFT, + &lstm_1_output_gate_input_weights[0], &output_data_kernel_sum[0], - LSTM_1_RECURRENT_TO_OUTPUT_MULTIPLIER, - LSTM_1_RECURRENT_TO_OUTPUT_SHIFT, - &lstm_1_recurrent_input_to_output_w[0], + LSTM_1_OUTPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_1_OUTPUT_GATE_HIDDEN_SHIFT, + &lstm_1_output_gate_hidden_weights[0], &output_hidden_kernel_sum[0], &lstm_1_output_gate_bias[0], ARM_SIGMOID}; // LSTM DATA const cmsis_nn_lstm_params params = {LSTM_1_TIME_MAJOR, - LSTM_1_INPUT_BATCHES, + LSTM_1_BATCH_SIZE, LSTM_1_TIME_STEPS, - LSTM_1_NUMBER_INPUTS, - LSTM_1_NUMBER_UNITS, - LSTM_1_DATA_OFFSET, - LSTM_1_FORGET_MULTIPLIER, - LSTM_1_FORGET_SHIFT, - LSTM_1_INPUT_MULTIPLIER, - LSTM_1_INPUT_SHIFT, - LSTM_1_IN_ACTIVATION_MAX, - LSTM_1_CELL_STATE_SHIFT, - LSTM_1_HIDDEN_MULTIPLIER, - LSTM_1_HIDDEN_SHIFT, - LSTM_1_HIDDEN_OFFSET, + LSTM_1_INPUT_SIZE, + LSTM_1_HIDDEN_SIZE, + LSTM_1_INPUT_ZERO_POINT, + LSTM_1_FORGET_TO_CELL_MULTIPLIER, + LSTM_1_FORGET_TO_CELL_SHIFT, + LSTM_1_INPUT_TO_CELL_MULTIPLIER, + LSTM_1_INPUT_TO_CELL_SHIFT, + LSTM_1_CELL_CLIP, + LSTM_1_CELL_SCALE_POWER, + LSTM_1_OUTPUT_MULTIPLIER, + LSTM_1_OUTPUT_SHIFT, + LSTM_1_OUTPUT_ZERO_POINT, gate_forget, gate_input, gate_cell, gate_output}; - // BUFFERS cmsis_nn_lstm_context buffers; buffers.temp1 = buffer1; buffers.temp2 = buffer2; buffers.cell_state = buffer3; - arm_cmsis_nn_status result = arm_lstm_unidirectional_s8(lstm_1_input, output, ¶ms, &buffers); + arm_cmsis_nn_status result = arm_lstm_unidirectional_s8(lstm_1_input_tensor, output, ¶ms, &buffers); TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size)); } - -void lstm_2_arm_lstm_unidirectional_s8(void) +void lstm_2(void) { + int8_t output[LSTM_2_BATCH_SIZE * LSTM_2_TIME_STEPS * LSTM_2_HIDDEN_SIZE] = {0}; const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS; - const int8_t *output_ref = lstm_2_output_ref; - const int32_t output_ref_size = LSTM_2_DST_SIZE; - - // Calculate kernel sums if using MVE-extension - int32_t input_data_kernel_sum[LSTM_2_NUMBER_UNITS]; - int32_t forget_data_kernel_sum[LSTM_2_NUMBER_UNITS]; - int32_t cell_data_kernel_sum[LSTM_2_NUMBER_UNITS]; - int32_t output_data_kernel_sum[LSTM_2_NUMBER_UNITS]; + const int8_t *output_ref = &lstm_2_output[0]; + const int32_t output_ref_size = LSTM_2_BATCH_SIZE * LSTM_2_TIME_STEPS * LSTM_2_HIDDEN_SIZE; - int32_t input_hidden_kernel_sum[LSTM_2_NUMBER_UNITS]; - int32_t forget_hidden_kernel_sum[LSTM_2_NUMBER_UNITS]; - int32_t cell_hidden_kernel_sum[LSTM_2_NUMBER_UNITS]; - int32_t output_hidden_kernel_sum[LSTM_2_NUMBER_UNITS]; + int32_t input_data_kernel_sum[LSTM_2_HIDDEN_SIZE]; + int32_t forget_data_kernel_sum[LSTM_2_HIDDEN_SIZE]; + int32_t cell_data_kernel_sum[LSTM_2_HIDDEN_SIZE]; + int32_t output_data_kernel_sum[LSTM_2_HIDDEN_SIZE]; - int32_t size_data = LSTM_2_NUMBER_INPUTS; - int32_t size_hidden = LSTM_2_NUMBER_UNITS; + int32_t input_hidden_kernel_sum[LSTM_2_HIDDEN_SIZE]; + int32_t forget_hidden_kernel_sum[LSTM_2_HIDDEN_SIZE]; + int32_t cell_hidden_kernel_sum[LSTM_2_HIDDEN_SIZE]; + int32_t output_hidden_kernel_sum[LSTM_2_HIDDEN_SIZE]; arm_vector_sum_s8(&input_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_2_input_to_input_w[0], - LSTM_2_DATA_OFFSET, + LSTM_2_INPUT_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_input_gate_input_weights[0], + LSTM_2_INPUT_ZERO_POINT, &lstm_2_input_gate_bias[0]); arm_vector_sum_s8(&forget_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_2_input_to_forget_w[0], - LSTM_2_DATA_OFFSET, + LSTM_2_INPUT_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_forget_gate_input_weights[0], + LSTM_2_INPUT_ZERO_POINT, &lstm_2_forget_gate_bias[0]); arm_vector_sum_s8(&cell_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_2_input_to_cell_w[0], - LSTM_2_DATA_OFFSET, + LSTM_2_INPUT_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_cell_gate_input_weights[0], + LSTM_2_INPUT_ZERO_POINT, &lstm_2_cell_gate_bias[0]); arm_vector_sum_s8(&output_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_2_input_to_output_w[0], - LSTM_2_DATA_OFFSET, + LSTM_2_INPUT_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_output_gate_input_weights[0], + LSTM_2_INPUT_ZERO_POINT, &lstm_2_output_gate_bias[0]); arm_vector_sum_s8(&input_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_2_recurrent_input_to_input_w[0], - -LSTM_2_HIDDEN_OFFSET, + LSTM_2_HIDDEN_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_input_gate_hidden_weights[0], + -LSTM_2_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&forget_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_2_recurrent_input_to_forget_w[0], - -LSTM_2_HIDDEN_OFFSET, + LSTM_2_HIDDEN_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_forget_gate_hidden_weights[0], + -LSTM_2_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&cell_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_2_recurrent_input_to_cell_w[0], - -LSTM_2_HIDDEN_OFFSET, + LSTM_2_HIDDEN_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_cell_gate_hidden_weights[0], + -LSTM_2_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&output_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_2_recurrent_input_to_output_w[0], - -LSTM_2_HIDDEN_OFFSET, + LSTM_2_HIDDEN_SIZE, + LSTM_2_HIDDEN_SIZE, + &lstm_2_output_gate_hidden_weights[0], + -LSTM_2_OUTPUT_ZERO_POINT, NULL); // INPUT GATE - const cmsis_nn_lstm_gate gate_input = {LSTM_2_IN_TO_INPUT_MULTIPLIER, - LSTM_2_IN_TO_INPUT_SHIFT, - &lstm_2_input_to_input_w[0], + const cmsis_nn_lstm_gate gate_input = {LSTM_2_INPUT_GATE_INPUT_MULTIPLIER, + LSTM_2_INPUT_GATE_INPUT_SHIFT, + &lstm_2_input_gate_input_weights[0], &input_data_kernel_sum[0], - LSTM_2_RECURRENT_TO_INPUT_MULTIPLIER, - LSTM_2_RECURRENT_TO_INPUT_SHIFT, - &lstm_2_recurrent_input_to_input_w[0], + LSTM_2_INPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_2_INPUT_GATE_HIDDEN_SHIFT, + &lstm_2_input_gate_hidden_weights[0], &input_hidden_kernel_sum[0], &lstm_2_input_gate_bias[0], ARM_SIGMOID}; // FORGET GATE - const cmsis_nn_lstm_gate gate_forget = {LSTM_2_IN_TO_FORGET_MULTIPLIER, - LSTM_2_IN_TO_FORGET_SHIFT, - &lstm_2_input_to_forget_w[0], + const cmsis_nn_lstm_gate gate_forget = {LSTM_2_FORGET_GATE_INPUT_MULTIPLIER, + LSTM_2_FORGET_GATE_INPUT_SHIFT, + &lstm_2_forget_gate_input_weights[0], &forget_data_kernel_sum[0], - LSTM_2_RECURRENT_TO_FORGET_MULTIPLIER, - LSTM_2_RECURRENT_TO_FORGET_SHIFT, - &lstm_2_recurrent_input_to_forget_w[0], + LSTM_2_FORGET_GATE_HIDDEN_MULTIPLIER, + LSTM_2_FORGET_GATE_HIDDEN_SHIFT, + &lstm_2_forget_gate_hidden_weights[0], &forget_hidden_kernel_sum[0], &lstm_2_forget_gate_bias[0], ARM_SIGMOID}; // CELL GATE - const cmsis_nn_lstm_gate gate_cell = {LSTM_2_IN_TO_CELL_MULTIPLIER, - LSTM_2_IN_TO_CELL_SHIFT, - &lstm_2_input_to_cell_w[0], + const cmsis_nn_lstm_gate gate_cell = {LSTM_2_CELL_GATE_INPUT_MULTIPLIER, + LSTM_2_CELL_GATE_INPUT_SHIFT, + &lstm_2_cell_gate_input_weights[0], &cell_data_kernel_sum[0], - LSTM_2_RECURRENT_TO_CELL_MULTIPLIER, - LSTM_2_RECURRENT_TO_CELL_SHIFT, - &lstm_2_recurrent_input_to_cell_w[0], + LSTM_2_CELL_GATE_HIDDEN_MULTIPLIER, + LSTM_2_CELL_GATE_HIDDEN_SHIFT, + &lstm_2_cell_gate_hidden_weights[0], &cell_hidden_kernel_sum[0], &lstm_2_cell_gate_bias[0], ARM_TANH}; // OUTPUT GATE - const cmsis_nn_lstm_gate gate_output = {LSTM_2_IN_TO_OUTPUT_MULTIPLIER, - LSTM_2_IN_TO_OUTPUT_SHIFT, - &lstm_2_input_to_output_w[0], + const cmsis_nn_lstm_gate gate_output = {LSTM_2_OUTPUT_GATE_INPUT_MULTIPLIER, + LSTM_2_OUTPUT_GATE_INPUT_SHIFT, + &lstm_2_output_gate_input_weights[0], &output_data_kernel_sum[0], - LSTM_2_RECURRENT_TO_OUTPUT_MULTIPLIER, - LSTM_2_RECURRENT_TO_OUTPUT_SHIFT, - &lstm_2_recurrent_input_to_output_w[0], + LSTM_2_OUTPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_2_OUTPUT_GATE_HIDDEN_SHIFT, + &lstm_2_output_gate_hidden_weights[0], &output_hidden_kernel_sum[0], &lstm_2_output_gate_bias[0], ARM_SIGMOID}; // LSTM DATA const cmsis_nn_lstm_params params = {LSTM_2_TIME_MAJOR, - LSTM_2_INPUT_BATCHES, + LSTM_2_BATCH_SIZE, LSTM_2_TIME_STEPS, - LSTM_2_NUMBER_INPUTS, - LSTM_2_NUMBER_UNITS, - LSTM_2_DATA_OFFSET, - LSTM_2_FORGET_MULTIPLIER, - LSTM_2_FORGET_SHIFT, - LSTM_2_INPUT_MULTIPLIER, - LSTM_2_INPUT_SHIFT, - LSTM_2_IN_ACTIVATION_MAX, - LSTM_2_CELL_STATE_SHIFT, - LSTM_2_HIDDEN_MULTIPLIER, - LSTM_2_HIDDEN_SHIFT, - LSTM_2_HIDDEN_OFFSET, + LSTM_2_INPUT_SIZE, + LSTM_2_HIDDEN_SIZE, + LSTM_2_INPUT_ZERO_POINT, + LSTM_2_FORGET_TO_CELL_MULTIPLIER, + LSTM_2_FORGET_TO_CELL_SHIFT, + LSTM_2_INPUT_TO_CELL_MULTIPLIER, + LSTM_2_INPUT_TO_CELL_SHIFT, + LSTM_2_CELL_CLIP, + LSTM_2_CELL_SCALE_POWER, + LSTM_2_OUTPUT_MULTIPLIER, + LSTM_2_OUTPUT_SHIFT, + LSTM_2_OUTPUT_ZERO_POINT, gate_forget, gate_input, gate_cell, gate_output}; - // BUFFERS cmsis_nn_lstm_context buffers; buffers.temp1 = buffer1; buffers.temp2 = buffer2; buffers.cell_state = buffer3; - int8_t output[LSTM_2_DST_SIZE] = {0}; - arm_cmsis_nn_status result = arm_lstm_unidirectional_s8(lstm_2_input, output, ¶ms, &buffers); + arm_cmsis_nn_status result = arm_lstm_unidirectional_s8(lstm_2_input_tensor, output, ¶ms, &buffers); TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size)); } - -void lstm_one_time_step_arm_lstm_unidirectional_s8(void) +void lstm_one_time_step(void) { - int8_t output[LSTM_ONE_TIME_STEP_DST_SIZE] = {0}; + int8_t output[LSTM_ONE_TIME_STEP_BATCH_SIZE * LSTM_ONE_TIME_STEP_TIME_STEPS * LSTM_ONE_TIME_STEP_HIDDEN_SIZE] = {0}; const arm_cmsis_nn_status expected = ARM_CMSIS_NN_SUCCESS; - const int8_t *output_ref = lstm_one_time_step_output_ref; - const int32_t output_ref_size = LSTM_ONE_TIME_STEP_DST_SIZE; - - // Calculate kernel sums if using MVE-extension - int32_t input_data_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; - int32_t forget_data_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; - int32_t cell_data_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; - int32_t output_data_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; + const int8_t *output_ref = &lstm_one_time_step_output[0]; + const int32_t output_ref_size = + LSTM_ONE_TIME_STEP_BATCH_SIZE * LSTM_ONE_TIME_STEP_TIME_STEPS * LSTM_ONE_TIME_STEP_HIDDEN_SIZE; - int32_t input_hidden_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; - int32_t forget_hidden_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; - int32_t cell_hidden_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; - int32_t output_hidden_kernel_sum[LSTM_ONE_TIME_STEP_NUMBER_UNITS]; + int32_t input_data_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; + int32_t forget_data_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; + int32_t cell_data_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; + int32_t output_data_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; - int32_t size_data = LSTM_ONE_TIME_STEP_NUMBER_INPUTS; - int32_t size_hidden = LSTM_ONE_TIME_STEP_NUMBER_UNITS; + int32_t input_hidden_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; + int32_t forget_hidden_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; + int32_t cell_hidden_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; + int32_t output_hidden_kernel_sum[LSTM_ONE_TIME_STEP_HIDDEN_SIZE]; arm_vector_sum_s8(&input_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_one_time_step_input_to_input_w[0], - LSTM_ONE_TIME_STEP_DATA_OFFSET, + LSTM_ONE_TIME_STEP_INPUT_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_input_gate_input_weights[0], + LSTM_ONE_TIME_STEP_INPUT_ZERO_POINT, &lstm_one_time_step_input_gate_bias[0]); arm_vector_sum_s8(&forget_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_one_time_step_input_to_forget_w[0], - LSTM_ONE_TIME_STEP_DATA_OFFSET, + LSTM_ONE_TIME_STEP_INPUT_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_forget_gate_input_weights[0], + LSTM_ONE_TIME_STEP_INPUT_ZERO_POINT, &lstm_one_time_step_forget_gate_bias[0]); arm_vector_sum_s8(&cell_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_one_time_step_input_to_cell_w[0], - LSTM_ONE_TIME_STEP_DATA_OFFSET, + LSTM_ONE_TIME_STEP_INPUT_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_cell_gate_input_weights[0], + LSTM_ONE_TIME_STEP_INPUT_ZERO_POINT, &lstm_one_time_step_cell_gate_bias[0]); arm_vector_sum_s8(&output_data_kernel_sum[0], - size_data, - size_hidden, - &lstm_one_time_step_input_to_output_w[0], - LSTM_ONE_TIME_STEP_DATA_OFFSET, + LSTM_ONE_TIME_STEP_INPUT_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_output_gate_input_weights[0], + LSTM_ONE_TIME_STEP_INPUT_ZERO_POINT, &lstm_one_time_step_output_gate_bias[0]); arm_vector_sum_s8(&input_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_one_time_step_recurrent_input_to_input_w[0], - -LSTM_ONE_TIME_STEP_HIDDEN_OFFSET, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_input_gate_hidden_weights[0], + -LSTM_ONE_TIME_STEP_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&forget_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_one_time_step_recurrent_input_to_forget_w[0], - -LSTM_ONE_TIME_STEP_HIDDEN_OFFSET, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_forget_gate_hidden_weights[0], + -LSTM_ONE_TIME_STEP_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&cell_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_one_time_step_recurrent_input_to_cell_w[0], - -LSTM_ONE_TIME_STEP_HIDDEN_OFFSET, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_cell_gate_hidden_weights[0], + -LSTM_ONE_TIME_STEP_OUTPUT_ZERO_POINT, NULL); arm_vector_sum_s8(&output_hidden_kernel_sum[0], - size_hidden, - size_hidden, - &lstm_one_time_step_recurrent_input_to_output_w[0], - -LSTM_ONE_TIME_STEP_HIDDEN_OFFSET, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + &lstm_one_time_step_output_gate_hidden_weights[0], + -LSTM_ONE_TIME_STEP_OUTPUT_ZERO_POINT, NULL); // INPUT GATE - const cmsis_nn_lstm_gate gate_input = {LSTM_ONE_TIME_STEP_IN_TO_INPUT_MULTIPLIER, - LSTM_ONE_TIME_STEP_IN_TO_INPUT_SHIFT, - &lstm_one_time_step_input_to_input_w[0], - input_data_kernel_sum, - LSTM_ONE_TIME_STEP_RECURRENT_TO_INPUT_MULTIPLIER, - LSTM_ONE_TIME_STEP_RECURRENT_TO_INPUT_SHIFT, - &lstm_one_time_step_recurrent_input_to_input_w[0], - input_hidden_kernel_sum, + const cmsis_nn_lstm_gate gate_input = {LSTM_ONE_TIME_STEP_INPUT_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_INPUT_GATE_INPUT_SHIFT, + &lstm_one_time_step_input_gate_input_weights[0], + &input_data_kernel_sum[0], + LSTM_ONE_TIME_STEP_INPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_INPUT_GATE_HIDDEN_SHIFT, + &lstm_one_time_step_input_gate_hidden_weights[0], + &input_hidden_kernel_sum[0], &lstm_one_time_step_input_gate_bias[0], ARM_SIGMOID}; // FORGET GATE - const cmsis_nn_lstm_gate gate_forget = {LSTM_ONE_TIME_STEP_IN_TO_FORGET_MULTIPLIER, - LSTM_ONE_TIME_STEP_IN_TO_FORGET_SHIFT, - &lstm_one_time_step_input_to_forget_w[0], - forget_data_kernel_sum, - LSTM_ONE_TIME_STEP_RECURRENT_TO_FORGET_MULTIPLIER, - LSTM_ONE_TIME_STEP_RECURRENT_TO_FORGET_SHIFT, - &lstm_one_time_step_recurrent_input_to_forget_w[0], - forget_hidden_kernel_sum, + const cmsis_nn_lstm_gate gate_forget = {LSTM_ONE_TIME_STEP_FORGET_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_FORGET_GATE_INPUT_SHIFT, + &lstm_one_time_step_forget_gate_input_weights[0], + &forget_data_kernel_sum[0], + LSTM_ONE_TIME_STEP_FORGET_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_FORGET_GATE_HIDDEN_SHIFT, + &lstm_one_time_step_forget_gate_hidden_weights[0], + &forget_hidden_kernel_sum[0], &lstm_one_time_step_forget_gate_bias[0], ARM_SIGMOID}; // CELL GATE - const cmsis_nn_lstm_gate gate_cell = {LSTM_ONE_TIME_STEP_IN_TO_CELL_MULTIPLIER, - LSTM_ONE_TIME_STEP_IN_TO_CELL_SHIFT, - &lstm_one_time_step_input_to_cell_w[0], - cell_data_kernel_sum, - LSTM_ONE_TIME_STEP_RECURRENT_TO_CELL_MULTIPLIER, - LSTM_ONE_TIME_STEP_RECURRENT_TO_CELL_SHIFT, - &lstm_one_time_step_recurrent_input_to_cell_w[0], - cell_hidden_kernel_sum, + const cmsis_nn_lstm_gate gate_cell = {LSTM_ONE_TIME_STEP_CELL_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_CELL_GATE_INPUT_SHIFT, + &lstm_one_time_step_cell_gate_input_weights[0], + &cell_data_kernel_sum[0], + LSTM_ONE_TIME_STEP_CELL_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_CELL_GATE_HIDDEN_SHIFT, + &lstm_one_time_step_cell_gate_hidden_weights[0], + &cell_hidden_kernel_sum[0], &lstm_one_time_step_cell_gate_bias[0], ARM_TANH}; // OUTPUT GATE - const cmsis_nn_lstm_gate gate_output = {LSTM_ONE_TIME_STEP_IN_TO_OUTPUT_MULTIPLIER, - LSTM_ONE_TIME_STEP_IN_TO_OUTPUT_SHIFT, - &lstm_one_time_step_input_to_output_w[0], - output_data_kernel_sum, - LSTM_ONE_TIME_STEP_RECURRENT_TO_OUTPUT_MULTIPLIER, - LSTM_ONE_TIME_STEP_RECURRENT_TO_OUTPUT_SHIFT, - &lstm_one_time_step_recurrent_input_to_output_w[0], - output_hidden_kernel_sum, + const cmsis_nn_lstm_gate gate_output = {LSTM_ONE_TIME_STEP_OUTPUT_GATE_INPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_OUTPUT_GATE_INPUT_SHIFT, + &lstm_one_time_step_output_gate_input_weights[0], + &output_data_kernel_sum[0], + LSTM_ONE_TIME_STEP_OUTPUT_GATE_HIDDEN_MULTIPLIER, + LSTM_ONE_TIME_STEP_OUTPUT_GATE_HIDDEN_SHIFT, + &lstm_one_time_step_output_gate_hidden_weights[0], + &output_hidden_kernel_sum[0], &lstm_one_time_step_output_gate_bias[0], ARM_SIGMOID}; // LSTM DATA const cmsis_nn_lstm_params params = {LSTM_ONE_TIME_STEP_TIME_MAJOR, - LSTM_ONE_TIME_STEP_INPUT_BATCHES, + LSTM_ONE_TIME_STEP_BATCH_SIZE, LSTM_ONE_TIME_STEP_TIME_STEPS, - LSTM_ONE_TIME_STEP_NUMBER_INPUTS, - LSTM_ONE_TIME_STEP_NUMBER_UNITS, - LSTM_ONE_TIME_STEP_DATA_OFFSET, - LSTM_ONE_TIME_STEP_FORGET_MULTIPLIER, - LSTM_ONE_TIME_STEP_FORGET_SHIFT, - LSTM_ONE_TIME_STEP_INPUT_MULTIPLIER, - LSTM_ONE_TIME_STEP_INPUT_SHIFT, - LSTM_ONE_TIME_STEP_IN_ACTIVATION_MAX, - LSTM_ONE_TIME_STEP_CELL_STATE_SHIFT, - LSTM_ONE_TIME_STEP_HIDDEN_MULTIPLIER, - LSTM_ONE_TIME_STEP_HIDDEN_SHIFT, - LSTM_ONE_TIME_STEP_HIDDEN_OFFSET, + LSTM_ONE_TIME_STEP_INPUT_SIZE, + LSTM_ONE_TIME_STEP_HIDDEN_SIZE, + LSTM_ONE_TIME_STEP_INPUT_ZERO_POINT, + LSTM_ONE_TIME_STEP_FORGET_TO_CELL_MULTIPLIER, + LSTM_ONE_TIME_STEP_FORGET_TO_CELL_SHIFT, + LSTM_ONE_TIME_STEP_INPUT_TO_CELL_MULTIPLIER, + LSTM_ONE_TIME_STEP_INPUT_TO_CELL_SHIFT, + LSTM_ONE_TIME_STEP_CELL_CLIP, + LSTM_ONE_TIME_STEP_CELL_SCALE_POWER, + LSTM_ONE_TIME_STEP_OUTPUT_MULTIPLIER, + LSTM_ONE_TIME_STEP_OUTPUT_SHIFT, + LSTM_ONE_TIME_STEP_OUTPUT_ZERO_POINT, gate_forget, gate_input, gate_cell, gate_output}; - // BUFFERS cmsis_nn_lstm_context buffers; buffers.temp1 = buffer1; buffers.temp2 = buffer2; buffers.cell_state = buffer3; - arm_cmsis_nn_status result = arm_lstm_unidirectional_s8(lstm_one_time_step_input, output, ¶ms, &buffers); + arm_cmsis_nn_status result = arm_lstm_unidirectional_s8(lstm_one_time_step_input_tensor, output, ¶ms, &buffers); TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size)); -} +} \ No newline at end of file