summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-10-18 16:54:15 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-10-18 16:54:15 +0000
commitd1ca7d857759855a2c5a98d63af0404bba549361 (patch)
tree5238f417f6603850a59d82c4275bc5d6cccb3be4
parent5361e12970d2f890aa23474ab6bde9864f2dd0eb (diff)
parenteca19e045e53582487709377dade37642116fe95 (diff)
downloadml-oreo-m2-s2-release.tar.gz
Change-Id: I8d8df6c71ed0a3a62a2c8bd6f64a57c06bade3a2
-rw-r--r--nn/common/Android.bp20
-rw-r--r--nn/common/CpuExecutor.cpp40
-rw-r--r--nn/common/Utils.cpp10
-rw-r--r--nn/common/include/CpuExecutor.h16
-rw-r--r--nn/common/include/OperationsUtils.h44
-rw-r--r--nn/common/include/Utils.h3
-rw-r--r--nn/common/operations/EmbeddingLookup.cpp2
-rw-r--r--nn/common/operations/EmbeddingLookup.h4
-rw-r--r--nn/common/operations/EmbeddingLookupTest.cpp28
-rw-r--r--nn/common/operations/LSTM.cpp236
-rw-r--r--nn/common/operations/LSTMTest.cpp24
-rw-r--r--nn/common/operations/RNNTest.cpp9
-rw-r--r--nn/common/operations/SVDFTest.cpp37
-rw-r--r--nn/common/operations/internal/optimized/cpu_check.h28
-rw-r--r--nn/common/operations/internal/optimized/neon_tensor_utils.cc216
-rw-r--r--nn/common/operations/internal/optimized/neon_tensor_utils.h118
-rw-r--r--nn/common/operations/internal/optimized/tensor_utils_impl.h132
-rw-r--r--nn/common/operations/internal/reference/portable_tensor_utils.cc168
-rw-r--r--nn/common/operations/internal/reference/portable_tensor_utils.h194
-rw-r--r--nn/common/operations/internal/tensor_utils.cc29
-rw-r--r--nn/common/operations/internal/tensor_utils.h122
-rw-r--r--nn/common/operations/internal/tensor_utils_test.cc197
-rw-r--r--nn/driver/sample/SampleDriver.cpp29
-rw-r--r--nn/driver/sample/SampleDriver.h4
-rw-r--r--nn/driver/sample/SampleDriverAll.cpp2
-rw-r--r--nn/driver/sample/SampleDriverFloatFast.cpp2
-rw-r--r--nn/driver/sample/SampleDriverFloatSlow.cpp2
-rw-r--r--nn/driver/sample/SampleDriverMinimal.cpp2
-rw-r--r--nn/driver/sample/SampleDriverQuant.cpp2
-rw-r--r--nn/runtime/ExecutionBuilder.cpp30
-rw-r--r--nn/runtime/ExecutionPlan.cpp12
-rw-r--r--nn/runtime/Manager.cpp29
-rw-r--r--nn/runtime/Manager.h9
-rw-r--r--nn/runtime/Memory.cpp2
-rw-r--r--nn/runtime/ModelBuilder.cpp83
-rw-r--r--nn/runtime/ModelBuilder.h26
-rw-r--r--nn/runtime/NeuralNetworks.cpp107
-rw-r--r--nn/runtime/include/NeuralNetworks.h235
-rw-r--r--nn/runtime/test/Android.bp1
-rw-r--r--nn/runtime/test/TestMemory.cpp3
-rw-r--r--nn/runtime/test/TestPartitioning.cpp836
-rw-r--r--nn/runtime/test/generated/all_generated_tests.cpp155
-rw-r--r--nn/runtime/test/generated/all_generated_vts_tests.cpp30
-rw-r--r--nn/runtime/test/generated/examples/depth_to_space_float_3.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/depthwise_conv2d_float_large_weights_as_inputs.example.cpp2
-rw-r--r--nn/runtime/test/generated/examples/embedding_lookup.example.cpp4
-rw-r--r--nn/runtime/test/generated/examples/lstm.example.cpp2
-rw-r--r--nn/runtime/test/generated/examples/lstm2.example.cpp2
-rw-r--r--nn/runtime/test/generated/examples/lstm2_state.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/lstm2_state2.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/lstm3.example.cpp2
-rw-r--r--nn/runtime/test/generated/examples/lstm3_state.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/lstm3_state2.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/lstm3_state3.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/lstm_state.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/lstm_state2.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/rnn_state.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/space_to_depth_float_3.example.cpp22
-rw-r--r--nn/runtime/test/generated/examples/svdf_state.example.cpp22
-rw-r--r--nn/runtime/test/generated/models/conv_3_h3_w2_SAME.model.cpp2
-rw-r--r--nn/runtime/test/generated/models/conv_3_h3_w2_VALID.model.cpp2
-rw-r--r--nn/runtime/test/generated/models/depth_to_space_float_1.model.cpp8
-rw-r--r--nn/runtime/test/generated/models/depth_to_space_float_2.model.cpp8
-rw-r--r--nn/runtime/test/generated/models/depth_to_space_float_3.model.cpp24
-rw-r--r--nn/runtime/test/generated/models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp23
-rw-r--r--nn/runtime/test/generated/models/embedding_lookup.model.cpp14
-rw-r--r--nn/runtime/test/generated/models/lstm.model.cpp2
-rw-r--r--nn/runtime/test/generated/models/lstm2.model.cpp2
-rw-r--r--nn/runtime/test/generated/models/lstm2_state.model.cpp53
-rw-r--r--nn/runtime/test/generated/models/lstm2_state2.model.cpp53
-rw-r--r--nn/runtime/test/generated/models/lstm3.model.cpp2
-rw-r--r--nn/runtime/test/generated/models/lstm3_state.model.cpp54
-rw-r--r--nn/runtime/test/generated/models/lstm3_state2.model.cpp54
-rw-r--r--nn/runtime/test/generated/models/lstm3_state3.model.cpp54
-rw-r--r--nn/runtime/test/generated/models/lstm_state.model.cpp53
-rw-r--r--nn/runtime/test/generated/models/lstm_state2.model.cpp53
-rw-r--r--nn/runtime/test/generated/models/rnn_state.model.cpp30
-rw-r--r--nn/runtime/test/generated/models/space_to_depth_float_1.model.cpp8
-rw-r--r--nn/runtime/test/generated/models/space_to_depth_float_2.model.cpp8
-rw-r--r--nn/runtime/test/generated/models/space_to_depth_float_3.model.cpp24
-rw-r--r--nn/runtime/test/generated/models/svdf_state.model.cpp32
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_float_1.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_float_2.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_float_3.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_float_4.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_quant8_1.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_quant8_2.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_quant8_3.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/avg_pool_quant8_4.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_float.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_float_channels.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_float_channels_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_float_large.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_float_large_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_float_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_channels.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_channels_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_large.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_large_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_overflow.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_overflow_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/conv_quant8_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depth_to_space_float_3.model.cpp62
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_float.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_float_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_weights_as_inputs.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/embedding_lookup.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/l2_pool_float.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/l2_pool_float_large.model.cpp2
-rw-r--r--nn/runtime/test/generated/vts_models/max_pool_float_1.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/max_pool_float_2.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/max_pool_float_3.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/max_pool_quant8_1.model.cpp4
-rw-r--r--nn/runtime/test/generated/vts_models/max_pool_quant8_2.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/max_pool_quant8_3.model.cpp6
-rw-r--r--nn/runtime/test/generated/vts_models/space_to_depth_float_3.model.cpp62
-rw-r--r--nn/runtime/test/specs/depth_to_space_float_1.mod.py2
-rw-r--r--nn/runtime/test/specs/depth_to_space_float_2.mod.py2
-rw-r--r--nn/runtime/test/specs/depth_to_space_float_3.mod.py22
-rw-r--r--nn/runtime/test/specs/depthwise_conv2d_float_large_weights_as_inputs.mod.py6
-rw-r--r--nn/runtime/test/specs/embedding_lookup.mod.py6
-rwxr-xr-xnn/runtime/test/specs/generate_test.sh11
-rwxr-xr-xnn/runtime/test/specs/generate_vts_test.sh4
-rw-r--r--nn/runtime/test/specs/lstm.mod.py41
-rw-r--r--nn/runtime/test/specs/lstm2.mod.py32
-rw-r--r--nn/runtime/test/specs/lstm2_state.mod.py145
-rw-r--r--nn/runtime/test/specs/lstm2_state2.mod.py146
-rw-r--r--nn/runtime/test/specs/lstm3.mod.py115
-rw-r--r--nn/runtime/test/specs/lstm3_state.mod.py687
-rw-r--r--nn/runtime/test/specs/lstm3_state2.mod.py687
-rw-r--r--nn/runtime/test/specs/lstm3_state3.mod.py667
-rw-r--r--nn/runtime/test/specs/lstm_state.mod.py152
-rw-r--r--nn/runtime/test/specs/lstm_state2.mod.py152
-rw-r--r--nn/runtime/test/specs/mobilenet_quantized.mod.py (renamed from nn/runtime/test/specs/mobilenet_quantized.model.py)0
-rw-r--r--nn/runtime/test/specs/rnn_state.mod.py127
-rw-r--r--nn/runtime/test/specs/space_to_depth_float_1.mod.py2
-rw-r--r--nn/runtime/test/specs/space_to_depth_float_2.mod.py2
-rw-r--r--nn/runtime/test/specs/space_to_depth_float_3.mod.py22
-rw-r--r--nn/runtime/test/specs/svdf_state.mod.py116
-rw-r--r--nn/tools/test_generator/include/TestHarness.h2
-rwxr-xr-xnn/tools/test_generator/test_generator.py22
-rw-r--r--nn/tools/test_generator/tests/P_conv/stdout.txt.expect2
-rw-r--r--nn/tools/test_generator/tests/P_depthwise_conv/stdout.txt.expect2
-rw-r--r--nn/tools/test_generator/tests/P_lstm/lstm.mod.py161
-rw-r--r--nn/tools/test_generator/tests/P_lstm/stderr.txt.expect2
-rw-r--r--nn/tools/test_generator/tests/P_lstm/stdout.txt.expect75
-rw-r--r--nn/tools/test_generator/tests/P_weird/stderr.txt.expect2
-rw-r--r--nn/tools/test_generator/tests/P_weird/stdout.txt.expect51
-rw-r--r--nn/tools/test_generator/tests/P_weird/weird_add.mod.py29
157 files changed, 7172 insertions, 725 deletions
diff --git a/nn/common/Android.bp b/nn/common/Android.bp
index 15ab87588..a499104bd 100644
--- a/nn/common/Android.bp
+++ b/nn/common/Android.bp
@@ -46,6 +46,9 @@ cc_library_static {
"operations/RNN.cpp",
"operations/SimpleMath.cpp",
"operations/SVDF.cpp",
+ "operations/internal/optimized/neon_tensor_utils.cc",
+ "operations/internal/reference/portable_tensor_utils.cc",
+ "operations/internal/tensor_utils.cc",
],
shared_libs: [
"libbase",
@@ -79,6 +82,23 @@ cc_library_static {
}
cc_test {
+ name: "tensor_utils_test",
+ srcs: [
+ "operations/internal/tensor_utils_test.cc",
+ ],
+ shared_libs: [
+ "libneuralnetworks",
+ ],
+ local_include_dirs: [ "include" ],
+ header_libs: [
+ "libneuralnetworks_headers",
+ ],
+ static_libs: [
+ "libgmock",
+ ],
+}
+
+cc_test {
name: "embedding_lookup_test",
srcs: [
"operations/EmbeddingLookupTest.cpp",
diff --git a/nn/common/CpuExecutor.cpp b/nn/common/CpuExecutor.cpp
index 480d6cb15..9c6df76e6 100644
--- a/nn/common/CpuExecutor.cpp
+++ b/nn/common/CpuExecutor.cpp
@@ -79,6 +79,19 @@ bool RunTimePoolInfo::update() {
return true;
}
+bool setRunTimePoolInfosFromHidlMemories(std::vector<RunTimePoolInfo>* poolInfos,
+ const hidl_vec<hidl_memory>& pools) {
+ poolInfos->resize(pools.size());
+ for (size_t i = 0; i < pools.size(); i++) {
+ auto& poolInfo = (*poolInfos)[i];
+ if (!poolInfo.set(pools[i])) {
+ LOG(ERROR) << "Could not map pool";
+ return false;
+ }
+ }
+ return true;
+}
+
// Updates the RunTimeOperandInfo with the newly calculated shape.
// Allocate the buffer if we need to.
static bool setInfoAndAllocateIfNeeded(RunTimeOperandInfo* info, const Shape& shape) {
@@ -113,14 +126,15 @@ static bool setInfoAndAllocateIfNeeded(RunTimeOperandInfo* info, const Shape& sh
// Ignore the .pools entry in model and request. This will have been taken care of
// by the caller.
int CpuExecutor::run(const Model& model, const Request& request,
- const std::vector<RunTimePoolInfo>& runTimePoolInfos) {
+ const std::vector<RunTimePoolInfo>& modelPoolInfos,
+ const std::vector<RunTimePoolInfo>& requestPoolInfos) {
VLOG(CPUEXE) << "CpuExecutor::run()";
// VLOG(CPUEXE) << "model: " << toString(model);
VLOG(CPUEXE) << "request: " << toString(request);
mModel = &model;
mRequest = &request; // TODO check if mRequest is needed
- initializeRunTimeInfo(runTimePoolInfos);
+ initializeRunTimeInfo(modelPoolInfos, requestPoolInfos);
// The model has serialized the operation in execution order.
for (const auto& operation : model.operations) {
int n = executeOperation(operation);
@@ -128,7 +142,10 @@ int CpuExecutor::run(const Model& model, const Request& request,
return n;
}
}
- for (auto runtimeInfo : runTimePoolInfos) {
+ for (auto runtimeInfo : modelPoolInfos) {
+ runtimeInfo.update();
+ }
+ for (auto runtimeInfo : requestPoolInfos) {
runtimeInfo.update();
}
mModel = nullptr;
@@ -137,7 +154,8 @@ int CpuExecutor::run(const Model& model, const Request& request,
return ANEURALNETWORKS_NO_ERROR;
}
-bool CpuExecutor::initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& runTimePoolInfos) {
+bool CpuExecutor::initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& modelPoolInfos,
+ const std::vector<RunTimePoolInfo>& requestPoolInfos) {
VLOG(CPUEXE) << "CpuExecutor::initializeRunTimeInfo";
const size_t count = mModel->operands.size();
mOperands.resize(count);
@@ -163,8 +181,8 @@ bool CpuExecutor::initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& runT
break;
case OperandLifeTime::CONSTANT_REFERENCE: {
auto poolIndex = from.location.poolIndex;
- nnAssert(poolIndex < runTimePoolInfos.size());
- auto& r = runTimePoolInfos[poolIndex];
+ nnAssert(poolIndex < modelPoolInfos.size());
+ auto& r = modelPoolInfos[poolIndex];
to.buffer = r.buffer + from.location.offset;
to.numberOfUsesLeft = 0;
break;
@@ -183,7 +201,7 @@ bool CpuExecutor::initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& runT
// Adjust the runtime info for the arguments passed to the model,
// modifying the buffer location, and possibly the dimensions.
- auto updateForArguments = [this, &runTimePoolInfos](const std::vector<uint32_t>& indexes,
+ auto updateForArguments = [this, &requestPoolInfos](const std::vector<uint32_t>& indexes,
const hidl_vec<RequestArgument>& arguments) {
nnAssert(indexes.size() == arguments.size());
for (size_t i = 0; i < indexes.size(); i++) {
@@ -203,8 +221,8 @@ bool CpuExecutor::initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& runT
nnAssert(to.buffer == nullptr);
} else {
auto poolIndex = from.location.poolIndex;
- nnAssert(poolIndex < runTimePoolInfos.size());
- auto& r = runTimePoolInfos[poolIndex];
+ nnAssert(poolIndex < requestPoolInfos.size());
+ auto& r = requestPoolInfos[poolIndex];
to.buffer = r.buffer + from.location.offset;
}
}
@@ -1206,7 +1224,7 @@ int CpuExecutor::executeOperation(const Operation& operation) {
rnn_cell.Eval();
} break;
case OperationType::SVDF: {
- RunTimeOperandInfo &state =
+ RunTimeOperandInfo &stateOut =
mOperands[outs[SVDF::kStateOutTensor]];
RunTimeOperandInfo &output =
mOperands[outs[SVDF::kOutputTensor]];
@@ -1216,7 +1234,7 @@ int CpuExecutor::executeOperation(const Operation& operation) {
success = SVDF::Prepare(operation, mOperands,
&stateShape, &outputShape) &&
- setInfoAndAllocateIfNeeded(&state, stateShape) &&
+ setInfoAndAllocateIfNeeded(&stateOut, stateShape) &&
setInfoAndAllocateIfNeeded(&output, outputShape) &&
svdf.Eval();
} break;
diff --git a/nn/common/Utils.cpp b/nn/common/Utils.cpp
index f73b12cec..245626731 100644
--- a/nn/common/Utils.cpp
+++ b/nn/common/Utils.cpp
@@ -245,6 +245,16 @@ uint32_t alignBytesNeeded(uint32_t index, size_t length) {
return extra;
}
+void logModelToInfo(const Model& model) {
+ LOG(INFO) << "Model start";
+ LOG(INFO) << "operands" << toString(model.operands);
+ LOG(INFO) << "operations" << toString(model.operations);
+ LOG(INFO) << "inputIndexes" << toString(model.inputIndexes);
+ LOG(INFO) << "outputIndexes" << toString(model.outputIndexes);
+ LOG(INFO) << "operandValues size" << model.operandValues.size();
+ LOG(INFO) << "pools" << toString(model.pools);
+}
+
// Validates the type. The used dimensions can be underspecified.
int validateOperandType(const ANeuralNetworksOperandType& type, const char* tag,
bool allowPartial) {
diff --git a/nn/common/include/CpuExecutor.h b/nn/common/include/CpuExecutor.h
index dd92eaf1b..b765efc7c 100644
--- a/nn/common/include/CpuExecutor.h
+++ b/nn/common/include/CpuExecutor.h
@@ -55,10 +55,7 @@ struct RunTimeOperandInfo {
uint32_t numberOfUsesLeft;
Shape shape() const {
- return Shape{.type = type,
- .dimensions = dimensions,
- .scale = scale,
- .offset = zeroPoint};
+ return Shape{.type = type, .dimensions = dimensions, .scale = scale, .offset = zeroPoint};
}
};
@@ -72,6 +69,9 @@ struct RunTimePoolInfo {
bool update();
};
+bool setRunTimePoolInfosFromHidlMemories(std::vector<RunTimePoolInfo>* poolInfos,
+ const hidl_vec<hidl_memory>& pools);
+
// This class is used to execute a model on the CPU.
class CpuExecutor {
public:
@@ -80,17 +80,17 @@ public:
// The model must outlive the executor. We prevent it from being modified
// while this is executing.
int run(const Model& model, const Request& request,
- const std::vector<RunTimePoolInfo>& runTimePoolInfos);
+ const std::vector<RunTimePoolInfo>& modelPoolInfos,
+ const std::vector<RunTimePoolInfo>& requestPoolInfos);
private:
- bool initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& runTimePoolInfos);
+ bool initializeRunTimeInfo(const std::vector<RunTimePoolInfo>& modelPoolInfos,
+ const std::vector<RunTimePoolInfo>& requestPoolInfos);
// Runs one operation of the graph.
int executeOperation(const Operation& entry);
// Decrement the usage count for the operands listed. Frees the memory
// allocated for any temporary variable with a count of zero.
void freeNoLongerUsedOperands(const std::vector<uint32_t>& inputs);
- void setLocationAndUses(RunTimeOperandInfo* to, const DataLocation& location,
- const std::vector<RunTimePoolInfo>& runTimePoolInfos);
// The model and the request that we'll execute. Only valid while run()
// is being executed.
diff --git a/nn/common/include/OperationsUtils.h b/nn/common/include/OperationsUtils.h
index 80efacdfd..aaca0c083 100644
--- a/nn/common/include/OperationsUtils.h
+++ b/nn/common/include/OperationsUtils.h
@@ -45,26 +45,6 @@ enum PaddingScheme {
kPaddingValid = 2,
};
-inline PaddingScheme getPaddingScheme(uint32_t filterWidth, uint32_t filterHeight,
- uint32_t paddingLeft, uint32_t paddingRight,
- uint32_t paddingTop, uint32_t paddingBottom) {
- if (paddingLeft > paddingRight || paddingTop > paddingBottom) {
- return kPaddingUnknown;
- }
-
- uint32_t totolPaddingWidth = paddingLeft + paddingRight;
- uint32_t totolPaddingHeight = paddingTop + paddingBottom;
- if (totolPaddingWidth == filterWidth - 1 &&
- totolPaddingHeight == filterHeight -1) {
- return kPaddingSame;
- } else if (totolPaddingWidth == 0 &&
- totolPaddingHeight == 0) {
- return kPaddingValid;
- } else {
- return kPaddingUnknown;
- }
-}
-
// The type and dimensions of an operand.
struct Shape {
OperandType type;
@@ -132,6 +112,30 @@ inline void calculateExplicitPadding(int32_t in_size, int32_t stride,
}
}
+inline PaddingScheme getPaddingScheme(int32_t inWidth, int32_t inHeight,
+ int32_t strideWidth, int32_t strideHeight,
+ int32_t filterWidth, int32_t filterHeight,
+ int32_t paddingLeft, int32_t paddingRight,
+ int32_t paddingTop, int32_t paddingBottom) {
+ if (paddingLeft == 0 && paddingRight == 0 && paddingTop == 0 && paddingBottom == 0) {
+ return kPaddingValid;
+ }
+
+ int32_t expectedPaddingLeft, expectedPaddingRight;
+ int32_t expectedPaddingTop, expectedPaddingBottom;
+
+ calculateExplicitPadding(inWidth, strideWidth, filterWidth, kPaddingSame,
+ &expectedPaddingLeft, &expectedPaddingRight);
+ calculateExplicitPadding(inHeight, strideHeight, filterHeight, kPaddingSame,
+ &expectedPaddingTop, &expectedPaddingBottom);
+ if (expectedPaddingLeft == paddingLeft && expectedPaddingRight == paddingRight &&
+ expectedPaddingTop == paddingTop && expectedPaddingBottom == paddingBottom) {
+ return kPaddingSame;
+ } else {
+ return kPaddingUnknown;
+ }
+}
+
// Preparation functions for the corresponding ops
bool addMulPrepare(const Shape& in1, const Shape& in2, Shape* out1);
diff --git a/nn/common/include/Utils.h b/nn/common/include/Utils.h
index da035592b..3eebf2606 100644
--- a/nn/common/include/Utils.h
+++ b/nn/common/include/Utils.h
@@ -106,6 +106,9 @@ hidl_memory allocateSharedMemory(int64_t size);
// to determine what this should be.
uint32_t alignBytesNeeded(uint32_t index, size_t length);
+// Does a detailed LOG(INFO) of the model
+void logModelToInfo(const Model& model);
+
inline void setFromIntList(hidl_vec<uint32_t>* vec, uint32_t count, const uint32_t* data) {
vec->resize(count);
for (uint32_t i = 0; i < count; i++) {
diff --git a/nn/common/operations/EmbeddingLookup.cpp b/nn/common/operations/EmbeddingLookup.cpp
index 2ca72af74..504c6848b 100644
--- a/nn/common/operations/EmbeddingLookup.cpp
+++ b/nn/common/operations/EmbeddingLookup.cpp
@@ -37,7 +37,7 @@ bool EmbeddingLookup::Eval() {
const int row_bytes = total_bytes/row_size;
for (uint32_t i = 0; i < lookup_->shape().dimensions[0]; i++) {
- int idx = static_cast<int>((reinterpret_cast<float*>(lookup_->buffer))[i]);
+ int idx = (reinterpret_cast<int*>(lookup_->buffer))[i];
if (idx >= row_size || idx < 0) {
LOG(ERROR) << "Embedding Lookup: index out of bounds.";
return false;
diff --git a/nn/common/operations/EmbeddingLookup.h b/nn/common/operations/EmbeddingLookup.h
index d9a71a279..57129dfde 100644
--- a/nn/common/operations/EmbeddingLookup.h
+++ b/nn/common/operations/EmbeddingLookup.h
@@ -42,8 +42,8 @@ class EmbeddingLookup {
bool Eval();
- static constexpr int kValueTensor = 0;
- static constexpr int kLookupTensor = 1;
+ static constexpr int kLookupTensor = 0;
+ static constexpr int kValueTensor = 1;
static constexpr int kOutputTensor = 0;
diff --git a/nn/common/operations/EmbeddingLookupTest.cpp b/nn/common/operations/EmbeddingLookupTest.cpp
index d03e16887..f9cdf732a 100644
--- a/nn/common/operations/EmbeddingLookupTest.cpp
+++ b/nn/common/operations/EmbeddingLookupTest.cpp
@@ -44,12 +44,12 @@ std::vector<Matcher<float>> ArrayFloatNear(const std::vector<float>& values,
using ::testing::ElementsAreArray;
#define FOR_ALL_INPUT_AND_WEIGHT_TENSORS(ACTION) \
- ACTION(Value) \
- ACTION(Lookup)
+ ACTION(Value, float) \
+ ACTION(Lookup, int)
// For all output and intermediate states
#define FOR_ALL_OUTPUT_TENSORS(ACTION) \
- ACTION(Output) \
+ ACTION(Output, float)
class EmbeddingLookupOpModel {
public:
@@ -62,12 +62,12 @@ class EmbeddingLookupOpModel {
std::vector<uint32_t> inputs;
+ OperandType LookupTy(Type::TENSOR_INT32, index_shape);
+ inputs.push_back(model_.addOperand(&LookupTy));
+
OperandType ValueTy(Type::TENSOR_FLOAT32, weight_shape);
inputs.push_back(model_.addOperand(&ValueTy));
- OperandType LookupTy(Type::TENSOR_FLOAT32, index_shape);
- inputs.push_back(model_.addOperand(&LookupTy));
-
std::vector<uint32_t> outputs;
OperandType OutputOpndTy(Type::TENSOR_FLOAT32, weight_shape);
@@ -95,16 +95,18 @@ class EmbeddingLookupOpModel {
compilation.finish();
Execution execution(&compilation);
-#define SetInputOrWeight(X) \
- ASSERT_EQ(execution.setInput(EmbeddingLookup::k##X##Tensor, X##_.data(), sizeof(X##_)), \
+#define SetInputOrWeight(X, T) \
+ ASSERT_EQ(execution.setInput(EmbeddingLookup::k##X##Tensor, X##_.data(), \
+ sizeof(T) * X##_.size()), \
Result::NO_ERROR);
FOR_ALL_INPUT_AND_WEIGHT_TENSORS(SetInputOrWeight);
#undef SetInputOrWeight
-#define SetOutput(X) \
- ASSERT_EQ(execution.setOutput(EmbeddingLookup::k##X##Tensor, X##_.data(), sizeof(X##_)), \
+#define SetOutput(X, T) \
+ ASSERT_EQ(execution.setOutput(EmbeddingLookup::k##X##Tensor, X##_.data(), \
+ sizeof(T) * X##_.size()), \
Result::NO_ERROR);
FOR_ALL_OUTPUT_TENSORS(SetOutput);
@@ -114,8 +116,8 @@ class EmbeddingLookupOpModel {
ASSERT_EQ(execution.compute(), Result::NO_ERROR);
}
-#define DefineSetter(X) \
- void Set##X(const std::vector<float>& f) { \
+#define DefineSetter(X, T) \
+ void Set##X(const std::vector<T>& f) { \
X##_.insert(X##_.end(), f.begin(), f.end()); \
}
@@ -141,7 +143,7 @@ class EmbeddingLookupOpModel {
uint32_t columns_;
uint32_t features_;
-#define DefineTensor(X) std::vector<float> X##_;
+#define DefineTensor(X, T) std::vector<T> X##_;
FOR_ALL_INPUT_AND_WEIGHT_TENSORS(DefineTensor);
FOR_ALL_OUTPUT_TENSORS(DefineTensor);
diff --git a/nn/common/operations/LSTM.cpp b/nn/common/operations/LSTM.cpp
index e7b0dec75..b61463551 100644
--- a/nn/common/operations/LSTM.cpp
+++ b/nn/common/operations/LSTM.cpp
@@ -18,120 +18,13 @@
#include "CpuExecutor.h"
#include "HalInterfaces.h"
+#include "internal/tensor_utils.h"
namespace android {
namespace nn {
-// TODO: move the kernels to a separate file as soon as we have the
-// optimized version ready.
namespace {
-// Limit a float input f between +abs_limit and -abs_limit.
-inline float Clip(float f, float abs_limit) {
- float result = (abs_limit < f) ? abs_limit : f;
- result = (-abs_limit > result) ? -abs_limit : result;
- return result;
-}
-
-// Multiply a matrix by a batch vector, and store results in a batch-size
-// vector.
-void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
- int m_cols, const float* vector,
- int n_batch, float* result) {
- for (int b = 0; b < n_batch; b++) {
- float* result_in_batch = result + b * m_rows;
- const float* matrix_ptr = matrix;
- for (int r = 0; r < m_rows; r++) {
- const float* vector_in_batch = vector + b * m_cols;
- for (int c = 0; c < m_cols; c++) {
- *result_in_batch += *matrix_ptr++ * *vector_in_batch++;
- }
- result_in_batch++;
- }
- }
-}
-
-// Cwise product of two vectors.
-void VectorVectorCwiseProduct(const float* vector1, const float* vector2,
- int v_size, float* result) {
- for (int v = 0; v < v_size; v++) {
- *result++ = *vector1++ * *vector2++;
- }
-}
-
-// Cwise product and accumulation of two vectors. Since it's a MAC operation, the
-// assumption here is that result array is initialized to valid values.
-void VectorVectorCwiseProductAccumulate(const float* vector1,
- const float* vector2, int v_size,
- float* result) {
- for (int v = 0; v < v_size; v++) {
- *result++ += *vector1++ * *vector2++;
- }
-}
-
-// Cwise product and accumulation of a vector and a batch-vector. Since it's a MAC
-// operation, the assumption here is that result array is initialized to valid
-// values.
-void VectorBatchVectorCwiseProductAccumulate(const float* vector, int v_size,
- const float* batch_vector,
- int n_batch, float* result) {
- for (int b = 0; b < n_batch; b++) {
- for (int v = 0; v < v_size; v++) {
- *result++ += vector[v] * *batch_vector++;
- }
- }
-}
-
-// Batch vector initialization with another vector.
-void VectorBatchVectorAssign(const float* vector, int v_size, int n_batch,
- float* batch_vector) {
- for (int b = 0; b < n_batch; b++) {
- memcpy(batch_vector + b * v_size, vector, v_size * sizeof(float));
- }
-}
-
-// Apply sigmoid to elements of a vector.
-void ApplySigmoidToVector(const float* vector, int v_size, float* result) {
- auto sigmoid_func = ActivationFunctor(kActivationSigmoid);
- for (int v = 0; v < v_size; v++) {
- *result++ = (sigmoid_func)(*vector++);
- }
-}
-
-// Apply activation function to elements of a vector.
-void ApplyActivationToVector(const float* vector, int v_size,
- ActivationFn activation, float* result) {
- auto activation_func = ActivationFunctor(activation);
- for (int v = 0; v < v_size; v++) {
- *result++ = (activation_func)(*vector++);
- }
-}
-
-// Copy vector to another vector.
-inline void CopyVector(const float* vector, int v_size, float* result) {
- memcpy(result, vector, v_size * sizeof(float));
-}
-
-// Compute "1.0f - elements of vector" (used in CIFG).
-void Sub1Vector(const float* vector, int v_size, float* result) {
- for (int v = 0; v < v_size; v++) {
- *result++ = 1.0f - *vector++;
- }
-}
-
-// Fill vector with 0.f.
-void ZeroVector(float* vector, int v_size) {
- memset(vector, 0, v_size * sizeof(float));
-}
-
-// Clip elements of a vector using a abs_limit value.
-void ClipVector(const float* vector, int v_size, float abs_limit,
- float* result) {
- for (int v = 0; v < v_size; v++) {
- *result++ = Clip(*vector++, abs_limit);
- }
-}
-
template <typename T>
inline T *GetBuffer(RunTimeOperandInfo* operand) {
return reinterpret_cast<T*>(operand->buffer);
@@ -436,100 +329,102 @@ bool LSTMCell::Eval() {
// Initialize scratch buffers with bias.
if (!use_cifg) {
- VectorBatchVectorAssign(GetBuffer<float>(input_gate_bias_), n_cell, n_batch,
- input_gate_scratch);
+ tensor_utils::VectorBatchVectorAssign(GetBuffer<float>(input_gate_bias_), n_cell, n_batch,
+ input_gate_scratch);
}
- VectorBatchVectorAssign(GetBuffer<float>(forget_gate_bias_), n_cell, n_batch,
- forget_gate_scratch);
- VectorBatchVectorAssign(GetBuffer<float>(cell_bias_), n_cell, n_batch,
- cell_scratch);
- VectorBatchVectorAssign(GetBuffer<float>(output_gate_bias_), n_cell, n_batch,
- output_gate_scratch);
+ tensor_utils::VectorBatchVectorAssign(GetBuffer<float>(forget_gate_bias_), n_cell, n_batch,
+ forget_gate_scratch);
+ tensor_utils::VectorBatchVectorAssign(GetBuffer<float>(cell_bias_), n_cell, n_batch,
+ cell_scratch);
+ tensor_utils::VectorBatchVectorAssign(GetBuffer<float>(output_gate_bias_), n_cell, n_batch,
+ output_gate_scratch);
// For each batch and cell: compute input_weight * input.
if (!use_cifg) {
- MatrixBatchVectorMultiplyAccumulate(
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(input_to_input_weights_), n_cell, n_input,
- GetBuffer<float>(input_), n_batch, input_gate_scratch);
+ GetBuffer<float>(input_), n_batch, input_gate_scratch, /*result_stride*/1);
}
- MatrixBatchVectorMultiplyAccumulate(
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(input_to_forget_weights_), n_cell, n_input,
- GetBuffer<float>(input_), n_batch, forget_gate_scratch);
- MatrixBatchVectorMultiplyAccumulate(
+ GetBuffer<float>(input_), n_batch, forget_gate_scratch, /*result_stride*/1);
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(input_to_cell_weights_), n_cell, n_input,
- GetBuffer<float>(input_), n_batch, cell_scratch);
- MatrixBatchVectorMultiplyAccumulate(
+ GetBuffer<float>(input_), n_batch, cell_scratch, /*result_stride*/1);
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(input_to_output_weights_), n_cell, n_input,
- GetBuffer<float>(input_), n_batch, output_gate_scratch);
+ GetBuffer<float>(input_), n_batch, output_gate_scratch, /*result_stride*/1);
// For each batch and cell: compute recurrent_weight * output_state.
if (!use_cifg) {
- MatrixBatchVectorMultiplyAccumulate(
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(recurrent_to_input_weights_), n_cell, n_output,
- GetBuffer<float>(output_state_in_), n_batch, input_gate_scratch);
+ GetBuffer<float>(output_state_in_), n_batch, input_gate_scratch, /*result_stride*/1);
}
- MatrixBatchVectorMultiplyAccumulate(
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(recurrent_to_forget_weights_), n_cell, n_output,
- GetBuffer<float>(output_state_in_), n_batch, forget_gate_scratch);
- MatrixBatchVectorMultiplyAccumulate(
+ GetBuffer<float>(output_state_in_), n_batch, forget_gate_scratch, /*result_stride*/1);
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(recurrent_to_cell_weights_), n_cell, n_output,
- GetBuffer<float>(output_state_in_), n_batch, cell_scratch);
- MatrixBatchVectorMultiplyAccumulate(
+ GetBuffer<float>(output_state_in_), n_batch, cell_scratch, /*result_stride*/1);
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
GetBuffer<float>(recurrent_to_output_weights_), n_cell, n_output,
- GetBuffer<float>(output_state_in_), n_batch, output_gate_scratch);
+ GetBuffer<float>(output_state_in_), n_batch, output_gate_scratch, /*result_stride*/1);
// For each batch and cell: update input gate.
if (!use_cifg) {
if (use_peephole) {
- VectorBatchVectorCwiseProductAccumulate(
+ tensor_utils::VectorBatchVectorCwiseProductAccumulate(
GetBuffer<float>(cell_to_input_weights_), n_cell,
GetBuffer<float>(cell_state_in_), n_batch, input_gate_scratch);
}
- ApplySigmoidToVector(input_gate_scratch, n_cell * n_batch,
- input_gate_scratch);
+ tensor_utils::ApplySigmoidToVector(input_gate_scratch, n_cell * n_batch,
+ input_gate_scratch);
}
// For each batch and cell: update forget gate.
if (use_peephole) {
- VectorBatchVectorCwiseProductAccumulate(
+ tensor_utils::VectorBatchVectorCwiseProductAccumulate(
GetBuffer<float>(cell_to_forget_weights_), n_cell,
GetBuffer<float>(cell_state_in_), n_batch, forget_gate_scratch);
}
- ApplySigmoidToVector(forget_gate_scratch, n_cell * n_batch,
- forget_gate_scratch);
+ tensor_utils::ApplySigmoidToVector(forget_gate_scratch, n_cell * n_batch,
+ forget_gate_scratch);
// For each batch and cell: update the cell.
- VectorVectorCwiseProduct(forget_gate_scratch, GetBuffer<float>(cell_state_in_),
- n_batch * n_cell, GetBuffer<float>(cell_state_out_));
- ApplyActivationToVector(cell_scratch, n_batch * n_cell, params_.activation_,
- cell_scratch);
+ tensor_utils::VectorVectorCwiseProduct(
+ forget_gate_scratch, GetBuffer<float>(cell_state_in_), n_batch * n_cell,
+ GetBuffer<float>(cell_state_out_));
+ tensor_utils::ApplyActivationToVector(
+ cell_scratch, n_batch * n_cell, params_.activation_, cell_scratch);
if (use_cifg) {
- Sub1Vector(forget_gate_scratch, n_batch * n_cell, forget_gate_scratch);
- VectorVectorCwiseProductAccumulate(cell_scratch, forget_gate_scratch,
- n_batch * n_cell,
- GetBuffer<float>(cell_state_out_));
+ tensor_utils::Sub1Vector(forget_gate_scratch, n_batch * n_cell,
+ forget_gate_scratch);
+ tensor_utils::VectorVectorCwiseProductAccumulate(
+ cell_scratch, forget_gate_scratch, n_batch * n_cell,
+ GetBuffer<float>(cell_state_out_));
} else {
- VectorVectorCwiseProductAccumulate(cell_scratch, input_gate_scratch,
- n_batch * n_cell,
- GetBuffer<float>(cell_state_out_));
+ tensor_utils::VectorVectorCwiseProductAccumulate(
+ cell_scratch, input_gate_scratch, n_batch * n_cell,
+ GetBuffer<float>(cell_state_out_));
}
if (params_.cell_clip_ > 0.0) {
- ClipVector(GetBuffer<float>(cell_state_out_), n_batch * n_cell,
- params_.cell_clip_, GetBuffer<float>(cell_state_out_));
+ tensor_utils::ClipVector(GetBuffer<float>(cell_state_out_), n_batch * n_cell,
+ params_.cell_clip_, GetBuffer<float>(cell_state_out_));
}
// For each batch and cell: update the output gate.
if (use_peephole) {
- VectorBatchVectorCwiseProductAccumulate(
+ tensor_utils::VectorBatchVectorCwiseProductAccumulate(
GetBuffer<float>(cell_to_output_weights_), n_cell,
GetBuffer<float>(cell_state_out_), n_batch, output_gate_scratch);
}
- ApplySigmoidToVector(output_gate_scratch, n_batch * n_cell,
- output_gate_scratch);
- ApplyActivationToVector(GetBuffer<float>(cell_state_out_), n_batch * n_cell,
- params_.activation_, cell_scratch);
- VectorVectorCwiseProduct(output_gate_scratch, cell_scratch, n_batch * n_cell,
- output_gate_scratch);
+ tensor_utils::ApplySigmoidToVector(output_gate_scratch, n_batch * n_cell,
+ output_gate_scratch);
+ tensor_utils::ApplyActivationToVector(GetBuffer<float>(cell_state_out_), n_batch * n_cell,
+ params_.activation_, cell_scratch);
+ tensor_utils::VectorVectorCwiseProduct(output_gate_scratch, cell_scratch, n_batch * n_cell,
+ output_gate_scratch);
// For each batch: update the projection and output_state.
const bool use_projection_weight =
@@ -537,24 +432,25 @@ bool LSTMCell::Eval() {
const bool use_projection_bias = (projection_bias_->lifetime != OperandLifeTime::NO_VALUE);
if (use_projection_weight) {
if (use_projection_bias) {
- VectorBatchVectorAssign(GetBuffer<float>(projection_bias_), n_output,
- n_batch, GetBuffer<float>(output_));
+ tensor_utils::VectorBatchVectorAssign(GetBuffer<float>(projection_bias_), n_output,
+ n_batch, GetBuffer<float>(output_));
} else {
- ZeroVector(GetBuffer<float>(output_), n_batch * n_output);
+ tensor_utils::ZeroVector(GetBuffer<float>(output_), n_batch * n_output);
}
- MatrixBatchVectorMultiplyAccumulate(GetBuffer<float>(projection_weights_),
- n_output, n_cell, output_gate_scratch,
- n_batch, GetBuffer<float>(output_));
+ tensor_utils::MatrixBatchVectorMultiplyAccumulate(
+ GetBuffer<float>(projection_weights_), n_output, n_cell,
+ output_gate_scratch, n_batch, GetBuffer<float>(output_),
+ /*result_stride*/1);
if (params_.proj_clip_ > 0.0) {
- ClipVector(GetBuffer<float>(output_), n_batch * n_output,
- params_.proj_clip_, GetBuffer<float>(output_));
+ tensor_utils::ClipVector(GetBuffer<float>(output_), n_batch * n_output,
+ params_.proj_clip_, GetBuffer<float>(output_));
}
} else {
- CopyVector(output_gate_scratch, n_batch * n_output,
- GetBuffer<float>(output_));
+ tensor_utils::CopyVector(output_gate_scratch, n_batch * n_output,
+ GetBuffer<float>(output_));
}
- CopyVector(GetBuffer<float>(output_), n_batch * n_output,
- GetBuffer<float>(output_state_out_));
+ tensor_utils::CopyVector(GetBuffer<float>(output_), n_batch * n_output,
+ GetBuffer<float>(output_state_out_));
return true;
}
diff --git a/nn/common/operations/LSTMTest.cpp b/nn/common/operations/LSTMTest.cpp
index 6a05e04da..ce2d5d72a 100644
--- a/nn/common/operations/LSTMTest.cpp
+++ b/nn/common/operations/LSTMTest.cpp
@@ -66,10 +66,10 @@ std::vector<Matcher<float>> ArrayFloatNear(const std::vector<float>& values,
// For all output and intermediate states
#define FOR_ALL_OUTPUT_TENSORS(ACTION) \
- ACTION(Output) \
+ ACTION(ScratchBuffer) \
ACTION(OutputStateOut) \
ACTION(CellStateOut) \
- ACTION(ScratchBuffer)
+ ACTION(Output) \
class LSTMOpModel {
public:
@@ -86,10 +86,11 @@ public:
activation_(ActivationFn::kActivationTanh),
cell_clip_(cell_clip), proj_clip_(proj_clip) {
std::vector<uint32_t> inputs;
- std::vector<std::vector<uint32_t>> input_shapes(input_shapes0.begin(), input_shapes0.end());
- auto it = input_shapes.begin();
+ std::vector<std::vector<uint32_t>> input_shapes(input_shapes0);
+
input_shapes.push_back({n_batch, n_output});
input_shapes.push_back({n_batch, n_cell});
+ auto it = input_shapes.begin();
// Input and weights
#define AddInput(X) \
@@ -110,10 +111,10 @@ public:
// Output and other intermediate state
std::vector<std::vector<uint32_t>> output_shapes{
- {n_batch, n_output},
+ {n_batch, n_cell * (use_cifg ? 3 : 4)},
{n_batch, n_output},
{n_batch, n_cell},
- {n_batch, n_cell, 4}
+ {n_batch, n_output},
};
std::vector<uint32_t> outputs;
@@ -131,6 +132,8 @@ public:
model_.identifyInputsAndOutputs(inputs, outputs);
Input_.insert(Input_.end(), n_batch * n_input, 0.f);
+ OutputStateIn_.insert(OutputStateIn_.end(), n_batch * n_output, 0.f);
+ CellStateIn_.insert(CellStateIn_.end(), n_batch * n_cell, 0.f);
auto multiAll = [](const std::vector<uint32_t> &dims) -> uint32_t {
uint32_t sz = 1;
@@ -160,10 +163,12 @@ public:
void ResetOutputState() {
std::fill(OutputStateIn_.begin(), OutputStateIn_.end(), 0.f);
+ std::fill(OutputStateOut_.begin(), OutputStateOut_.end(), 0.f);
}
void ResetCellState() {
std::fill(CellStateIn_.begin(), CellStateIn_.end(), 0.f);
+ std::fill(CellStateOut_.begin(), CellStateOut_.end(), 0.f);
}
void SetInput(int offset, float *begin, float *end) {
@@ -180,12 +185,15 @@ public:
void Invoke() {
ASSERT_TRUE(model_.isValid());
+ OutputStateIn_.swap(OutputStateOut_);
+ CellStateIn_.swap(CellStateOut_);
+
Compilation compilation(&model_);
compilation.finish();
Execution execution(&compilation);
#define SetInputOrWeight(X) \
ASSERT_EQ(execution.setInput(LSTMCell::k##X##Tensor, X##_.data(), \
- sizeof(X##_)), \
+ sizeof(float)*X##_.size()), \
Result::NO_ERROR);
FOR_ALL_INPUT_AND_WEIGHT_TENSORS(SetInputOrWeight);
@@ -194,7 +202,7 @@ public:
#define SetOutput(X) \
ASSERT_EQ(execution.setOutput(LSTMCell::k##X##Tensor, X##_.data(), \
- sizeof(X##_)), \
+ sizeof(float)*X##_.size()), \
Result::NO_ERROR);
FOR_ALL_OUTPUT_TENSORS(SetOutput);
diff --git a/nn/common/operations/RNNTest.cpp b/nn/common/operations/RNNTest.cpp
index 323484bbd..58243d92b 100644
--- a/nn/common/operations/RNNTest.cpp
+++ b/nn/common/operations/RNNTest.cpp
@@ -203,6 +203,7 @@ class BasicRNNOpModel {
void ResetHiddenState() {
std::fill(HiddenStateIn_.begin(), HiddenStateIn_.end(), 0.f);
+ std::fill(HiddenStateOut_.begin(), HiddenStateOut_.end(), 0.f);
}
const std::vector<float>& GetOutput() const { return Output_; }
@@ -214,11 +215,14 @@ class BasicRNNOpModel {
void Invoke() {
ASSERT_TRUE(model_.isValid());
+ HiddenStateIn_.swap(HiddenStateOut_);
+
Compilation compilation(&model_);
compilation.finish();
Execution execution(&compilation);
#define SetInputOrWeight(X) \
- ASSERT_EQ(execution.setInput(RNN::k##X##Tensor, X##_.data(), sizeof(X##_)), \
+ ASSERT_EQ(execution.setInput(RNN::k##X##Tensor, X##_.data(), \
+ sizeof(float) * X##_.size()), \
Result::NO_ERROR);
FOR_ALL_INPUT_AND_WEIGHT_TENSORS(SetInputOrWeight);
@@ -226,7 +230,8 @@ class BasicRNNOpModel {
#undef SetInputOrWeight
#define SetOutput(X) \
- ASSERT_EQ(execution.setOutput(RNN::k##X##Tensor, X##_.data(), sizeof(X##_)), \
+ ASSERT_EQ(execution.setOutput(RNN::k##X##Tensor, X##_.data(), \
+ sizeof(float) * X##_.size()), \
Result::NO_ERROR);
FOR_ALL_OUTPUT_TENSORS(SetOutput);
diff --git a/nn/common/operations/SVDFTest.cpp b/nn/common/operations/SVDFTest.cpp
index b5940e045..0bd59bab6 100644
--- a/nn/common/operations/SVDFTest.cpp
+++ b/nn/common/operations/SVDFTest.cpp
@@ -120,17 +120,18 @@ static float svdf_golden_output[] = {
class SVDFOpModel {
public:
SVDFOpModel(uint32_t batches, uint32_t units, uint32_t input_size,
- uint32_t memory_size)
+ uint32_t memory_size, uint32_t rank)
: batches_(batches),
units_(units),
input_size_(input_size),
- memory_size_(memory_size) {
+ memory_size_(memory_size),
+ rank_(rank) {
std::vector<std::vector<uint32_t>> input_shapes{
{batches_, input_size_}, // Input tensor
- {units_, input_size_}, // weights_feature tensor
- {units_, memory_size_}, // weights_time tensor
+ {units_ * rank_, input_size_}, // weights_feature tensor
+ {units_ * rank_, memory_size_}, // weights_time tensor
{units_}, // bias tensor
- {batches_, (memory_size_ - 1) * units_}, // state in
+ {batches_, memory_size * units_ * rank_}, // state in tensor
};
std::vector<uint32_t> inputs;
auto it = input_shapes.begin();
@@ -151,7 +152,7 @@ class SVDFOpModel {
inputs.push_back(model_.addOperand(&ActivationParamTy));
// Output and other intermediate state
- std::vector<std::vector<uint32_t>> output_shapes{{batches_, (memory_size_ - 1) * units_},
+ std::vector<std::vector<uint32_t>> output_shapes{{batches_, memory_size_ * units_ * rank_},
{batches_, units_}};
std::vector<uint32_t> outputs;
@@ -166,6 +167,7 @@ class SVDFOpModel {
#undef AddOutput
Input_.insert(Input_.end(), batches_ * input_size_, 0.f);
+ StateIn_.insert(StateIn_.end(), batches_ * units_ * rank_ * memory_size_, 0.f);
auto multiAll = [](const std::vector<uint32_t> &dims) -> uint32_t {
uint32_t sz = 1;
@@ -191,8 +193,12 @@ class SVDFOpModel {
Compilation compilation(&model_);
compilation.finish();
Execution execution(&compilation);
+
+ StateIn_.swap(StateOut_);
+
#define SetInputOrWeight(X) \
- ASSERT_EQ(execution.setInput(SVDF::k##X##Tensor, X##_.data(), sizeof(X##_)), \
+ ASSERT_EQ(execution.setInput(SVDF::k##X##Tensor, X##_.data(), \
+ sizeof(float) * X##_.size()), \
Result::NO_ERROR);
FOR_ALL_INPUT_AND_WEIGHT_TENSORS(SetInputOrWeight);
@@ -200,15 +206,16 @@ class SVDFOpModel {
#undef SetInputOrWeight
#define SetOutput(X) \
- ASSERT_EQ(execution.setOutput(SVDF::k##X##Tensor, X##_.data(), sizeof(X##_)), \
+ EXPECT_TRUE(X##_.data() != nullptr); \
+ ASSERT_EQ(execution.setOutput(SVDF::k##X##Tensor, X##_.data(), \
+ sizeof(float) * X##_.size()), \
Result::NO_ERROR);
FOR_ALL_OUTPUT_TENSORS(SetOutput);
#undef SetOutput
- int rank = 1;
- ASSERT_EQ(execution.setInput(SVDF::kRankParam, &rank, sizeof(rank)),
+ ASSERT_EQ(execution.setInput(SVDF::kRankParam, &rank_, sizeof(rank_)),
Result::NO_ERROR);
int activation = ActivationFn::kActivationNone;
@@ -235,7 +242,10 @@ class SVDFOpModel {
}
// Resets the state of SVDF op by filling it with 0's.
- void ResetState() { std::fill(StateIn_.begin(), StateIn_.end(), 0.f); }
+ void ResetState() {
+ std::fill(StateIn_.begin(), StateIn_.end(), 0.f);
+ std::fill(StateOut_.begin(), StateOut_.end(), 0.f);
+ }
// Extracts the output tensor from the SVDF op.
const std::vector<float>& GetOutput() const { return Output_; }
@@ -251,6 +261,7 @@ class SVDFOpModel {
const uint32_t units_;
const uint32_t input_size_;
const uint32_t memory_size_;
+ const uint32_t rank_;
#define DefineTensor(X) std::vector<float> X##_;
@@ -262,7 +273,7 @@ class SVDFOpModel {
TEST(SVDFOpTest, BlackBoxTest) {
SVDFOpModel svdf(/*batches=*/2, /*units=*/4, /*input_size=*/3,
- /*memory_size=*/10);
+ /*memory_size=*/10, /*rank=*/1);
svdf.SetWeightsFeature({-0.31930989, -0.36118156, 0.0079667, 0.37613347,
0.22197971, 0.12416199, 0.27901134, 0.27557442,
0.3905206, -0.36137494, -0.06634006, -0.10640851});
@@ -280,6 +291,8 @@ TEST(SVDFOpTest, BlackBoxTest) {
-0.10781813, 0.27201805, 0.14324132, -0.23681851, -0.27115166,
-0.01580888, -0.14943552, 0.15465137, 0.09784451, -0.0337657});
+ svdf.SetBias({});
+
svdf.ResetState();
const int svdf_num_batches = svdf.num_batches();
const int svdf_input_size = svdf.input_size();
diff --git a/nn/common/operations/internal/optimized/cpu_check.h b/nn/common/operations/internal/optimized/cpu_check.h
new file mode 100644
index 000000000..02f42fd42
--- /dev/null
+++ b/nn/common/operations/internal/optimized/cpu_check.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_CPU_CHECK_
+#define FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_CPU_CHECK_
+
+// NEON_OR_PORTABLE(SomeFunc, arcs) calls NeonSomeFunc(args) if NEON is
+// enabled at build time, or PortableSomeFunc(args) otherwise.
+#if defined(__ARM_NEON__) || defined(__ARM_NEON)
+#define NEON_OR_PORTABLE(funcname, ...) Neon##funcname(__VA_ARGS__)
+#else
+#define NEON_OR_PORTABLE(funcname, ...) Portable##funcname(__VA_ARGS__)
+#endif
+
+#endif // FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_CPU_CHECK_
diff --git a/nn/common/operations/internal/optimized/neon_tensor_utils.cc b/nn/common/operations/internal/optimized/neon_tensor_utils.cc
new file mode 100644
index 000000000..f17730fc5
--- /dev/null
+++ b/nn/common/operations/internal/optimized/neon_tensor_utils.cc
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+
+#include "ActivationFunctor.h"
+#include "tensor_utils_impl.h"
+
+#ifdef USE_NEON
+
+#include <arm_neon.h>
+#define kFloatWeightsPerNeonLane 4
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+void NeonMatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
+ int m_cols, const float* vector,
+ int n_batch, float* result,
+ int result_stride) {
+ // If v_size is not divisible by kWeightsPerNeonLane, we cannot use the main
+ // vectorized loop, and we need to process sequentially. postamble_start shows
+ // the start index where this should happen.
+ const int postamble_start =
+ m_cols - (m_cols & (kFloatWeightsPerNeonLane - 1));
+
+ // The arrays used to cache the vector.
+ float32x4_t* vector_cache_float32x4 =
+ new float32x4_t[(m_cols / kFloatWeightsPerNeonLane) *
+ sizeof(float32x4_t)];
+
+ for (int b = 0; b < n_batch; b++) {
+ float* result_in_batch = result + b * m_rows;
+ const float* vector_in_batch = vector + b * m_cols;
+ const float* matrix_ptr = matrix;
+ for (int c = 0; c < postamble_start; c += kFloatWeightsPerNeonLane) {
+ vector_cache_float32x4[c >> 2] = vld1q_f32(vector_in_batch + c);
+ }
+ for (int r = 0; r < m_rows; r++) {
+ float32x4_t acc_32x4 = vmovq_n_f32(0.0);
+ for (int c = 0; c < postamble_start; c += kFloatWeightsPerNeonLane) {
+ float32x4_t temp = vector_cache_float32x4[c >> 2];
+ // Load 4 float values from vector1 and vector2 and accumulator.
+ float32x4_t v1_f32x4 = vld1q_f32(matrix_ptr + c);
+ // Vector multiply-accumulate 4 float
+ acc_32x4 = vmlaq_f32(acc_32x4, v1_f32x4, temp);
+ }
+ // Add the 4 intermediate sum values to get the final dot-prod value for
+ // this column.
+ *result_in_batch +=
+ (vgetq_lane_f32(acc_32x4, 0) + vgetq_lane_f32(acc_32x4, 1) +
+ vgetq_lane_f32(acc_32x4, 2) + vgetq_lane_f32(acc_32x4, 3));
+ for (int c = postamble_start; c < m_cols; c++) {
+ *result_in_batch += matrix_ptr[c] * vector_in_batch[c];
+ }
+ matrix_ptr += m_cols;
+ result_in_batch += result_stride;
+ }
+ }
+ delete[] vector_cache_float32x4;
+}
+
+void NeonVectorVectorCwiseProduct(const float* vector1, const float* vector2,
+ int v_size, float* result) {
+ // If v_size is not divisible by kWeightsPerNeonLane, we cannot use the main
+ // vectorized loop, and we need to process sequentially. postamble_start shows
+ // the start index where this should happen.
+ const int postamble_start =
+ v_size - (v_size & (kFloatWeightsPerNeonLane - 1));
+ for (int v = 0; v < postamble_start; v += kFloatWeightsPerNeonLane) {
+ // Load 4 float values from vector1 and vector2.
+ float32x4_t v1_f32x4 = vld1q_f32(vector1 + v);
+ float32x4_t v2_f32x4 = vld1q_f32(vector2 + v);
+ // Vector multiply 4 float
+ float32x4_t mul_32x4 = vmulq_f32(v1_f32x4, v2_f32x4);
+ // Save to result array.
+ vst1q_f32(&result[v], mul_32x4);
+ }
+ for (int v = postamble_start; v < v_size; v++) {
+ result[v] = vector1[v] * vector2[v];
+ }
+}
+
+void NeonVectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2, int v_size,
+ float* result) {
+ // If v_size is not divisible by kWeightsPerNeonLane, we cannot use the main
+ // vectorized loop, and we need to process sequentially. postamble_start shows
+ // the start index where this should happen.
+ const int postamble_start =
+ v_size - (v_size & (kFloatWeightsPerNeonLane - 1));
+ for (int v = 0; v < postamble_start; v += kFloatWeightsPerNeonLane) {
+ // Load 4 float values from vector1 and vector2 and accumulator.
+ float32x4_t v1_f32x4 = vld1q_f32(vector1 + v);
+ float32x4_t v2_f32x4 = vld1q_f32(vector2 + v);
+ float32x4_t acc_32x4 = vld1q_f32(result + v);
+ // Vector multiply-accumulate 4 float
+ acc_32x4 = vmlaq_f32(acc_32x4, v1_f32x4, v2_f32x4);
+ // Save to result array.
+ vst1q_f32(&result[v], acc_32x4);
+ }
+ for (int v = postamble_start; v < v_size; v++) {
+ result[v] += vector1[v] * vector2[v];
+ }
+}
+
+void NeonVectorBatchVectorCwiseProductAccumulate(const float* vector,
+ int v_size,
+ const float* batch_vector,
+ int n_batch, float* result) {
+ // If v_size is not divisible by kWeightsPerNeonLane, we cannot use the main
+ // vectorized loop, and we need to process sequentially. postamble_start shows
+ // the start index where this should happen.
+ const int postamble_start =
+ v_size - (v_size & (kFloatWeightsPerNeonLane - 1));
+
+ // The arrays used to cache the vector.
+ float32x4_t* vector_cache_float32x4 =
+ new float32x4_t[(v_size / kFloatWeightsPerNeonLane) *
+ sizeof(float32x4_t)];
+ for (int v = 0; v < postamble_start; v += kFloatWeightsPerNeonLane) {
+ vector_cache_float32x4[v >> 2] = vld1q_f32(vector + v);
+ }
+
+ float* result_ptr = result;
+ const float* batch_vector_ptr = batch_vector;
+ for (int b = 0; b < n_batch; b++) {
+ for (int v = 0; v < postamble_start; v += kFloatWeightsPerNeonLane) {
+ // Load from memory to vectors.
+ float32x4_t result_f32x4 = vld1q_f32(result_ptr + v);
+ float32x4_t batch_vector_f32x4 = vld1q_f32(batch_vector_ptr + v);
+ // Multiply-accumulate.
+ result_f32x4 = vmlaq_f32(result_f32x4, batch_vector_f32x4,
+ vector_cache_float32x4[v >> 2]);
+ // Store.
+ vst1q_f32(result_ptr + v, result_f32x4);
+ }
+ // Postamble loop
+ for (int v = postamble_start; v < v_size; v++) {
+ result_ptr[v] += vector[v] * batch_vector_ptr[v];
+ }
+ // Update the pointers.
+ result_ptr += v_size;
+ batch_vector_ptr += v_size;
+ }
+ delete[] vector_cache_float32x4;
+}
+
+void NeonSub1Vector(const float* vector, int v_size, float* result) {
+ // If v_size is not divisible by kWeightsPerNeonLane, we cannot use the main
+ // vectorized loop, and we need to process sequentially. postamble_start shows
+ // the start index where this should happen.
+ const int postamble_start =
+ v_size - (v_size & (kFloatWeightsPerNeonLane - 1));
+
+ float32x4_t one_f32x4 = vmovq_n_f32(1.0);
+ for (int v = 0; v < postamble_start; v += kFloatWeightsPerNeonLane) {
+ // Load 4 float values from the current pointers of the input column and
+ // subtract from 1.
+ float32x4_t v_f32x4 = vld1q_f32(vector + v);
+ float32x4_t result_f32x4 = vsubq_f32(one_f32x4, v_f32x4);
+ // Save to output.
+ vst1q_f32(result + v, result_f32x4);
+ }
+ for (int v = postamble_start; v < v_size; v++) {
+ result[v] = 1.0f - vector[v];
+ }
+}
+
+void NeonClipVector(const float* vector, int v_size, float abs_limit,
+ float* result) {
+ // If v_size is not divisible by kWeightsPerNeonLane, we cannot use the main
+ // vectorized loop, and we need to process sequentially. postamble_start shows
+ // the start index where this should happen.
+ const int postamble_start =
+ v_size - (v_size & (kFloatWeightsPerNeonLane - 1));
+
+ // Replicate abs_limit and -abs_limit in two vectors.
+ const float32x4_t abs_limit_f32x4 = vmovq_n_f32(abs_limit);
+ const float32x4_t neg_abs_limit_f32x4 = vmovq_n_f32(-abs_limit);
+
+ for (int v = 0; v < postamble_start; v += kFloatWeightsPerNeonLane) {
+ // Load from memory to vector.
+ float32x4_t v_f32x4 = vld1q_f32(vector + v);
+ // Clip between abs_limit and -abs_limit.
+ float32x4_t result_f32x4 = vminq_f32(abs_limit_f32x4, v_f32x4);
+ result_f32x4 = vmaxq_f32(neg_abs_limit_f32x4, result_f32x4);
+ // Save to output.
+ vst1q_f32(result + v, result_f32x4);
+ }
+ // Postamble loop.
+ for (int v = postamble_start; v < v_size; v++) {
+ result[v] = (abs_limit < vector[v]) ? abs_limit : vector[v];
+ result[v] = (-abs_limit > result[v]) ? -abs_limit : result[v];
+ }
+}
+
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
+
+#endif // USE_NEON
diff --git a/nn/common/operations/internal/optimized/neon_tensor_utils.h b/nn/common/operations/internal/optimized/neon_tensor_utils.h
new file mode 100644
index 000000000..92a151cc1
--- /dev/null
+++ b/nn/common/operations/internal/optimized/neon_tensor_utils.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_H_
+#define FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_H_
+
+#include "ActivationFunctor.h"
+#include "cpu_check.h"
+#include "tensor_utils_impl.h"
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
+ int m_cols, const float* vector,
+ int n_batch, float* result,
+ int result_stride) {
+ NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols,
+ vector, n_batch, result, result_stride);
+}
+
+void VectorVectorCwiseProduct(const float* vector1, const float* vector2,
+ int v_size, float* result) {
+ NEON_OR_PORTABLE(VectorVectorCwiseProduct, vector1, vector2, v_size, result);
+}
+
+void VectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2, int v_size,
+ float* result) {
+ NEON_OR_PORTABLE(VectorVectorCwiseProductAccumulate, vector1, vector2, v_size,
+ result);
+}
+
+void VectorBatchVectorCwiseProductAccumulate(const float* vector, int v_size,
+ const float* batch_vector,
+ int n_batch, float* result) {
+ NEON_OR_PORTABLE(VectorBatchVectorCwiseProductAccumulate, vector, v_size,
+ batch_vector, n_batch, result);
+}
+
+float VectorVectorDotProduct(const float* vector1, const float* vector2,
+ int v_size) {
+ return PortableVectorVectorDotProduct(vector1, vector2, v_size);
+}
+
+void BatchVectorBatchVectorDotProduct(const float* vector1,
+ const float* vector2, int v_size,
+ int n_batch, float* result,
+ int result_stride) {
+ PortableBatchVectorBatchVectorDotProduct(vector1, vector2, v_size, n_batch,
+ result, result_stride);
+}
+
+void VectorBatchVectorAssign(const float* vector, int v_size, int n_batch,
+ float* batch_vector) {
+ PortableVectorBatchVectorAssign(vector, v_size, n_batch, batch_vector);
+}
+
+void ApplySigmoidToVector(const float* vector, int v_size, float* result) {
+ PortableApplySigmoidToVector(vector, v_size, result);
+}
+
+void ApplyActivationToVector(const float* vector, int v_size,
+ ActivationFn activation, float* result) {
+ PortableApplyActivationToVector(vector, v_size, activation, result);
+}
+
+void CopyVector(const float* vector, int v_size, float* result) {
+ PortableCopyVector(vector, v_size, result);
+}
+
+void Sub1Vector(const float* vector, int v_size, float* result) {
+ NEON_OR_PORTABLE(Sub1Vector, vector, v_size, result);
+}
+
+void ZeroVector(float* vector, int v_size) {
+ PortableZeroVector(vector, v_size);
+}
+
+float Clip(float f, float abs_limit) { return PortableClip(f, abs_limit); }
+
+void ClipVector(const float* vector, int v_size, float abs_limit,
+ float* result) {
+ NEON_OR_PORTABLE(ClipVector, vector, v_size, abs_limit, result);
+}
+
+// TODO(ghodrat): Implement Neon version.
+void VectorShiftLeft(float* vector, int v_size, float shift_value) {
+ PortableVectorShiftLeft(vector, v_size, shift_value);
+}
+
+// TODO(ghodrat): Implement Neon version.
+void ReductionSumVector(const float* input_vector, int input_stride,
+ float* output_vector, int output_size,
+ int reduction_size) {
+ PortableReductionSumVector(input_vector, input_stride, output_vector,
+ output_size, reduction_size);
+}
+
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
+
+#endif // FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_H_
diff --git a/nn/common/operations/internal/optimized/tensor_utils_impl.h b/nn/common/operations/internal/optimized/tensor_utils_impl.h
new file mode 100644
index 000000000..249a67255
--- /dev/null
+++ b/nn/common/operations/internal/optimized/tensor_utils_impl.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_TENSOR_UTILS_IMPL_H_
+#define FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_TENSOR_UTILS_IMPL_H_
+
+#include "ActivationFunctor.h"
+
+#ifndef USE_NEON
+#if defined(__ARM_NEON__) || defined(__ARM_NEON)
+#define USE_NEON
+#endif // defined(__ARM_NEON__) || defined(__ARM_NEON)
+#endif // USE_NEON
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+// Multiply a matrix by a batch vector, and store results in a batch-size
+// vector.
+void PortableMatrixBatchVectorMultiplyAccumulate(const float* matrix,
+ int m_rows, int m_cols,
+ const float* vector,
+ int n_batch, float* result,
+ int result_stride);
+void NeonMatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
+ int m_cols, const float* vector,
+ int n_batch, float* result,
+ int result_stride);
+
+// Cwise product of two vectors.
+void PortableVectorVectorCwiseProduct(const float* vector1,
+ const float* vector2, int v_size,
+ float* result);
+void NeonVectorVectorCwiseProduct(const float* vector1, const float* vector2,
+ int v_size, float* result);
+
+// Cwise product and accumulate of two vectors. Since it's a MAC operation, the
+// assumption here is that result array is initialized to valid values.
+void PortableVectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2,
+ int v_size, float* result);
+void NeonVectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2, int v_size,
+ float* result);
+
+// Dot product of two vectors.
+float PortableVectorVectorDotProduct(const float* vector1, const float* vector2,
+ int v_size);
+
+// Dot product of two batch vectors.
+void PortableBatchVectorBatchVectorDotProduct(const float* vector1,
+ const float* vector2, int v_size,
+ int n_batch, float* result,
+ int result_stride);
+
+// Cwise product and accumulate of a vector and a batch-vector. Since it's a MAC
+// operation, the assumption here is that result array is initialized to valid
+// values.
+void PortableVectorBatchVectorCwiseProductAccumulate(const float* vector,
+ int v_size,
+ const float* batch_vector,
+ int n_batch,
+ float* result);
+void NeonVectorBatchVectorCwiseProductAccumulate(const float* vector,
+ int v_size,
+ const float* batch_vector,
+ int n_batch, float* result);
+
+// Compute "1.0f - elements of vector" (used in CIFG).
+void PortableSub1Vector(const float* vector, int v_size, float* result);
+void NeonSub1Vector(const float* vector, int v_size, float* result);
+
+// Clip elements of a vector using a abs_limit value.
+void PortableClipVector(const float* vector, int v_size, float abs_limit,
+ float* result);
+void NeonClipVector(const float* vector, int v_size, float abs_limit,
+ float* result);
+
+// Batch vector initialization with another vector.
+void PortableVectorBatchVectorAssign(const float* vector, int v_size,
+ int n_batch, float* batch_vector);
+
+// Apply sigmoid to elements of a vector.
+void PortableApplySigmoidToVector(const float* vector, int v_size,
+ float* result);
+
+// Apply activation function to elements of a vector.
+void PortableApplyActivationToVector(const float* vector, int v_size,
+ ActivationFn activation,
+ float* result);
+
+// Copy vector to another vector.
+void PortableCopyVector(const float* vector, int v_size, float* result);
+
+// Fill vector with 0.f.
+void PortableZeroVector(float* vector, int v_size);
+
+// Limit a float input f between +abs_limit and -abs_limit.
+float PortableClip(float f, float abs_limit);
+
+// Shift left a vector in place with v_size size.
+void PortableVectorShiftLeft(float* vector, int v_size, float shift_value);
+
+// Reduce-sum on a float input vector:
+// input_vector: float pointer to input vector.
+// input_stride: input vector stride.
+// output_vector: float pointer to vector.
+// output_size: output vector size.
+// reduction_size: number of consecutive elements from input vector which are
+// added to get one element of output.
+void PortableReductionSumVector(const float* input_vector, int input_stride,
+ float* output_vector, int output_size,
+ int reduction_size);
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
+
+#endif // FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_OPTIMIZED_TENSOR_UTILS_IMPL_H_
diff --git a/nn/common/operations/internal/reference/portable_tensor_utils.cc b/nn/common/operations/internal/reference/portable_tensor_utils.cc
new file mode 100644
index 000000000..007113ec3
--- /dev/null
+++ b/nn/common/operations/internal/reference/portable_tensor_utils.cc
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ActivationFunctor.h"
+#include "Utils.h"
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+float PortableClip(float f, float abs_limit) {
+ float result = (abs_limit < f) ? abs_limit : f;
+ result = (-abs_limit > result) ? -abs_limit : result;
+ return result;
+}
+
+void PortableMatrixBatchVectorMultiplyAccumulate(const float* matrix,
+ int m_rows, int m_cols,
+ const float* vector,
+ int n_batch, float* result,
+ int result_stride) {
+ float* result_in_batch = result;
+ for (int b = 0; b < n_batch; b++) {
+ const float* matrix_ptr = matrix;
+ for (int r = 0; r < m_rows; r++) {
+ const float* vector_in_batch = vector + b * m_cols;
+ for (int c = 0; c < m_cols; c++) {
+ *result_in_batch += *matrix_ptr++ * *vector_in_batch++;
+ }
+ result_in_batch += result_stride;
+ }
+ }
+}
+
+void PortableVectorVectorCwiseProduct(const float* vector1,
+ const float* vector2, int v_size,
+ float* result) {
+ for (int v = 0; v < v_size; v++) {
+ *result++ = *vector1++ * *vector2++;
+ }
+}
+
+float PortableVectorVectorDotProduct(const float* vector1, const float* vector2,
+ int v_size) {
+ float result = 0.0;
+ for (int v = 0; v < v_size; v++) {
+ result += *vector1++ * *vector2++;
+ }
+ return result;
+}
+
+void PortableBatchVectorBatchVectorDotProduct(const float* vector1,
+ const float* vector2, int v_size,
+ int n_batch, float* result,
+ int result_stride) {
+ float* result_ptr = result;
+ const float* vector1_ptr = vector1;
+ const float* vector2_ptr = vector2;
+ for (int b = 0; b < n_batch; b++) {
+ *result_ptr =
+ PortableVectorVectorDotProduct(vector1_ptr, vector2_ptr, v_size);
+ vector1_ptr += v_size;
+ vector2_ptr += v_size;
+ result_ptr += result_stride;
+ }
+}
+
+void PortableVectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2,
+ int v_size, float* result) {
+ for (int v = 0; v < v_size; v++) {
+ *result++ += *vector1++ * *vector2++;
+ }
+}
+
+void PortableVectorBatchVectorCwiseProductAccumulate(const float* vector,
+ int v_size,
+ const float* batch_vector,
+ int n_batch,
+ float* result) {
+ for (int b = 0; b < n_batch; b++) {
+ for (int v = 0; v < v_size; v++) {
+ *result++ += vector[v] * *batch_vector++;
+ }
+ }
+}
+
+void PortableVectorBatchVectorAssign(const float* vector, int v_size,
+ int n_batch, float* batch_vector) {
+ for (int b = 0; b < n_batch; b++) {
+ memcpy(batch_vector + b * v_size, vector, v_size * sizeof(float));
+ }
+}
+
+void PortableApplySigmoidToVector(const float* vector, int v_size,
+ float* result) {
+ auto sigmoid_func = ActivationFunctor(kActivationSigmoid);
+ for (int v = 0; v < v_size; v++) {
+ *result++ = (sigmoid_func)(*vector++);
+ }
+}
+
+void PortableApplyActivationToVector(const float* vector, int v_size,
+ ActivationFn activation,
+ float* result) {
+ auto activation_func = ActivationFunctor(activation);
+ for (int v = 0; v < v_size; v++) {
+ *result++ = (activation_func)(*vector++);
+ }
+}
+
+void PortableCopyVector(const float* vector, int v_size, float* result) {
+ memcpy(result, vector, v_size * sizeof(float));
+}
+
+void PortableSub1Vector(const float* vector, int v_size, float* result) {
+ for (int v = 0; v < v_size; v++) {
+ *result++ = 1.0f - *vector++;
+ }
+}
+
+void PortableZeroVector(float* vector, int v_size) {
+ memset(vector, 0, v_size * sizeof(float));
+}
+
+void PortableClipVector(const float* vector, int v_size, float abs_limit,
+ float* result) {
+ for (int v = 0; v < v_size; v++) {
+ *result++ = PortableClip(*vector++, abs_limit);
+ }
+}
+
+void PortableVectorShiftLeft(float* vector, int v_size, float shift_value) {
+ nnAssert(v_size > 0);
+ for (int i = 0; i < v_size - 1; i++) {
+ vector[i] = vector[i + 1];
+ }
+ vector[v_size - 1] = shift_value;
+}
+
+void PortableReductionSumVector(const float* input_vector, int input_stride,
+ float* output_vector, int output_size,
+ int reduction_size) {
+ const float* input_vector_ptr = input_vector;
+ for (int o = 0; o < output_size; o++) {
+ for (int r = 0; r < reduction_size; r++) {
+ output_vector[o] += *input_vector_ptr;
+ input_vector_ptr += input_stride;
+ }
+ }
+}
+
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
diff --git a/nn/common/operations/internal/reference/portable_tensor_utils.h b/nn/common/operations/internal/reference/portable_tensor_utils.h
new file mode 100644
index 000000000..138845e78
--- /dev/null
+++ b/nn/common/operations/internal/reference/portable_tensor_utils.h
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_H_
+#define FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_H_
+
+#include "ActivationFunctor.h"
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+// Limit a float input f betweeen +abs_limit and -abs_limit.
+float PortableClip(float f, float abs_limit);
+
+// Multiply a matrix by a batch vector, and store results in a batch-size
+// vector.
+void PortableMatrixBatchVectorMultiplyAccumulate(const float* matrix,
+ int m_rows, int m_cols,
+ const float* vector,
+ int n_batch, float* result,
+ int result_stride);
+
+// Cwise product of two vectors.
+void PortableVectorVectorCwiseProduct(const float* vector1,
+ const float* vector2, int v_size,
+ float* result);
+
+// Cwise product and accumulate of two vectors. Since it's a MAC opertation, the
+// assumption here is that result array is initialized to valid values.
+void PortableVectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2,
+ int v_size, float* result);
+
+// Dot product of two vectors.
+float PortableVectorVectorDotProduct(const float* vector1, const float* vector2,
+ int v_size);
+
+// Dot product of two batch vectors.
+void PortableBatchVectorBatchVectorDotProduct(const float* vector1,
+ const float* vector2, int v_size,
+ int n_batch, float* result,
+ int result_stride);
+
+// Cwise product and accumulate of a vector and a batch-vector. Since it's a MAC
+// operation, the assumption here is that result array is initialized to valid
+// values.
+void PortableVectorBatchVectorCwiseProductAccumulate(const float* vector,
+ int v_size,
+ const float* batch_vector,
+ int n_batch,
+ float* result);
+
+// Batch vector initialization with another vector.
+void PortableVectorBatchVectorAssign(const float* vector, int v_size,
+ int n_batch, float* batch_vector);
+
+// Apply sigmoid to elements of a vector.
+void PortableApplySigmoidToVector(const float* vector, int v_size,
+ float* result);
+
+// Apply activation function to elements of a vector.
+void PortableApplyActivationToVector(const float* vector, int v_size,
+ ActivationFn activation,
+ float* result);
+
+// Copy vector to another vector.
+void PortableCopyVector(const float* vector, int v_size, float* result);
+
+// Compute "1.0f - elements of vector" (used in CIFG).
+void PortableSub1Vector(const float* vector, int v_size, float* result);
+
+// Fill vector with 0.f.
+void PortableZeroVector(float* vector, int v_size);
+
+// Clip elements of a vector using a abs_limit value.
+void PortableClipVector(const float* vector, int v_size, float abs_limit,
+ float* result);
+
+// Shift left a vector in place with v_size size.
+void PortableVectorShiftLeft(float* vector, int v_size, float shift_value);
+
+// Reduce-sum on a float input vector:
+// input_vector: float pointer to input vector.
+// input_stride: input vector stride.
+// output_vector: float pointer to vector.
+// output_size: output vector size.
+// reduction_size: number of consecutive elements from input vector which are
+// added to get one element of output.
+void PortableReductionSumVector(const float* input_vector, int input_stride,
+ float* output_vector, int output_size,
+ int reduction_size);
+
+float Clip(float f, float abs_limit) { return PortableClip(f, abs_limit); }
+
+void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
+ int m_cols, const float* vector,
+ int n_batch, float* result,
+ int result_stride) {
+ PortableMatrixBatchVectorMultiplyAccumulate(matrix, m_rows, m_cols, vector,
+ n_batch, result, result_stride);
+}
+
+void VectorVectorCwiseProduct(const float* vector1, const float* vector2,
+ int v_size, float* result) {
+ PortableVectorVectorCwiseProduct(vector1, vector2, v_size, result);
+}
+
+void VectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2, int v_size,
+ float* result) {
+ PortableVectorVectorCwiseProductAccumulate(vector1, vector2, v_size, result);
+}
+
+void VectorBatchVectorCwiseProductAccumulate(const float* vector, int v_size,
+ const float* batch_vector,
+ int n_batch, float* result) {
+ PortableVectorBatchVectorCwiseProductAccumulate(vector, v_size, batch_vector,
+ n_batch, result);
+}
+
+float VectorVectorDotProduct(const float* vector1, const float* vector2,
+ int v_size) {
+ return PortableVectorVectorDotProduct(vector1, vector2, v_size);
+}
+
+void BatchVectorBatchVectorDotProduct(const float* vector1,
+ const float* vector2, int v_size,
+ int n_batch, float* result,
+ int result_stride) {
+ PortableBatchVectorBatchVectorDotProduct(vector1, vector2, v_size, n_batch,
+ result, result_stride);
+}
+
+void VectorBatchVectorAssign(const float* vector, int v_size, int n_batch,
+ float* batch_vector) {
+ PortableVectorBatchVectorAssign(vector, v_size, n_batch, batch_vector);
+}
+
+void ApplySigmoidToVector(const float* vector, int v_size, float* result) {
+ PortableApplySigmoidToVector(vector, v_size, result);
+}
+
+void ApplyActivationToVector(const float* vector, int v_size,
+ ActivationFn activation, float* result) {
+ PortableApplyActivationToVector(vector, v_size, activation, result);
+}
+
+void CopyVector(const float* vector, int v_size, float* result) {
+ PortableCopyVector(vector, v_size, result);
+}
+
+void Sub1Vector(const float* vector, int v_size, float* result) {
+ PortableSub1Vector(vector, v_size, result);
+}
+
+void ZeroVector(float* vector, int v_size) {
+ PortableZeroVector(vector, v_size);
+}
+
+void ClipVector(const float* vector, int v_size, float abs_limit,
+ float* result) {
+ PortableClipVector(vector, v_size, abs_limit, result);
+}
+
+void VectorShiftLeft(float* vector, int v_size, float shift_value) {
+ PortableVectorShiftLeft(vector, v_size, shift_value);
+}
+
+void ReductionSumVector(const float* input_vector, int input_stride,
+ float* output_vector, int output_size,
+ int reduction_size) {
+ PortableReductionSumVector(input_vector, input_stride, output_vector,
+ output_size, reduction_size);
+}
+
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
+
+#endif // FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_H_
diff --git a/nn/common/operations/internal/tensor_utils.cc b/nn/common/operations/internal/tensor_utils.cc
new file mode 100644
index 000000000..78275bb29
--- /dev/null
+++ b/nn/common/operations/internal/tensor_utils.cc
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tensor_utils.h"
+
+#ifndef USE_NEON
+#if defined(__ARM_NEON__) || defined(__ARM_NEON)
+#define USE_NEON
+#endif // defined(__ARM_NEON__) || defined(__ARM_NEON)
+#endif // USE_NEON
+
+#ifdef USE_NEON
+#include "optimized/neon_tensor_utils.h"
+#else
+#include "reference/portable_tensor_utils.h"
+#endif // USE_NEON
diff --git a/nn/common/operations/internal/tensor_utils.h b/nn/common/operations/internal/tensor_utils.h
new file mode 100644
index 000000000..56167d2b1
--- /dev/null
+++ b/nn/common/operations/internal/tensor_utils.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_TENSOR_UTILS_H_
+#define FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_TENSOR_UTILS_H_
+
+#include "ActivationFunctor.h"
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+// Limit a float input f betweeen +abs_limit and -abs_limit.
+float Clip(float f, float abs_limit);
+
+// Multiply a matrix by a batch vector, and store results in a batch-size
+// vector using a stride value provided in result_stride. 'result_stride' shows
+// how the number of elements between consecutive result values. For example
+// result_stride = 1, will cause the output to look like this:
+// [O_1, 0_2, ... O_rows] in memory, but result_stride = 3, will cause it to be
+// arranged like this in memory: [O_1, x, x, 0_2, x, x, ..., O_rows]
+void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
+ int m_cols, const float* vector,
+ int n_batch, float* result,
+ int result_stride);
+
+// Cwise product of two vectors.
+void VectorVectorCwiseProduct(const float* vector1, const float* vector2,
+ int v_size, float* result);
+
+// Cwise product and accumulate of two vectors. Since it's a MAC opertation, the
+// assumption here is that result array is initialized to valid values.
+void VectorVectorCwiseProductAccumulate(const float* vector1,
+ const float* vector2, int v_size,
+ float* result);
+
+// Dot product of two vectors.
+float VectorVectorDotProduct(const float* vector1, const float* vector2,
+ int v_size);
+
+// Dot product of two batch vectors of size n_batch * v_size:
+// vector1 = [x_1_1, x_1_2, ..., x_1_vsize,
+// x_2_1, x_2_2, ..., x_2_vsize,
+// ...
+// x_nbatch_1,..., x_nbatch_vsize]
+// vector2 = [y_1_1, y_1_2, ..., y_1_vsize,
+// y_2_1, y_2_2, ..., y_2_vsize,
+// ...
+// y_nbatch_1,..., y_nbatch_vsize]
+// Then result will be a vector of n_batch size which will be saved with a
+// stride of result_stride in memory starting from 'result':
+// [x_1_1 * y_1_1 + x_1_2 * y_1_2 + ... + x_1_vsize * y_1_vsize,
+// x_2_1 * y_2_1 + x_2_2 * y_2_2 + ... + x_2_vsize * y_2_vsize,
+// ...
+// x_nbatch_1 * y_nbatch_1 + ... + x_nbatch_vsize * y_nbatch_vsize]
+void BatchVectorBatchVectorDotProduct(const float* vector1,
+ const float* vector2, int v_size,
+ int n_batch, float* result,
+ int result_stride);
+
+// Cwise product and accumulate of a vector and a batch-vector. Since it's a MAC
+// operation, the assumption here is that result array is initialized to valid
+// values.
+void VectorBatchVectorCwiseProductAccumulate(const float* vector, int v_size,
+ const float* batch_vector,
+ int n_batch, float* result);
+
+// Batch vector initialization with another vector.
+void VectorBatchVectorAssign(const float* vector, int v_size, int n_batch,
+ float* batch_vector);
+
+// Apply sigmoid to elements of a vector.
+void ApplySigmoidToVector(const float* vector, int v_size, float* result);
+
+// Apply activation function to elements of a vector.
+void ApplyActivationToVector(const float* vector, int v_size,
+ ActivationFn activation, float* result);
+
+// Copy vector to another vector.
+void CopyVector(const float* vector, int v_size, float* result);
+
+// Compute "1.0f - elements of vector" (used in CIFG).
+void Sub1Vector(const float* vector, int v_size, float* result);
+
+// Fill vector with 0.f.
+void ZeroVector(float* vector, int v_size);
+
+// Clip elements of a vector using a abs_limit value.
+void ClipVector(const float* vector, int v_size, float abs_limit,
+ float* result);
+
+// Shift left a vector in place with v_size size.
+void VectorShiftLeft(float* vector, int v_size, float shift_value);
+
+// Reduce-sum on a float input vector:
+// input_vector: float pointer to input vector.
+// input_stride: input vector stride.
+// output_vector: float pointer to vector.
+// output_size: output vector size.
+// reduction_size: number of consecutive elements from input vector which are
+// added to get one element of output.
+void ReductionSumVector(const float* input_vector, int input_stride,
+ float* output_vector, int output_size,
+ int reduction_size);
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
+
+#endif // FRAMEWORKS_ML_NN_COMMON_OPERATIONS_INTERNAL_TENSOR_UTILS_H_
diff --git a/nn/common/operations/internal/tensor_utils_test.cc b/nn/common/operations/internal/tensor_utils_test.cc
new file mode 100644
index 000000000..ad5204d0c
--- /dev/null
+++ b/nn/common/operations/internal/tensor_utils_test.cc
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gmock/gmock-matchers.h"
+#include "gtest/gtest.h"
+#include "tensor_utils.h"
+
+namespace android {
+namespace nn {
+namespace tensor_utils {
+
+namespace {
+
+using ::testing::FloatNear;
+using ::testing::Matcher;
+
+std::vector<Matcher<float>> ArrayFloatNear(const std::vector<float>& values,
+ float max_abs_error=1.e-6) {
+ std::vector<Matcher<float>> matchers;
+ matchers.reserve(values.size());
+ for (const float& v : values) {
+ matchers.emplace_back(FloatNear(v, max_abs_error));
+ }
+ return matchers;
+}
+
+} // anonymous namespace
+
+TEST(uKernels, ClipTest) {
+ constexpr int kVectorSize = 10;
+ constexpr float kAbsLimit = 2.0;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0,
+ -2.5, 3.0, -3.5, 4.0, -4.5};
+ std::vector<float> output(kVectorSize);
+ ClipVector(input, kVectorSize, kAbsLimit, output.data());
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear(
+ {0.0, -0.5, 1.0, -1.5, 2.0, -2.0, 2.0, -2.0, 2.0, -2.0})));
+}
+
+TEST(uKernels, MatrixBatchVectorMultiplyAccumulateTest) {
+ constexpr int kRow = 3;
+ constexpr int kCol = 4;
+ constexpr int kBatch = 2;
+ static float matrix[kRow * kCol] = {1.0, 2.0, 3.0, 4.0, //
+ -1.0, -2.0, -3.0, -4.0, //
+ 1.0, -2.0, 3.0, -4.0};
+ static float vector[kCol * kBatch] = {1.0, -1.0, 1.0, -1.0, //
+ 2.0, -2.0, 2.0, -2.0};
+ std::vector<float> output(kRow * kBatch);
+ std::fill(output.begin(), output.end(), 3.0);
+ MatrixBatchVectorMultiplyAccumulate(matrix, kRow, kCol, vector, kBatch,
+ output.data(), /*result_stride=*/1);
+ EXPECT_THAT(output, ElementsAreArray(ArrayFloatNear({1., 5., 13., //
+ -1., 7., 23.})));
+}
+
+TEST(uKernels, VectorVectorCwiseProductTest) {
+ constexpr int kVectorSize = 10;
+ static float input1[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0,
+ -2.5, 3.0, -3.5, 4.0, -4.5};
+ static float input2[kVectorSize] = {0.1, -0.1, 0.1, -0.1, 0.1,
+ -0.1, 0.1, -0.1, 0.1, -0.1};
+ std::vector<float> output(kVectorSize);
+ VectorVectorCwiseProduct(input1, input2, kVectorSize, output.data());
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear(
+ {0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45})));
+}
+
+TEST(uKernels, VectorVectorCwiseProductAccumulateTest) {
+ constexpr int kVectorSize = 10;
+ static float input1[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0,
+ -2.5, 3.0, -3.5, 4.0, -4.5};
+ static float input2[kVectorSize] = {0.1, -0.1, 0.1, -0.1, 0.1,
+ -0.1, 0.1, -0.1, 0.1, -0.1};
+ std::vector<float> output(kVectorSize);
+ std::fill(output.begin(), output.end(), 1.0);
+ VectorVectorCwiseProductAccumulate(input1, input2, kVectorSize,
+ output.data());
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear(
+ {1.0, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45})));
+}
+
+TEST(uKernels, VectorBatchVectorAssignTest) {
+ constexpr int kVectorSize = 5;
+ constexpr int kBatchSize = 3;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0};
+ std::vector<float> output(kVectorSize * kBatchSize);
+ VectorBatchVectorAssign(input, kVectorSize, kBatchSize, output.data());
+ EXPECT_THAT(output, ElementsAreArray(ArrayFloatNear(
+ {0.0, -0.5, 1.0, -1.5, 2.0, 0.0, -0.5, 1.0, -1.5, 2.0,
+ 0.0, -0.5, 1.0, -1.5, 2.0})));
+}
+
+TEST(uKernels, ApplySigmoidToVectorTest) {
+ constexpr int kVectorSize = 5;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0};
+ std::vector<float> output(kVectorSize);
+ ApplySigmoidToVector(input, kVectorSize, output.data());
+ EXPECT_THAT(output, ElementsAreArray(ArrayFloatNear(
+ {0.5, 0.377541, 0.731059, 0.182426, 0.880797})));
+}
+
+TEST(uKernels, ApplyActivationToVectorTest) {
+ constexpr int kVectorSize = 5;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0};
+ std::vector<float> output(kVectorSize);
+ ApplyActivationToVector(input, kVectorSize, kActivationRelu, output.data());
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear({0.0, 0.0, 1.0, 0.0, 2.0})));
+
+ ApplyActivationToVector(input, kVectorSize, kActivationTanh, output.data());
+ EXPECT_THAT(output, ElementsAreArray(ArrayFloatNear(
+ {0.0, -0.462117, 0.761594, -0.905148, 0.964028})));
+}
+
+TEST(uKernels, CopyVectorTest) {
+ constexpr int kVectorSize = 5;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0};
+ std::vector<float> output(kVectorSize);
+ CopyVector(input, kVectorSize, output.data());
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear({0.0, -0.5, 1.0, -1.5, 2.0})));
+}
+
+TEST(uKernels, Sub1VectorTest) {
+ constexpr int kVectorSize = 5;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0};
+ std::vector<float> output(kVectorSize);
+ Sub1Vector(input, kVectorSize, output.data());
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear({1.0, 1.5, 0.0, 2.5, -1.0})));
+}
+
+TEST(uKernels, ZeroVectorTest) {
+ constexpr int kVectorSize = 5;
+ std::vector<float> output(kVectorSize);
+ ZeroVector(output.data(), kVectorSize);
+ EXPECT_THAT(output,
+ ElementsAreArray(ArrayFloatNear({0.0, 0.0, 0.0, 0.0, 0.0})));
+}
+
+TEST(uKernels, BatchVectorBatchVectorDotProductTest) {
+ constexpr int kVectorSize = 5;
+ constexpr int kBatch = 2;
+ static float input1[kVectorSize * kBatch] = {0.0, -0.5, 1.0, -1.5, 2.0,
+ -2.5, 3.0, -3.5, 4.0, -4.5};
+ static float input2[kVectorSize * kBatch] = {0.1, -0.1, 0.1, -0.1, 0.1,
+ -0.1, 0.1, -0.1, 0.1, -0.1};
+ std::vector<float> output(kBatch);
+ BatchVectorBatchVectorDotProduct(input1, input2, kVectorSize, kBatch,
+ output.data(), /*result_stride=*/1);
+ EXPECT_THAT(output, ElementsAreArray(ArrayFloatNear({0.5, 1.75})));
+}
+
+TEST(uKernels, VectorShiftLeftTest) {
+ constexpr int kVectorSize = 5;
+ static float input[kVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0};
+ std::vector<float> result(kVectorSize);
+ VectorShiftLeft(input, kVectorSize, 3.0);
+ result.assign(input, input + kVectorSize);
+ EXPECT_THAT(result,
+ ElementsAreArray(ArrayFloatNear({-0.5, 1.0, -1.5, 2.0, 3.0})));
+}
+
+TEST(uKernels, ReductionSumVectorTest) {
+ constexpr int kInputVectorSize = 10;
+ constexpr int kOutputVectorSize = 5;
+ constexpr int kReductionSize = 2;
+ static float input[kInputVectorSize] = {0.0, -0.5, 1.0, -1.5, 2.0,
+ 0.0, -0.5, 1.0, 1.0, 2.0};
+ std::vector<float> result(kOutputVectorSize);
+ ReductionSumVector(input,
+ /*input_stride=*/1, result.data(), kOutputVectorSize,
+ kReductionSize);
+ EXPECT_THAT(result,
+ ElementsAreArray(ArrayFloatNear({-0.5, -0.5, 2.0, 0.5, 3.0})));
+}
+
+} // namespace tensor_utils
+} // namespace nn
+} // namespace android
diff --git a/nn/driver/sample/SampleDriver.cpp b/nn/driver/sample/SampleDriver.cpp
index 902d4e8c0..faeecae07 100644
--- a/nn/driver/sample/SampleDriver.cpp
+++ b/nn/driver/sample/SampleDriver.cpp
@@ -31,7 +31,10 @@ namespace sample_driver {
Return<ErrorStatus> SampleDriver::prepareModel(const Model& model,
const sp<IPreparedModelCallback>& callback) {
- VLOG(DRIVER) << "prepareModel(" << toString(model) << ")"; // TODO errror
+ if (VLOG_IS_ON(DRIVER)) {
+ VLOG(DRIVER) << "prepareModel";
+ logModelToInfo(model);
+ }
if (callback.get() == nullptr) {
LOG(ERROR) << "invalid callback passed to prepareModel";
return ErrorStatus::INVALID_ARGUMENT;
@@ -42,9 +45,12 @@ Return<ErrorStatus> SampleDriver::prepareModel(const Model& model,
}
// TODO: make asynchronous later
- sp<IPreparedModel> preparedModel = new SamplePreparedModel(model);
+ sp<SamplePreparedModel> preparedModel = new SamplePreparedModel(model);
+ if (!preparedModel->initialize()) {
+ callback->notify(ErrorStatus::INVALID_ARGUMENT, nullptr);
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
callback->notify(ErrorStatus::NONE, preparedModel);
-
return ErrorStatus::NONE;
}
@@ -64,27 +70,20 @@ int SampleDriver::run() {
return 1;
}
-static bool mapPools(std::vector<RunTimePoolInfo>* poolInfos, const hidl_vec<hidl_memory>& pools) {
- poolInfos->resize(pools.size());
- for (size_t i = 0; i < pools.size(); i++) {
- auto& poolInfo = (*poolInfos)[i];
- if (!poolInfo.set(pools[i])) {
- return false;
- }
- }
- return true;
+bool SamplePreparedModel::initialize() {
+ return setRunTimePoolInfosFromHidlMemories(&mPoolInfos, mModel.pools);
}
void SamplePreparedModel::asyncExecute(const Request& request,
const sp<IExecutionCallback>& callback) {
- std::vector<RunTimePoolInfo> poolInfo;
- if (!mapPools(&poolInfo, request.pools)) {
+ std::vector<RunTimePoolInfo> requestPoolInfos;
+ if (!setRunTimePoolInfosFromHidlMemories(&requestPoolInfos, request.pools)) {
callback->notify(ErrorStatus::GENERAL_FAILURE);
return;
}
CpuExecutor executor;
- int n = executor.run(mModel, request, poolInfo);
+ int n = executor.run(mModel, request, mPoolInfos, requestPoolInfos);
VLOG(DRIVER) << "executor.run returned " << n;
ErrorStatus executionStatus =
n == ANEURALNETWORKS_NO_ERROR ? ErrorStatus::NONE : ErrorStatus::GENERAL_FAILURE;
diff --git a/nn/driver/sample/SampleDriver.h b/nn/driver/sample/SampleDriver.h
index 51581fed7..7e95c952b 100644
--- a/nn/driver/sample/SampleDriver.h
+++ b/nn/driver/sample/SampleDriver.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_ML_NN_SAMPLE_DRIVER_SAMPLE_DRIVER_H
#define ANDROID_ML_NN_SAMPLE_DRIVER_SAMPLE_DRIVER_H
+#include "CpuExecutor.h"
#include "HalInterfaces.h"
#include "NeuralNetworks.h"
@@ -52,12 +53,15 @@ public:
: // Make a copy of the model, as we need to preserve it.
mModel(model) {}
~SamplePreparedModel() override {}
+ bool initialize();
Return<ErrorStatus> execute(const Request& request,
const sp<IExecutionCallback>& callback) override;
private:
void asyncExecute(const Request& request, const sp<IExecutionCallback>& callback);
+
Model mModel;
+ std::vector<RunTimePoolInfo> mPoolInfos;
};
} // namespace sample_driver
diff --git a/nn/driver/sample/SampleDriverAll.cpp b/nn/driver/sample/SampleDriverAll.cpp
index 3e29481f3..5ddaaec52 100644
--- a/nn/driver/sample/SampleDriverAll.cpp
+++ b/nn/driver/sample/SampleDriverAll.cpp
@@ -37,6 +37,7 @@ public:
};
Return<void> SampleDriverAll::getCapabilities(getCapabilities_cb cb) {
+ android::nn::initVLogMask();
VLOG(DRIVER) << "getCapabilities()";
Capabilities capabilities = {.float32Performance = {.execTime = 1.1f, .powerUsage = 1.1f},
.quantized8Performance = {.execTime = 1.1f, .powerUsage = 1.1f}};
@@ -66,7 +67,6 @@ using android::nn::sample_driver::SampleDriverAll;
using android::sp;
int main() {
- android::nn::initVLogMask();
sp<SampleDriverAll> driver(new SampleDriverAll());
return driver->run();
}
diff --git a/nn/driver/sample/SampleDriverFloatFast.cpp b/nn/driver/sample/SampleDriverFloatFast.cpp
index 4a2b74963..cf416297d 100644
--- a/nn/driver/sample/SampleDriverFloatFast.cpp
+++ b/nn/driver/sample/SampleDriverFloatFast.cpp
@@ -37,6 +37,7 @@ public:
};
Return<void> SampleDriverFloatFast::getCapabilities(getCapabilities_cb cb) {
+ android::nn::initVLogMask();
VLOG(DRIVER) << "getCapabilities()";
Capabilities capabilities = {.float32Performance = {.execTime = 0.8f, .powerUsage = 1.2f},
.quantized8Performance = {.execTime = 1.0f, .powerUsage = 1.0f}};
@@ -73,7 +74,6 @@ using android::nn::sample_driver::SampleDriverFloatFast;
using android::sp;
int main() {
- android::nn::initVLogMask();
sp<SampleDriverFloatFast> driver(new SampleDriverFloatFast());
return driver->run();
}
diff --git a/nn/driver/sample/SampleDriverFloatSlow.cpp b/nn/driver/sample/SampleDriverFloatSlow.cpp
index f472b9b11..87ed39944 100644
--- a/nn/driver/sample/SampleDriverFloatSlow.cpp
+++ b/nn/driver/sample/SampleDriverFloatSlow.cpp
@@ -37,6 +37,7 @@ public:
};
Return<void> SampleDriverFloatSlow::getCapabilities(getCapabilities_cb cb) {
+ android::nn::initVLogMask();
VLOG(DRIVER) << "getCapabilities()";
Capabilities capabilities = {.float32Performance = {.execTime = 1.3f, .powerUsage = 0.7f},
.quantized8Performance = {.execTime = 1.0f, .powerUsage = 1.0f}};
@@ -73,7 +74,6 @@ using android::nn::sample_driver::SampleDriverFloatSlow;
using android::sp;
int main() {
- android::nn::initVLogMask();
sp<SampleDriverFloatSlow> driver(new SampleDriverFloatSlow());
return driver->run();
}
diff --git a/nn/driver/sample/SampleDriverMinimal.cpp b/nn/driver/sample/SampleDriverMinimal.cpp
index 919ac1cd4..0b6500078 100644
--- a/nn/driver/sample/SampleDriverMinimal.cpp
+++ b/nn/driver/sample/SampleDriverMinimal.cpp
@@ -38,6 +38,7 @@ public:
};
Return<void> SampleDriverMinimal::getCapabilities(getCapabilities_cb cb) {
+ android::nn::initVLogMask();
VLOG(DRIVER) << "getCapabilities()";
Capabilities capabilities = {.float32Performance = {.execTime = 0.4f, .powerUsage = 0.5f},
.quantized8Performance = {.execTime = 1.0f, .powerUsage = 1.0f}};
@@ -85,7 +86,6 @@ using android::nn::sample_driver::SampleDriverMinimal;
using android::sp;
int main() {
- android::nn::initVLogMask();
sp<SampleDriverMinimal> driver(new SampleDriverMinimal());
return driver->run();
}
diff --git a/nn/driver/sample/SampleDriverQuant.cpp b/nn/driver/sample/SampleDriverQuant.cpp
index 269541691..25b07d2a5 100644
--- a/nn/driver/sample/SampleDriverQuant.cpp
+++ b/nn/driver/sample/SampleDriverQuant.cpp
@@ -37,6 +37,7 @@ public:
};
Return<void> SampleDriverQuant::getCapabilities(getCapabilities_cb cb) {
+ android::nn::initVLogMask();
VLOG(DRIVER) << "getCapabilities()";
Capabilities capabilities = {.float32Performance = {.execTime = 50.0f, .powerUsage = 1.0f},
.quantized8Performance = {.execTime = 50.0f, .powerUsage = 1.0f}};
@@ -73,7 +74,6 @@ using android::nn::sample_driver::SampleDriverQuant;
using android::sp;
int main() {
- android::nn::initVLogMask();
sp<SampleDriverQuant> driver(new SampleDriverQuant());
return driver->run();
}
diff --git a/nn/runtime/ExecutionBuilder.cpp b/nn/runtime/ExecutionBuilder.cpp
index 56dc723b2..077e068d8 100644
--- a/nn/runtime/ExecutionBuilder.cpp
+++ b/nn/runtime/ExecutionBuilder.cpp
@@ -96,8 +96,7 @@ ExecutionBuilder::ExecutionBuilder(const CompilationBuilder* compilation) :
mModel(compilation->mModel),
mPlan(&compilation->mPlan),
mInputs(mModel->inputCount()),
- mOutputs(mModel->outputCount()),
- mMemories(mModel->getMemories()) {
+ mOutputs(mModel->outputCount()) {
VLOG(EXECUTION) << "ExecutionBuilder::ExecutionBuilder";
}
@@ -600,10 +599,11 @@ int StepExecutor::startComputeOnDevice(sp<ExecutionCallback>* synchronizationCal
}
static void asyncStartComputeOnCpu(const Model& model, const Request& request,
- const std::vector<RunTimePoolInfo>& runTimePoolInfos,
+ const std::vector<RunTimePoolInfo>& modelPoolInfos,
+ const std::vector<RunTimePoolInfo>& requestPoolInfos,
const sp<IExecutionCallback>& executionCallback) {
CpuExecutor executor;
- int err = executor.run(model, request, runTimePoolInfos);
+ int err = executor.run(model, request, modelPoolInfos, requestPoolInfos);
ErrorStatus status = err == ANEURALNETWORKS_NO_ERROR ?
ErrorStatus::NONE : ErrorStatus::GENERAL_FAILURE;
executionCallback->notify(status);
@@ -622,23 +622,30 @@ int StepExecutor::startComputeOnCpu(sp<ExecutionCallback>* synchronizationCallba
sp<ExecutionCallback> executionCallback = new ExecutionCallback();
*synchronizationCallback = nullptr;
- std::vector<RunTimePoolInfo> runTimePoolInfos;
+ std::vector<RunTimePoolInfo> modelPoolInfos;
+ if (!setRunTimePoolInfosFromHidlMemories(&modelPoolInfos, model.pools)) {
+ return ANEURALNETWORKS_UNMAPPABLE;
+ }
+
+ std::vector<RunTimePoolInfo> requestPoolInfos;
uint32_t count = mMemories.size();
- runTimePoolInfos.resize(count);
+ requestPoolInfos.resize(count);
for (uint32_t i = 0; i < count; i++) {
const Memory* mem = mMemories[i];
- runTimePoolInfos[i].set(mem->getHidlMemory());
+ if (!requestPoolInfos[i].set(mem->getHidlMemory())) {
+ return ANEURALNETWORKS_UNMAPPABLE;
+ }
}
// Create as many pools as there are input / output.
- auto fixPointerArguments = [&runTimePoolInfos](std::vector<ModelArgumentInfo>& argumentInfos) {
+ auto fixPointerArguments = [&requestPoolInfos](std::vector<ModelArgumentInfo>& argumentInfos) {
for (ModelArgumentInfo& argumentInfo : argumentInfos) {
if (argumentInfo.state == ModelArgumentInfo::POINTER) {
RunTimePoolInfo runTimeInfo = {
.buffer = static_cast<uint8_t*>(argumentInfo.buffer)};
argumentInfo.locationAndLength.poolIndex =
- static_cast<uint32_t>(runTimePoolInfos.size());
+ static_cast<uint32_t>(requestPoolInfos.size());
argumentInfo.locationAndLength.offset = 0;
- runTimePoolInfos.push_back(runTimeInfo);
+ requestPoolInfos.push_back(runTimeInfo);
}
}
};
@@ -651,7 +658,8 @@ int StepExecutor::startComputeOnCpu(sp<ExecutionCallback>* synchronizationCallba
// TODO: should model be moved with a std::cref?
std::thread thread(asyncStartComputeOnCpu, model, std::move(request),
- std::move(runTimePoolInfos), executionCallback);
+ std::move(modelPoolInfos), std::move(requestPoolInfos),
+ executionCallback);
executionCallback->bind_thread(std::move(thread));
*synchronizationCallback = executionCallback;
diff --git a/nn/runtime/ExecutionPlan.cpp b/nn/runtime/ExecutionPlan.cpp
index d2f74d5cf..009fc3366 100644
--- a/nn/runtime/ExecutionPlan.cpp
+++ b/nn/runtime/ExecutionPlan.cpp
@@ -360,9 +360,11 @@ int ExecutionStep::finishSubModel(const ModelBuilder* fromModel, bool* hasOutput
void ExecutionStep::dump() const {
Model model;
mSubModel->setHidlModel(&model);
- VLOG(COMPILATION) << "ExecutionStep#" << mIndex
- << " for " << (mDevice == nullptr ? "CPU" : mDevice->getName())
- << " submodel: " << toString(model);
+ if (VLOG_IS_ON(COMPILATION)) {
+ VLOG(COMPILATION) << "ExecutionStep#" << mIndex
+ << " for " << (mDevice == nullptr ? "CPU" : mDevice->getName());
+ logModelToInfo(model);
+ }
}
int ExecutionPlan::CompoundBody::finish(const ModelBuilder* fromModel) {
@@ -750,8 +752,8 @@ int ModelBuilder::partitionTheWork(const std::vector<std::shared_ptr<Device>>& d
if (VLOG_IS_ON(COMPILATION)) {
Model model;
setHidlModel(&model);
- VLOG(COMPILATION) << "ModelBuilder::partitionTheWork: original model: "
- << toString(model);
+ VLOG(COMPILATION) << "ModelBuilder::partitionTheWork: original model: ";
+ logModelToInfo(model);
plan->dump();
}
return n;
diff --git a/nn/runtime/Manager.cpp b/nn/runtime/Manager.cpp
index 25ccb21d9..bdf0b1257 100644
--- a/nn/runtime/Manager.cpp
+++ b/nn/runtime/Manager.cpp
@@ -31,7 +31,7 @@ namespace android {
namespace nn {
// TODO: handle errors from initialize correctly
-void Device::initialize() {
+bool Device::initialize() {
#ifdef NN_DEBUGGABLE
static const char samplePrefix[] = "sample";
@@ -39,16 +39,24 @@ void Device::initialize() {
(mName.substr(0, sizeof(samplePrefix) - 1) == samplePrefix)
? getProp("debug.nn.sample.supported") : 0;
#endif // NN_DEBUGGABLE
-
- mInterface->getCapabilities([&](ErrorStatus status, const Capabilities& capabilities) {
+ bool success = false;
+ auto ret = mInterface->getCapabilities([&](ErrorStatus status,
+ const Capabilities& capabilities) {
if (status != ErrorStatus::NONE) {
LOG(ERROR) << "IDevice::getCapabilities returned the error " << toString(status);
+ } else {
+ VLOG(MANAGER) << "Capab " << capabilities.float32Performance.execTime;
+ VLOG(MANAGER) << "Capab " << capabilities.quantized8Performance.execTime;
+ mFloat32Performance = capabilities.float32Performance;
+ mQuantized8Performance = capabilities.quantized8Performance;
+ success = true;
}
- VLOG(MANAGER) << "Capab " << capabilities.float32Performance.execTime;
- VLOG(MANAGER) << "Capab " << capabilities.quantized8Performance.execTime;
- mFloat32Performance = capabilities.float32Performance;
- mQuantized8Performance = capabilities.quantized8Performance;
});
+ if (!ret.isOk()) {
+ LOG(ERROR) << "IDevice::getCapabilities failed for " << getName()
+ << ": " << ret.description();
+ }
+ return success;
}
void Device::getSupportedOperations(const Model& hidlModel,
@@ -139,6 +147,13 @@ void DeviceManager::findAvailableDevices() {
});
}
+void DeviceManager::registerDevice(const char* name, const sp<IDevice>& device) {
+ auto d = std::make_shared<Device>(name, device);
+ if (d->initialize()) {
+ mDevices.push_back(d);
+ }
+}
+
DeviceManager::DeviceManager() {
VLOG(MANAGER) << "DeviceManager::DeviceManager";
findAvailableDevices();
diff --git a/nn/runtime/Manager.h b/nn/runtime/Manager.h
index 721e72fe4..12295528a 100644
--- a/nn/runtime/Manager.h
+++ b/nn/runtime/Manager.h
@@ -34,7 +34,8 @@ public:
Device(const std::string& name, const sp<IDevice>& device) : mName(name), mInterface(device) {}
sp<IDevice> getInterface() { return mInterface; }
const std::string& getName() const { return mName; }
- void initialize();
+ // Returns true if succesfully initialized.
+ bool initialize();
void getSupportedOperations(const Model& hidlModel, hidl_vec<bool>* supportedOperations) const;
@@ -92,11 +93,7 @@ private:
DeviceManager();
// Adds a device for the manager to use.
- void registerDevice(const char* name, const sp<IDevice>& device) {
- auto d = std::make_shared<Device>(name, device);
- mDevices.push_back(d);
- d->initialize();
- }
+ void registerDevice(const char* name, const sp<IDevice>& device);
void findAvailableDevices();
diff --git a/nn/runtime/Memory.cpp b/nn/runtime/Memory.cpp
index 9b05dbf4e..5660e0272 100644
--- a/nn/runtime/Memory.cpp
+++ b/nn/runtime/Memory.cpp
@@ -109,12 +109,14 @@ int MemoryFd::getPointer(uint8_t** buffer) const {
}
uint32_t MemoryTracker::add(const Memory* memory) {
+ VLOG(MODEL) << __func__ << " for " << memory;
// See if we already have this memory. If so,
// return its index.
auto i = mKnown.find(memory);
if (i != mKnown.end()) {
return i->second;
}
+ VLOG(MODEL) << "It's new";
// It's a new one. Save it an assign an index to it.
size_t next = mKnown.size();
if (next > 0xFFFFFFFF) {
diff --git a/nn/runtime/ModelBuilder.cpp b/nn/runtime/ModelBuilder.cpp
index 2274b89c7..f446beeb2 100644
--- a/nn/runtime/ModelBuilder.cpp
+++ b/nn/runtime/ModelBuilder.cpp
@@ -58,6 +58,7 @@ int ModelBuilder::addOperand(const ANeuralNetworksOperandType& type) {
}
int ModelBuilder::setOperandValue(uint32_t index, const void* buffer, size_t length) {
+ VLOG(MODEL) << __func__ << " for operand " << index << " size " << length;
if (index >= operandCount()) {
LOG(ERROR) << "ANeuralNetworksModel_setOperandValue setting operand " << index << " of "
<< operandCount();
@@ -76,25 +77,81 @@ int ModelBuilder::setOperandValue(uint32_t index, const void* buffer, size_t len
.offset = 0,
.length = 0};
} else {
+ if (length > 0xFFFFFFFF) {
+ LOG(ERROR) << "ANeuralNetworksModel_setOperandValue value length of " << length
+ << " exceeds max size";
+ return ANEURALNETWORKS_BAD_DATA;
+ }
+ uint32_t valueLength = static_cast<uint32_t>(length);
uint32_t neededLength = sizeOfData(operand.type, operand.dimensions);
- if (neededLength != length) {
- LOG(ERROR) << "ANeuralNetworksModel_setOperandValue setting " << length
+ if (neededLength != valueLength) {
+ LOG(ERROR) << "ANeuralNetworksModel_setOperandValue setting " << valueLength
<< " bytes when needing " << neededLength;
return ANEURALNETWORKS_BAD_DATA;
}
- uint32_t existingSize = static_cast<uint32_t>(mOperandValues.size());
- uint32_t extraBytes = alignBytesNeeded(existingSize, length);
- mOperandValues.resize(existingSize + extraBytes + length);
- operand.lifetime = OperandLifeTime::CONSTANT_COPY;
- operand.location = {
- .poolIndex = 0, .offset = existingSize + extraBytes, .length = neededLength};
- memcpy(&mOperandValues[operand.location.offset], buffer, length);
+ if (valueLength <= ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES) {
+ uint32_t existingSize = static_cast<uint32_t>(mSmallOperandValues.size());
+ uint32_t extraBytes = alignBytesNeeded(existingSize, valueLength);
+ mSmallOperandValues.resize(existingSize + extraBytes + valueLength);
+ operand.lifetime = OperandLifeTime::CONSTANT_COPY;
+ operand.location = {
+ .poolIndex = 0, .offset = existingSize + extraBytes, .length = neededLength};
+ memcpy(&mSmallOperandValues[operand.location.offset], buffer, valueLength);
+ VLOG(MODEL) << "Copied small value to offset " << operand.location.offset;
+ } else {
+ VLOG(MODEL) << "Saving large value";
+ operand.lifetime = OperandLifeTime::CONSTANT_REFERENCE;
+ // The values for poolIndex and offset will be set when the model is finished.
+ operand.location = {.poolIndex = 0, .offset = 0, .length = valueLength};
+ // We keep track of the buffers. We'll allocate the shared memory only
+ // once we know the total size, to avoid needless copies.
+ mLargeOperandValues.push_back(LargeValue{.operandIndex = index, .buffer = buffer});
+ }
+ }
+ return ANEURALNETWORKS_NO_ERROR;
+}
+
+int ModelBuilder::copyLargeValuesToSharedMemory() {
+ VLOG(MODEL) << __func__ << " has " << mLargeOperandValues.size() << " values.";
+ if (!mLargeOperandValues.empty()) {
+ // Calculate the size of the shared memory needed for all the large values.
+ // Also sets the offset for each value within the memory.
+ size_t poolSize = 0;
+ for (LargeValue& l: mLargeOperandValues) {
+ Operand& operand = mOperands[l.operandIndex];
+ nnAssert(operand.lifetime == OperandLifeTime::CONSTANT_REFERENCE);
+ poolSize += alignBytesNeeded(poolSize, operand.location.length);
+ operand.location.offset = poolSize;
+ poolSize += operand.location.length;
+ }
+
+ // Allocated the shared memory.
+ int n = mLargeValueMemory.create(poolSize);
+ if (n != ANEURALNETWORKS_NO_ERROR) {
+ return n;
+ }
+ uint8_t* memoryPointer = nullptr;
+ n = mLargeValueMemory.getPointer(&memoryPointer);
+ if (n != ANEURALNETWORKS_NO_ERROR) {
+ return n;
+ }
+ uint32_t poolIndex = mMemories.add(&mLargeValueMemory);
+ VLOG(MODEL) << "Allocated large value pool of size " << poolSize << " at index "
+ << poolIndex;
+
+ // Copy the values to this memory.
+ for (LargeValue& l: mLargeOperandValues) {
+ Operand& operand = mOperands[l.operandIndex];
+ operand.location.poolIndex = poolIndex;
+ memcpy(memoryPointer + operand.location.offset, l.buffer, operand.location.length);
+ }
}
return ANEURALNETWORKS_NO_ERROR;
}
int ModelBuilder::setOperandValueFromMemory(uint32_t index, const Memory* memory, uint32_t offset,
size_t length) {
+ VLOG(MODEL) << __func__ << " for operand " << index << " offset " << offset << " size " << length;
if (index >= operandCount()) {
LOG(ERROR) << "ANeuralNetworksModel_setOperandValueFromMemory setting operand " << index
<< " of " << operandCount();
@@ -223,8 +280,14 @@ int ModelBuilder::finish() {
return ANEURALNETWORKS_BAD_STATE;
}
+ int n = copyLargeValuesToSharedMemory();
+ if (n != ANEURALNETWORKS_NO_ERROR) {
+ return n;
+ }
+
// We sort the operations so that they will be in the appropriate
// order for a single-threaded, op at a time execution.
+ // TODO: we don't need this if we always run the partitioner.
sortIntoRunOrder();
mCompletedModel = true;
return ANEURALNETWORKS_NO_ERROR;
@@ -282,7 +345,7 @@ void ModelBuilder::setHidlModel(Model* model) const {
model->operations = mOperations;
model->inputIndexes = mInputIndexes;
model->outputIndexes = mOutputIndexes;
- model->operandValues = mOperandValues;
+ model->operandValues = mSmallOperandValues;
uint32_t count = mMemories.size();
model->pools.resize(count);
diff --git a/nn/runtime/ModelBuilder.h b/nn/runtime/ModelBuilder.h
index edb646614..d5ab078bf 100644
--- a/nn/runtime/ModelBuilder.h
+++ b/nn/runtime/ModelBuilder.h
@@ -78,7 +78,7 @@ public:
const MemoryTracker& getMemories() const { return mMemories; }
const std::vector<Operation>& getOperations() const { return mOperations; }
const uint8_t* getPointerToOperandValue(uint32_t offset) const {
- return mOperandValues.data() + offset;
+ return mSmallOperandValues.data() + offset;
}
int partitionTheWork(const std::vector<std::shared_ptr<Device>>& devices,
@@ -99,12 +99,9 @@ public:
// Sorts the operations to be in the correct order for single threaded
// node-at-a-time execution.
void sortIntoRunOrder();
- /*
- int32_t getOperandIndex(const ArrayInfo& info, uint32_t listIndex) const {
- nnAssert(listIndex < info.count);
- return mOperandIndexes[info.offset + listIndex];
- }
- */
+
+ // Copies the large values to a shared memory, if we have any.
+ int copyLargeValuesToSharedMemory();
// The operations of the graph.
std::vector<Operation> mOperations;
@@ -118,11 +115,18 @@ public:
MemoryTracker mMemories;
- // The value of the operands that are defined at model
+ // The value of the small operands that are defined at model
// creation time.
- // TODO We are copying all the values. Once we support memory
- // pools, revisit.
- std::vector<uint8_t> mOperandValues;
+ std::vector<uint8_t> mSmallOperandValues;
+
+ struct LargeValue {
+ uint32_t operandIndex;
+ const void* buffer;
+ };
+ // Operand index and buffer pointer for all the large operand values of this model.
+ std::vector<LargeValue> mLargeOperandValues;
+ // The shared memory region that will contain the large values.
+ Memory mLargeValueMemory;
// Once the model has been finished, we should not allow further
// modifications to the model.
diff --git a/nn/runtime/NeuralNetworks.cpp b/nn/runtime/NeuralNetworks.cpp
index 979ca7fc1..3766e3b0e 100644
--- a/nn/runtime/NeuralNetworks.cpp
+++ b/nn/runtime/NeuralNetworks.cpp
@@ -36,83 +36,86 @@
// Make sure the constants defined in the header files have not changed values.
// IMPORTANT: When adding new values, update kNumberOfDataTypes or kNumberOfDataTypesOEM
// in Utils.h.
-static_assert(ANEURALNETWORKS_FLOAT32 == 0, "ANEURALNETWORKS_FLOAT32 may have changed");
-static_assert(ANEURALNETWORKS_INT32 == 1, "ANEURALNETWORKS_INT32 may have changed");
-static_assert(ANEURALNETWORKS_UINT32 == 2, "ANEURALNETWORKS_UINT32 may have changed");
+static_assert(ANEURALNETWORKS_FLOAT32 == 0, "ANEURALNETWORKS_FLOAT32 has changed");
+static_assert(ANEURALNETWORKS_INT32 == 1, "ANEURALNETWORKS_INT32 has changed");
+static_assert(ANEURALNETWORKS_UINT32 == 2, "ANEURALNETWORKS_UINT32 has changed");
static_assert(ANEURALNETWORKS_TENSOR_FLOAT32 == 3,
- "ANEURALNETWORKS_TENSOR_FLOAT32 may have changed");
-static_assert(ANEURALNETWORKS_TENSOR_INT32 == 4, "ANEURALNETWORKS_TENSOR_INT32 may have changed");
+ "ANEURALNETWORKS_TENSOR_FLOAT32 has changed");
+static_assert(ANEURALNETWORKS_TENSOR_INT32 == 4, "ANEURALNETWORKS_TENSOR_INT32 has changed");
static_assert(ANEURALNETWORKS_TENSOR_QUANT8_ASYMM == 5,
- "ANEURALNETWORKS_TENSOR_QUANT8_ASYMM may have changed");
-static_assert(ANEURALNETWORKS_OEM_SCALAR == 10000, "ANEURALNETWORKS_OEM_SCALAR may have changed");
+ "ANEURALNETWORKS_TENSOR_QUANT8_ASYMM has changed");
+static_assert(ANEURALNETWORKS_OEM_SCALAR == 10000, "ANEURALNETWORKS_OEM_SCALAR has changed");
static_assert(ANEURALNETWORKS_TENSOR_OEM_BYTE == 10001,
- "ANEURALNETWORKS_TENSOR_OEM_BYTE may have changed");
+ "ANEURALNETWORKS_TENSOR_OEM_BYTE has changed");
// IMPORTANT: When adding new values, update kNumberOfOperationTypes or
// kNumberOfOperationTypesOEMin Utils.h.
-static_assert(ANEURALNETWORKS_ADD == 0, "ANEURALNETWORKS_ADD may have changed");
+static_assert(ANEURALNETWORKS_ADD == 0, "ANEURALNETWORKS_ADD has changed");
static_assert(ANEURALNETWORKS_AVERAGE_POOL_2D == 1,
- "ANEURALNETWORKS_AVERAGE_POOL_2D may have changed");
-static_assert(ANEURALNETWORKS_CONCATENATION == 2, "ANEURALNETWORKS_CONCATENATION may have changed");
-static_assert(ANEURALNETWORKS_CONV_2D == 3, "ANEURALNETWORKS_CONV_2D may have changed");
+ "ANEURALNETWORKS_AVERAGE_POOL_2D has changed");
+static_assert(ANEURALNETWORKS_CONCATENATION == 2, "ANEURALNETWORKS_CONCATENATION has changed");
+static_assert(ANEURALNETWORKS_CONV_2D == 3, "ANEURALNETWORKS_CONV_2D has changed");
static_assert(ANEURALNETWORKS_DEPTHWISE_CONV_2D == 4,
- "ANEURALNETWORKS_DEPTHWISE_CONV_2D may have changed");
+ "ANEURALNETWORKS_DEPTHWISE_CONV_2D has changed");
static_assert(ANEURALNETWORKS_DEPTH_TO_SPACE == 5,
- "ANEURALNETWORKS_DEPTH_TO_SPACE may have changed");
-static_assert(ANEURALNETWORKS_DEQUANTIZE == 6, "ANEURALNETWORKS_DEQUANTIZE may have changed");
+ "ANEURALNETWORKS_DEPTH_TO_SPACE has changed");
+static_assert(ANEURALNETWORKS_DEQUANTIZE == 6, "ANEURALNETWORKS_DEQUANTIZE has changed");
static_assert(ANEURALNETWORKS_EMBEDDING_LOOKUP == 7,
- "ANEURALNETWORKS_EMBEDDING_LOOKUP may have changed");
-static_assert(ANEURALNETWORKS_FLOOR == 8, "ANEURALNETWORKS_FLOOR may have changed");
+ "ANEURALNETWORKS_EMBEDDING_LOOKUP has changed");
+static_assert(ANEURALNETWORKS_FLOOR == 8, "ANEURALNETWORKS_FLOOR has changed");
static_assert(ANEURALNETWORKS_FULLY_CONNECTED == 9,
- "ANEURALNETWORKS_FULLY_CONNECTED may have changed");
+ "ANEURALNETWORKS_FULLY_CONNECTED has changed");
static_assert(ANEURALNETWORKS_HASHTABLE_LOOKUP == 10,
- "ANEURALNETWORKS_HASHTABLE_LOOKUP may have changed");
+ "ANEURALNETWORKS_HASHTABLE_LOOKUP has changed");
static_assert(ANEURALNETWORKS_L2_NORMALIZATION == 11,
- "ANEURALNETWORKS_L2_NORMALIZATION may have changed");
-static_assert(ANEURALNETWORKS_L2_POOL_2D == 12, "ANEURALNETWORKS_L2_POOL may have changed");
+ "ANEURALNETWORKS_L2_NORMALIZATION has changed");
+static_assert(ANEURALNETWORKS_L2_POOL_2D == 12, "ANEURALNETWORKS_L2_POOL has changed");
static_assert(ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION == 13,
- "ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION may have changed");
-static_assert(ANEURALNETWORKS_LOGISTIC == 14, "ANEURALNETWORKS_LOGISTIC may have changed");
+ "ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION has changed");
+static_assert(ANEURALNETWORKS_LOGISTIC == 14, "ANEURALNETWORKS_LOGISTIC has changed");
static_assert(ANEURALNETWORKS_LSH_PROJECTION == 15,
- "ANEURALNETWORKS_LSH_PROJECTION may have changed");
-static_assert(ANEURALNETWORKS_LSTM == 16, "ANEURALNETWORKS_LSTM may have changed");
-static_assert(ANEURALNETWORKS_MAX_POOL_2D == 17, "ANEURALNETWORKS_MAX_POOL may have changed");
-static_assert(ANEURALNETWORKS_MUL == 18, "ANEURALNETWORKS_MUL may have changed");
-static_assert(ANEURALNETWORKS_RELU == 19, "ANEURALNETWORKS_RELU may have changed");
-static_assert(ANEURALNETWORKS_RELU1 == 20, "ANEURALNETWORKS_RELU1 may have changed");
-static_assert(ANEURALNETWORKS_RELU6 == 21, "ANEURALNETWORKS_RELU6 may have changed");
-static_assert(ANEURALNETWORKS_RESHAPE == 22, "ANEURALNETWORKS_RESHAPE may have changed");
+ "ANEURALNETWORKS_LSH_PROJECTION has changed");
+static_assert(ANEURALNETWORKS_LSTM == 16, "ANEURALNETWORKS_LSTM has changed");
+static_assert(ANEURALNETWORKS_MAX_POOL_2D == 17, "ANEURALNETWORKS_MAX_POOL has changed");
+static_assert(ANEURALNETWORKS_MUL == 18, "ANEURALNETWORKS_MUL has changed");
+static_assert(ANEURALNETWORKS_RELU == 19, "ANEURALNETWORKS_RELU has changed");
+static_assert(ANEURALNETWORKS_RELU1 == 20, "ANEURALNETWORKS_RELU1 has changed");
+static_assert(ANEURALNETWORKS_RELU6 == 21, "ANEURALNETWORKS_RELU6 has changed");
+static_assert(ANEURALNETWORKS_RESHAPE == 22, "ANEURALNETWORKS_RESHAPE has changed");
static_assert(ANEURALNETWORKS_RESIZE_BILINEAR == 23,
- "ANEURALNETWORKS_RESIZE_BILINEAR may have changed");
-static_assert(ANEURALNETWORKS_RNN == 24, "ANEURALNETWORKS_RNN may have changed");
-static_assert(ANEURALNETWORKS_SOFTMAX == 25, "ANEURALNETWORKS_SOFTMAX may have changed");
+ "ANEURALNETWORKS_RESIZE_BILINEAR has changed");
+static_assert(ANEURALNETWORKS_RNN == 24, "ANEURALNETWORKS_RNN has changed");
+static_assert(ANEURALNETWORKS_SOFTMAX == 25, "ANEURALNETWORKS_SOFTMAX has changed");
static_assert(ANEURALNETWORKS_SPACE_TO_DEPTH == 26,
- "ANEURALNETWORKS_SPACE_TO_DEPTH may have changed");
-static_assert(ANEURALNETWORKS_SVDF == 27, "ANEURALNETWORKS_SVDF may have changed");
-static_assert(ANEURALNETWORKS_TANH == 28, "ANEURALNETWORKS_TANH may have changed");
+ "ANEURALNETWORKS_SPACE_TO_DEPTH has changed");
+static_assert(ANEURALNETWORKS_SVDF == 27, "ANEURALNETWORKS_SVDF has changed");
+static_assert(ANEURALNETWORKS_TANH == 28, "ANEURALNETWORKS_TANH has changed");
static_assert(ANEURALNETWORKS_OEM_OPERATION == 10000,
- "ANEURALNETWORKS_OEM_OPERATION may have changed");
+ "ANEURALNETWORKS_OEM_OPERATION has changed");
-static_assert(ANEURALNETWORKS_FUSED_NONE == 0, "ANEURALNETWORKS_FUSED_NONE may have changed");
-static_assert(ANEURALNETWORKS_FUSED_RELU == 1, "ANEURALNETWORKS_FUSED_RELU may have changed");
-static_assert(ANEURALNETWORKS_FUSED_RELU1 == 2, "ANEURALNETWORKS_FUSED_RELU1 may have changed");
-static_assert(ANEURALNETWORKS_FUSED_RELU6 == 3, "ANEURALNETWORKS_FUSED_RELU6 may have changed");
+static_assert(ANEURALNETWORKS_FUSED_NONE == 0, "ANEURALNETWORKS_FUSED_NONE has changed");
+static_assert(ANEURALNETWORKS_FUSED_RELU == 1, "ANEURALNETWORKS_FUSED_RELU has changed");
+static_assert(ANEURALNETWORKS_FUSED_RELU1 == 2, "ANEURALNETWORKS_FUSED_RELU1 has changed");
+static_assert(ANEURALNETWORKS_FUSED_RELU6 == 3, "ANEURALNETWORKS_FUSED_RELU6 has changed");
static_assert(ANEURALNETWORKS_PREFER_LOW_POWER == 0,
- "ANEURALNETWORKS_PREFER_LOW_POWER may have changed");
+ "ANEURALNETWORKS_PREFER_LOW_POWER has changed");
static_assert(ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER == 1,
- "ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER may have changed");
+ "ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER has changed");
static_assert(ANEURALNETWORKS_PREFER_SUSTAINED_SPEED == 2,
- "ANEURALNETWORKS_PREFER_SUSTAINED_SPEED may have changed");
+ "ANEURALNETWORKS_PREFER_SUSTAINED_SPEED has changed");
-static_assert(ANEURALNETWORKS_NO_ERROR == 0, "ANEURALNETWORKS_NO_ERROR may have changed");
-static_assert(ANEURALNETWORKS_OUT_OF_MEMORY == 1, "ANEURALNETWORKS_OUT_OF_MEMORY may have changed");
-static_assert(ANEURALNETWORKS_INCOMPLETE == 2, "ANEURALNETWORKS_INCOMPLETE may have changed");
+static_assert(ANEURALNETWORKS_NO_ERROR == 0, "ANEURALNETWORKS_NO_ERROR has changed");
+static_assert(ANEURALNETWORKS_OUT_OF_MEMORY == 1, "ANEURALNETWORKS_OUT_OF_MEMORY has changed");
+static_assert(ANEURALNETWORKS_INCOMPLETE == 2, "ANEURALNETWORKS_INCOMPLETE has changed");
static_assert(ANEURALNETWORKS_UNEXPECTED_NULL == 3,
- "ANEURALNETWORKS_UNEXPECTED_NULL may have changed");
-static_assert(ANEURALNETWORKS_BAD_DATA == 4, "ANEURALNETWORKS_BAD_DATA may have changed");
-static_assert(ANEURALNETWORKS_OP_FAILED == 5, "ANEURALNETWORKS_OP_FAILED may have changed");
-static_assert(ANEURALNETWORKS_BAD_STATE == 6, "ANEURALNETWORKS_BAD_STATE may have changed");
+ "ANEURALNETWORKS_UNEXPECTED_NULL has changed");
+static_assert(ANEURALNETWORKS_BAD_DATA == 4, "ANEURALNETWORKS_BAD_DATA has changed");
+static_assert(ANEURALNETWORKS_OP_FAILED == 5, "ANEURALNETWORKS_OP_FAILED has changed");
+static_assert(ANEURALNETWORKS_BAD_STATE == 6, "ANEURALNETWORKS_BAD_STATE has changed");
+
+static_assert(ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES == 128,
+ "ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES has changed");
// Make sure that the constants are compatible with the values defined in
// hardware/interfaces/neuralnetworks/1.0/types.hal.
diff --git a/nn/runtime/include/NeuralNetworks.h b/nn/runtime/include/NeuralNetworks.h
index 763f81820..beaf6befc 100644
--- a/nn/runtime/include/NeuralNetworks.h
+++ b/nn/runtime/include/NeuralNetworks.h
@@ -143,7 +143,8 @@ typedef enum {
* * {@link ANEURALNETWORKS_TENSOR_FLOAT32}
* * {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM}
*
- * Supported tensor rank: 4, with "NHWC" data layout.
+ * Supported tensor rank: 4, with "NHWC" (i.e., Num_samples, Height, Width, and Channels)
+ * data layout.
*
* Both explicit padding and implicit padding are supported.
*
@@ -153,8 +154,10 @@ typedef enum {
* * 2: An INT32 value, specifying the padding on the right,in the ‘width’ dimension.
* * 3: An INT32 value, specifying the padding on the top, in the ‘height’ dimension.
* * 4: An INT32 value, specifying the padding on the bottom, in the ‘height’ dimension.
- * * 5: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 6: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 5: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 6: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 7: An INT32 value, specifying the filter width.
* * 8: An INT32 value, specifying the filter height.
* * 9: An INT32 value, and has to be one of the {@link FuseCode} values.
@@ -164,8 +167,10 @@ typedef enum {
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying the input.
* * 1: An INT32 value, specifying the implicit padding scheme, has to be one of the
* {@link PaddingCode} values.
- * * 2: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 3: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 2: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 3: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 4: An INT32 value, specifying the filter width.
* * 5: An INT32 value, specifying the filter height.
* * 6: An INT32 value, and has to be one of the {@link FuseCode} values.
@@ -189,7 +194,7 @@ typedef enum {
*
* Inputs:
* * 0 ~ n-1: The list of n input tensors, of shape [D0, D1, ..., Daxis(i), ..., Dm].
- * For the inputs of {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} type, all
+ * For inputs of {@link ANEURALNETWORKS_TENSOR_QUANT8_ASYMM} type, all
* input tensors must have the same scale and zeroPoint.
* * n: An INT32 value, specifying the concatenation axis.
*
@@ -237,8 +242,10 @@ typedef enum {
* * 4: An INT32 value, specifying the padding on the right,in the ‘width’ dimension.
* * 5: An INT32 value, specifying the padding on the top, in the ‘height’ dimension.
* * 6: An INT32 value, specifying the padding on the bottom, in the ‘height’ dimension.
- * * 7: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 8: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 7: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 8: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 9: An INT32 value, and has to be one of the {@link FuseCode} values.
* Specifies the activation to invoke on the result of each addition.
*
@@ -254,8 +261,10 @@ typedef enum {
* bias_scale == input_scale * filter_scale.
* * 3: An INT32 value, specifying the implicit padding scheme, has to be one of the
* {@link PaddingCode} values.
- * * 4: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 5: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 4: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 5: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 6: An INT32 value, and has to be one of the {@link FuseCode} values.
* Specifies the activation to invoke on the result of each addition.
*
@@ -307,8 +316,10 @@ typedef enum {
* * 4: An INT32 value, specifying the padding on the right,in the ‘width’ dimension.
* * 5: An INT32 value, specifying the padding on the top, in the ‘height’ dimension.
* * 6: An INT32 value, specifying the padding on the bottom, in the ‘height’ dimension.
- * * 7: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 8: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 7: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 8: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 9: An INT32 value, specifying the depthwise multiplier.
* * 10: An INT32 value, and has to be one of the {@link FuseCode} values.
* Specifies the activation to invoke on the result of each addition.
@@ -325,8 +336,10 @@ typedef enum {
* bias_scale == input_scale * filter_scale.
* * 3: An INT32 value, specifying the implicit padding scheme, has to be one of the
* {@link PaddingCode} values.
- * * 4: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 5: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 4: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 5: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 6: An INT32 value, specifying the depthwise multiplier.
* * 7: An INT32 value, and has to be one of the {@link FuseCode} values.
* Specifies the activation to invoke on the result of each addition.
@@ -388,25 +401,35 @@ typedef enum {
*/
ANEURALNETWORKS_DEQUANTIZE = 6,
- /**
- * Looks up items from a given tensor.
+ /** Looks up sub-tensors in the input tensor.
+ *
+ * This operator takes for input a tensor of values (Values) and
+ * a one-dimensional tensor of selection indices (Lookups).
+ * The output tensor is the concatenation of sub-tensors of Values as
+ * selected by Lookups.
+ *
+ * Think of Values as being sliced along its first dimension:
+ * The entries in Lookups select which slices are concatenated together
+ * to create the output tensor.
*
- * Each item in the output is a raw copy of the corresponding item in
- * the input “values”. If the given “lookup” indices are out of bounds,
- * the op will fail and an error will be reported.
+ * For example, if Values has shape of [40, 200, 300] and
+ * Lookups has shape of [3], we would expect all three values
+ * found in Lookups to be between 0 and 39. The resulting tensor will
+ * have shape of [3, 200, 300].
+ *
+ * If a value in Lookups is out of bounds, the operation will fail
+ * and an error will be reported.
*
* Inputs:
- * * 0: Values. An n-D tensor of any type X (where n >= 2). E.g., if n is 2,
- * then the shape would be [lookup_dimension, values_dimension], where
- * “lookup_dimension” corresponds to the indexing dimension in the lookup
- * table, and “values_dimension” to the contents.
- * * 1: Lookups. An 1-D tensor of type T, of shape [lookup_size], where
- * “lookup_size” is the number of elements to look for, and each entry
- * corresponds to the first dimension of the “values” tensor.
+ * * 0: Lookups. A 1-D tensor of {@link ANEURALNETWORKS_TENSOR_INT32} type.
+ * The values are indices into the first dimension of Values.
+ * * 1: Values. An n-D tensor, where n >= 2, from which sub-tensors are
+ * extracted.
*
* Output:
- * * 0: A n-D tensor of type X and the same rank and shape as the “values”
- * tensor, except for the first dimension which has size “lookup_size”.
+ * * 0: A n-D tensor with the same rank and shape as the Values
+ * tensor, except for the first dimension which has the same size
+ * as Lookups' only dimension.
*/
ANEURALNETWORKS_EMBEDDING_LOOKUP = 7,
@@ -421,7 +444,7 @@ typedef enum {
* * 0: A tensor.
*
* Outputs:
- * * 0: The output, a tensor of the same type and dimensions as input0.
+ * * 0: The output tensor, of the same type and dimensions as the input tensor.
*/
ANEURALNETWORKS_FLOOR = 8,
@@ -461,14 +484,40 @@ typedef enum {
*/
ANEURALNETWORKS_FULLY_CONNECTED = 9,
- /**
- * Looks up values of a hash table with given keys.
+ /** Looks up sub-tensors in the input tensor using a key-value map.
+ *
+ * This operator takes for input a tensor of values (Values),
+ * a one-dimensional tensor of selection values (Lookups) and
+ * a one-dimensional tensor that maps these values to Values
+ * indexes. The output tensor is the concatenation of sub-tensors of
+ * Values as selected by Lookups via Keys.
+ *
+ * Think of Values as being sliced along its outer-most dimension.
+ * The output is a concatenation of selected slices, with one slice
+ * for each entry of Lookups. The slice selected is the one at the
+ * same index as the Maps entry that matches the value in Lookups.
+ *
+ * For a hit, the corresponding sub-tensor of Values is included
+ * in the Output tensor. For a miss, the corresponding sub-tensor in
+ * Output will have zero values.
+ *
+ * For example, if Values has shape of [40, 200, 300],
+ * Keys should have a shape of [40]. If Lookups tensor has shape
+ * of [3], we're concatenating three slices, so the resulting tensor
+ * will have the shape of [3, 200, 300]. If the first entry in
+ * Lookups has the value 123456, we'll look for that value in Keys tensor.
+ * If the sixth entry of Keys contains 123456, we'll select the sixth
+ * slice of Values. If no entry in Keys has 123456, a slice of zeroes
+ * will be concatenated.
*
* Inputs:
- * * 0: Lookups. A 1-D int32 tensor with shape [ k ].
- * * 1: Keys. A 1-D int32 tensor with shape [ n ], *MUST* be sorted in
- * ascending order.
- * * 2: Values. A tensor with shape [ n … ].
+ * * 0: Lookups. A 1-D {@link ANEURALNETWORKS_TENSOR_INT32} tensor with shape [ k ].
+ * * 1: Keys. A 1-D {@link ANEURALNETWORKS_TENSOR_INT32} tensor with shape [ n ];
+ * Keys and Values pair represent a map, i.e., the ith element
+ * in Keys (Keys[i]) is the key to select the ith sub-tensor
+ * in Values (Values[i]), where 0 <= i <= n-1.
+ * Keys tensor *MUST* be sorted in ascending order.
+ * * 2: Values. A tensor with shape of [ n, … ]; i.e., the first dimension must be n.
*
* Outputs:
* * 0: Output. A tensor with shape [ k …].
@@ -487,15 +536,15 @@ typedef enum {
* input[batch, row, col, channel] /
* sqrt(sum_{c} pow(input[batch, row, col, c], 2))
*
- * For x with more dimensions, independently normalizes each 1-D slice along dimension dim.
+ * For input tensor with more dimensions, independently normalizes each 1-D slice along dimension dim.
*
* Supported tensor types:
* * {@link ANEURALNETWORKS_TENSOR_FLOAT32}
*
- * Supported tensor rank: 4, with "NHWC" data layout.
+ * Supported tensor rank: 4, with "NHWC" data layout (i.e., Num_samples, Height, Width, and Channels).
*
* Inputs:
- * * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying the input.
+ * * 0: A 4-D tensor, of shape [batches, height, width, depth].
*
* Outputs:
* * 0: The output 4-D tensor, of shape [batches, out_height, out_width, depth].
@@ -524,8 +573,10 @@ typedef enum {
* * 2: An INT32 value, specifying the padding on the right,in the ‘width’ dimension.
* * 3: An INT32 value, specifying the padding on the top, in the ‘height’ dimension.
* * 4: An INT32 value, specifying the padding on the bottom, in the ‘height’ dimension.
- * * 5: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 6: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 5: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 6: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 7: An INT32 value, specifying the filter width.
* * 8: An INT32 value, specifying the filter height.
* * 9: An INT32 value, and has to be one of the {@link FuseCode} values.
@@ -535,8 +586,10 @@ typedef enum {
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying the input.
* * 1: An INT32 value, specifying the implicit padding scheme, has to be one of the
* {@link PaddingCode} values.
- * * 2: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 3: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 2: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 3: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 4: An INT32 value, specifying the filter width.
* * 5: An INT32 value, specifying the filter height.
* * 6: An INT32 value, and has to be one of the {@link FuseCode} values.
@@ -658,7 +711,7 @@ typedef enum {
* * If no projection layer: “projection_weights” and “projection_bias”.
* * If no projection bias: “projection_bias”.
*
- * Supported tensor types:
+ * Supported tensor types (type T):
* * {@link ANEURALNETWORKS_TENSOR_FLOAT32}
*
* Inputs:
@@ -708,10 +761,8 @@ typedef enum {
* A 2-D tensor of type T, of shape [batch_size, output_size].
* * 19: cell_state (in).
* A 2-D tensor of type T, of shape [batch_size, num_units].
- *
- * Parameters:
* * 20:fused_activation_function.
- * An (optional) ActivationFunctionType indicating the activation
+ * An optional {@link FuseCode} value indicating the activation
* function.
* If “NONE” is specified then it results in a linear activation.
* * 21:cell_clip.
@@ -759,8 +810,10 @@ typedef enum {
* * 2: An INT32 value, specifying the padding on the right,in the ‘width’ dimension.
* * 3: An INT32 value, specifying the padding on the top, in the ‘height’ dimension.
* * 4: An INT32 value, specifying the padding on the bottom, in the ‘height’ dimension.
- * * 5: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 6: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 5: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 6: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 7: An INT32 value, specifying the filter width.
* * 8: An INT32 value, specifying the filter height.
* * 9: An INT32 value, and has to be one of the {@link FuseCode} values.
@@ -770,8 +823,10 @@ typedef enum {
* * 0: A 4-D tensor, of shape [batches, height, width, depth], specifying the input.
* * 1: An INT32 value, specifying the implicit padding scheme, has to be one of the
* {@link PaddingCode} values.
- * * 2: An INT32 value, specifying the output stride in the ‘width’ dimension.
- * * 3: An INT32 value, specifying the output stride in the ‘height’ dimension.
+ * * 2: An INT32 value, specifying the stride when walking through input
+ * in the ‘width’ dimension.
+ * * 3: An INT32 value, specifying the stride when walking through input
+ * in the ‘height’ dimension.
* * 4: An INT32 value, specifying the filter width.
* * 5: An INT32 value, specifying the filter height.
* * 6: An INT32 value, and has to be one of the {@link FuseCode} values.
@@ -930,7 +985,7 @@ typedef enum {
* * “activation” is the function passed as the “fused_activation_function”
* argument (if not “NONE”).
*
- * Supported tensor types:
+ * Supported tensor types (Type T):
* * {@link ANEURALNETWORKS_TENSOR_FLOAT32}
*
* Inputs:
@@ -946,21 +1001,15 @@ typedef enum {
* corresponding to the weights from each unit.
* * 3: bias.
* A 1-D tensor of type T, of shape [num_units].
- *
- * For FLOAT32 input tensor, bias must also be FLOAT32.
- * For UINT8 input tensor, bias must be INT32.
- *
- * * 4: Hidden state (in).
+ * * 4: hidden state (in).
* A 2-D tensor of type T, of shape [batch_size, num_units].
- *
- * Parameters
* * 5: fused_activation_function.
- * An (optional) ActivationFunctionType indicating the activation
+ * An optional {@link FuseCode} value indicating the activation
* function. If “NONE” is specified then it results in a linear
* activation.
*
* Outputs:
- * * 0: Hidden state (out).
+ * * 0: hidden state (out).
* A 2-D tensor of type T, of shape [batch_size, num_units].
*
* * 1: output.
@@ -1044,7 +1093,8 @@ typedef enum {
*
* Specifically, for rank 1, this layer implements the operation:
*
- * memory = push(conv1d(inputs, weights_feature, feature_dim, "VALID"));
+ * memory = push(conv1d(inputs, weights_feature, feature_dim,
+ * "ANEURALNETWORKS_PADDING_VALID"));
* outputs = activation(memory * weights_time + bias);
*
* Where:
@@ -1062,7 +1112,7 @@ typedef enum {
* Each rank adds a dimension to the weights matrices by means of stacking
* the filters.
*
- * Supported tensor types:
+ * Supported tensor types (type T):
* * {@link ANEURALNETWORKS_TENSOR_FLOAT32}
*
* Inputs:
@@ -1077,19 +1127,13 @@ typedef enum {
* A 2-D tensor of type T, of shape [num_units, memory_size], where
* “memory_size” corresponds to the fixed-size of the memory.
* * 3: bias.
- * A optional 1-D tensor of type T, of shape [num_units].
- *
- * For FLOAT32 input tensor, bias must also be FLOAT32.
- * For UINT8 input tensor, bias must be INT32.
- *
+ * An optional 1-D tensor of type T, of shape [num_units].
* * 4: state (in).
* A 2-D tensor of type T, of shape [batch_size, (memory_size - 1) * num_units * rank].
- *
- * Parameters:
* * 5: rank.
* The rank of the SVD approximation.
* * 6: fused_activation_function.
- * An (optional) ActivationFunctionType indicating the activation function.
+ * An optional {@link FuseCode} value indicating the activation function.
* If “NONE” is specified then it results in a linear activation.
*
* Outputs:
@@ -1140,9 +1184,30 @@ typedef enum {
*
*/
typedef enum {
- /** SAME padding. */
+ /**
+ * SAME padding.
+ * Padding on both ends are the "same":
+ * padding_to_beginning = total_padding / 2
+ * padding_to_end = (total_padding + 1)/2.
+ * i.e., for even number of padding, padding to both ends are exactly
+ * the same; for odd number of padding, padding to the ending is bigger
+ * than the padding to the beginning by 1.
+ *
+ * total_padding is a function of input, stride and filter size.
+ * It could be computed as follows:
+ * out_size = (input + stride - 1) / stride;
+ * needed_input = (out_size - 1) * stride + filter_size
+ * total_padding = max(0, needed_input - output_size)
+ * The computation is the same for the horizontal and vertical directions.
+ */
ANEURALNETWORKS_PADDING_SAME = 1,
- /** VALID padding. */
+
+ /**
+ * VALID padding.
+ * No padding. When the input size is not evenly divisible by
+ * the filter size, the input at the end that could not fill
+ * the whole filter tile will simply be ignored.
+ */
ANEURALNETWORKS_PADDING_VALID = 2,
} PaddingCode;
@@ -1182,6 +1247,15 @@ typedef enum {
} ResultCode;
/**
+ * For {@link ANeuralNetworksModel_setOperandValue}, values with a
+ * length smaller or equal to this will be immediately copied into
+ * the model. The size is in bytes.
+ */
+enum {
+ ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES = 128
+};
+
+/**
* ANeuralNetworksMemory is an opaque type that represents memory.
*
* This type is used to represent shared memory, memory mapped files,
@@ -1445,13 +1519,18 @@ int ANeuralNetworksModel_addOperand(ANeuralNetworksModel* model,
/**
* Sets an operand to a constant value.
*
- * For scalar values, the content of buffer is copied into the model.
+ * Values of length smaller or equal to
+ * {@link ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES}
+ * are immediately copied into the model.
+ *
+ * For values of length greater than {@link ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES},
+ * a pointer to the buffer is stored within the model. The application is responsible
+ * for not changing the content of this region until all executions using this model
+ * have completed. As the data may be copied during processing, modifying the data
+ * after this call yields undefined results.
*
- * For tensor values, a pointer to the buffer is stored within the model.
- * The application is responsible for not changing the content of this region
- * until all executions using this model have completed. As the data may
- * be copied during processing, modifying the data after this call yields
- * undefined results.
+ * For large tensors, using {@link ANeuralNetworksModel_setOperandValueFromMemory}
+ * is likely to be more efficient.
*
* To indicate that an optional operand should be considered missing,
* pass nullptr for buffer and 0 for length.
diff --git a/nn/runtime/test/Android.bp b/nn/runtime/test/Android.bp
index 93962e193..55d5e9a83 100644
--- a/nn/runtime/test/Android.bp
+++ b/nn/runtime/test/Android.bp
@@ -24,6 +24,7 @@ cc_defaults {
"TestTrivialModel.cpp",
"TestValidation.cpp",
"TestGenerated.cpp",
+ "TestPartitioning.cpp",
],
shared_libs: [
"libandroid",
diff --git a/nn/runtime/test/TestMemory.cpp b/nn/runtime/test/TestMemory.cpp
index 74931cacf..6428b2767 100644
--- a/nn/runtime/test/TestMemory.cpp
+++ b/nn/runtime/test/TestMemory.cpp
@@ -134,6 +134,9 @@ TEST_F(MemoryTest, TestASharedMemory) {
Result::NO_ERROR);
ASSERT_EQ(execution2.compute(), Result::NO_ERROR);
ASSERT_EQ(CompareMatrices(expected3, *reinterpret_cast<Matrix3x4*>(outputData + offsetForActual)), 0);
+ close(weightsFd);
+ close(inputFd);
+ close(outputFd);
}
TEST_F(MemoryTest, TestFd) {
diff --git a/nn/runtime/test/TestPartitioning.cpp b/nn/runtime/test/TestPartitioning.cpp
new file mode 100644
index 000000000..cb193906b
--- /dev/null
+++ b/nn/runtime/test/TestPartitioning.cpp
@@ -0,0 +1,836 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ExecutionPlan.h"
+#include "HalInterfaces.h"
+#include "Manager.h"
+#include "ModelBuilder.h"
+#include "NeuralNetworks.h"
+#include "NeuralNetworksWrapper.h"
+#include "Utils.h"
+
+#include <gtest/gtest.h>
+
+#include <map>
+#include <queue>
+
+// Uncomment the following line to generate some debugging output that
+// may be useful when analyzing failures:
+//
+// #define VERBOSE VERBOSE
+
+// These tests do whitebox testing of the graph partitioning
+// algorithm. It is "whitebox" in the sense that we're not evaluating
+// whether a particular partitioning is legal, or "good enough"
+// according to some metric, but whether it exactly matches the
+// expected behavior of the current partitioning algorithm.
+//
+// A key part of the current partitioning algorithm is to determine
+// which device among the available devices should be the one to
+// execute a particular operation from the graph. This determination
+// is made "locally" -- i.e., it does not depend on the graph
+// topology, only on the properties of the operation in question.
+// IDevice::getSupportedOperations() indicates which operations in a
+// graph can be executed on a device, and IDevice::getCapabilities()
+// indicates how "good" that device is for executing particular kinds
+// of operations. For each operation, the partitioning algorithm
+// picks the "best" device that is capable of executing that
+// operation; if no device can do so, then the algorithm picks the
+// cpu.
+//
+// As part of this testing approach, we want to make it easy to
+// specify which operations in a test graph can be executed on which
+// devices. We accomplish this with an abstraction: There are eight
+// different kinds of operations (each of which has two inputs and one
+// output), and when we instantiate a device for testing purposes, we
+// specify what subset of those eight kinds of operations the device
+// is able to execute.
+//
+// The eight kinds of operations are represented in the graph as ADD
+// or MUL with a particular activation function -- two opcodes times
+// four activation functions means eight available operation kinds.
+// This is a low-level representation detail -- when we specify the
+// behavior of the device or build a graph, we do so in terms of
+// operation encodings 0..7.
+//
+// In order to determine whether or not a partitioning matches the
+// expected partitioning, we check the number of partitions, check
+// which device each partition targets, and compare each partition's
+// subgraph, model inputs, model outputs, submodel inputs, and
+// submodel outputs against what is expected. In order to perform
+// that comparison, we build a model to compare against a partition's
+// submodel and run a graph comparison algorithm on it. The graph
+// comparison and the inputs and outputs comparisons are syntactic
+// rather than semantic comparisons -- they don't allow for
+// reorderings of inputs and outputs. Because of this, we need to
+// know exactly how the partitioning algorithm orders inputs and
+// outputs in order to construct the models and operand lists to
+// compare against. Here are some relevant behaviors of the
+// partitioning algorithm:
+//
+// - It builds a subgraph by walking operations in forward topological
+// order, and adding each operation's input operands and output
+// operands in index order (input followed by output) when that
+// operation is added. (It does not add an input that has already
+// been added.)
+// - It finds model inputs, model outputs, and submodel inputs in
+// the order the corresponding operands were added to the subgraph
+// (see ExecutionStep methods getModelInputs(), getModelOutputs(),
+// getSubModelInputs()).
+// - It finds submodel outputs in numerical order of corresponding
+// operand number in the original model (see ExecutionStep method
+// getSubModelOutputs()).
+// - When it calls identifyInputsAndOutputs() on the submodel, it
+// passes inputs from getModelInputs() in order followed by submodel
+// inputs from getSubModelInputs() in order; and it passes outputs
+// from getModelOutputs() in order followed by submodel outputs from
+// getSubModelOutputs() in order.
+//
+// TODO: Maybe the logic for comparing a partition to an expected
+// model should be changed to tolerate reorderings of inputs and
+// outputs, so that when we build models and lists to compare
+// against, we don't need to worry about input and output
+// orderings. But is there a way to do this that still lets us
+// verify that we have the correct relationships between
+// an (original) model's inputs and outputs and each submodel's
+// inputs and outputs, as well as the correct relationship
+// between submodel inputs and outputs across partitions?
+
+namespace {
+
+using Device = ::android::nn::Device;
+using ExecutePreference = ::android::nn::wrapper::ExecutePreference;
+using ExecutionPlan = ::android::nn::ExecutionPlan;
+using ExecutionStep = ::android::nn::ExecutionStep;
+using HidlModel = ::android::hardware::neuralnetworks::V1_0::Model;
+using ModelBuilder = ::android::nn::ModelBuilder;
+using WrapperModel = ::android::nn::wrapper::Model;
+using WrapperOperandType = ::android::nn::wrapper::OperandType;
+using WrapperType = ::android::nn::wrapper::Type;
+
+template <typename T> using sp = ::android::sp<T>;
+
+// We employ an operation numbering scheme:
+// - 0..FuseCode-1 = ADD with the appropriate activation function
+// - FuseCode..2*FuseCode-1 = MUL with the appropriate activation function
+const uint32_t kNumFuseCodes = 4;
+const uint32_t kBadOperation = ~0;
+
+// Look up the operation with the specified index in a graph, and
+// return the operation encoding -- 0..7; or, if for some reason this
+// is not one of the encoded operations, then return kBadOperation.
+uint32_t lookupOperation(std::function<const Operation&(uint32_t)> getOperation,
+ std::function<const Operand&(uint32_t)> getOperand,
+ std::function<const uint8_t*(uint32_t)> getValue,
+ uint32_t operationIndex) {
+ const Operation& operation = getOperation(operationIndex);
+ switch (operation.type) {
+ case OperationType::ADD:
+ case OperationType::MUL: {
+ // input2 is the fused activation function
+ const Operand& input2 = getOperand(operation.inputs[2]);
+ if ((input2.type == OperandType::INT32) &&
+ (input2.lifetime == OperandLifeTime::CONSTANT_COPY)) {
+ int32_t value;
+ memcpy(&value,
+ getValue(input2.location.offset),
+ input2.location.length);
+ if (operation.type == OperationType::MUL) {
+ value += kNumFuseCodes;
+ }
+ return value;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return kBadOperation;
+}
+
+uint32_t lookupOperation(const HidlModel& model, uint32_t operationIndex) {
+ return lookupOperation(
+ [&model](uint32_t index) -> const Operation& {
+ return model.operations[index];
+ },
+ [&model](uint32_t index) -> const Operand& {
+ return model.operands[index];
+ },
+ [&model](uint32_t offset) {return &model.operandValues[offset];},
+ operationIndex);
+}
+
+#ifdef VERBOSE
+// This is a debugging utility function
+void dump(const char* name, const ModelBuilder* model) {
+ HidlModel hidlModel;
+ model->setHidlModel(&hidlModel);
+ std::cout << name << ": " << toString(hidlModel) << std::endl;
+ std::cout << "inputs: " << toString(hidlModel.inputIndexes) << std::endl;
+ std::cout << "outputs: " << toString(hidlModel.outputIndexes) << std::endl;
+ for (size_t i = 0, e = hidlModel.operations.size(); i < e; i++) {
+ std::cout << "operation[" << i << "]: " << toString(hidlModel.operations[i]) << std::endl;
+ }
+}
+#endif
+
+// This is an IDevice for testing purposes. It only has two
+// interesting properties, both of which are specified as constructor
+// arguments: device capabilities, and which subset of operation kinds
+// (0..7) does the device support. The subset is represented with a
+// bitmask, in which operation kind K corresponds to the bit (1 << K).
+class PartitioningIDevice : public IDevice {
+public:
+ PartitioningIDevice(Capabilities capabilities, uint32_t operationMask) :
+ mCapabilities(capabilities), mOperationMask(operationMask) {}
+ ~PartitioningIDevice() override {}
+
+ Return<ErrorStatus> prepareModel(const HidlModel&,
+ const sp<IPreparedModelCallback>& cb) override {
+ cb->notify(ErrorStatus::NONE, nullptr);
+ return ErrorStatus::NONE;
+ }
+ Return<DeviceStatus> getStatus() override {
+ return DeviceStatus::AVAILABLE;
+ }
+
+ Return<void> getCapabilities(getCapabilities_cb cb) override {
+ cb(ErrorStatus::NONE, mCapabilities);
+ return Void();
+ }
+ Return<void> getSupportedOperations(const HidlModel& model,
+ getSupportedOperations_cb cb) override {
+ if (!android::nn::validateModel(model)) {
+ cb(ErrorStatus::INVALID_ARGUMENT, std::vector<bool>());
+ return Void();
+ }
+
+ const size_t count = model.operations.size();
+ std::vector<bool> supported(count);
+ for (size_t i = 0; i < count; i++) {
+ supported[i] = false;
+ uint32_t operation = lookupOperation(model, i);
+ if ((operation != kBadOperation) && (mOperationMask & (1 << operation))) {
+ supported[i] = true;
+ }
+ }
+ cb(ErrorStatus::NONE, supported);
+ return Void();
+ }
+private:
+ Capabilities mCapabilities;
+ uint32_t mOperationMask;
+};
+
+// This class adds some simple abstractions and utilities on top of
+// ::android::nn::wrapper::Model. For example, it provides methods
+// that work in terms of operation kind (0..7); and because we care
+// about graph topology rather than details of operand types and
+// values, it greatly simplifies the process of creating operands.
+class PartitioningModel : public WrapperModel {
+public:
+ // Create a tensor operand of the specified type, and return the
+ // corresponding operand index.
+ uint32_t addFloatOperand() {
+ static const WrapperOperandType type(WrapperType::TENSOR_FLOAT32, { 1 });
+ return addOperand(&type);
+ }
+ uint32_t addQuantOperand() {
+ static const WrapperOperandType type(WrapperType::TENSOR_QUANT8_ASYMM, { 1 });
+ return addOperand(&type);
+ }
+
+ // Create an operation with two inputs and one output, specifying
+ // the operation kind (0..7) and the input operand indexes.
+ // Returns the output operand index.
+ uint32_t addOperation2To1(uint32_t operation, const uint32_t input0, const uint32_t input1) {
+ ANeuralNetworksOperationType type =
+ (operation < kNumFuseCodes ? ANEURALNETWORKS_ADD : ANEURALNETWORKS_MUL);
+ int32_t fuseCode = (operation < kNumFuseCodes ? operation : operation - kNumFuseCodes);
+ uint32_t input2 = addIntOperand(fuseCode);
+ uint32_t output = addOperandOfSameType(input0);
+ addOperation(type, { input0, input1, input2 }, { output });
+ return output;
+ }
+
+ // Run the partitioning algorithm to create an ExecutionPlan.
+ int partitionTheWork(const std::vector<std::shared_ptr<Device>>& devices,
+ ExecutePreference preference, ExecutionPlan* plan) {
+ return reinterpret_cast<ModelBuilder*>(getHandle())->partitionTheWork(
+ devices, static_cast<uint32_t>(preference), plan);
+ }
+
+#ifdef VERBOSE
+ // This is a debugging utility function.
+ void dump(const char* name) const {
+ const ModelBuilder* mb = reinterpret_cast<const ModelBuilder*>(getHandle());
+ ::dump(name, mb);
+ }
+#endif
+
+private:
+
+ // Create a scalar integer operand of the specified value, and
+ // return the corresponding operand index.
+ uint32_t addIntOperand(int32_t value) {
+ static const WrapperOperandType type(WrapperType::INT32, { });
+ uint32_t operand = addOperand(&type);
+ setOperandValue(operand, &value, sizeof(value));
+ return operand;
+ }
+
+ // Create an operand of the same type as the specified operand,
+ // and return the operand index of the new operand.
+ uint32_t addOperandOfSameType(uint32_t operand) {
+ const Operand& operandStruct =
+ reinterpret_cast<const ModelBuilder*>(getHandle())->getOperand(operand);
+ WrapperOperandType type(static_cast<WrapperType>(operandStruct.type), { 1 });
+ return addOperand(&type);
+ }
+};
+
+#ifdef VERBOSE
+#define RETURN_TRUE() \
+ { \
+ std::cerr << "returning true from " << __LINE__ << std::endl; \
+ return true; \
+ }
+#else
+#define RETURN_TRUE() \
+ { \
+ return true; \
+ }
+#endif
+#ifdef VERBOSE
+#define RETURN_FALSE(MESSAGE) \
+ { \
+ std::cerr << "returning false from " << __LINE__ MESSAGE << std::endl; \
+ return false; \
+ }
+#else
+#define RETURN_FALSE(MESSAGE) \
+ { \
+ return false; \
+ }
+#endif
+
+class PartitioningTest : public ::testing::Test {
+protected:
+ // workaround for private types in ExecutionStep
+ using RemapVectorType = decltype(static_cast<ExecutionStep*>(nullptr)->getModelInputs());
+ using SubModelOutputSetType = decltype(static_cast<ExecutionStep*>(nullptr)->getSubModelOutputs());
+
+ virtual void SetUp() {
+ }
+
+ // From a vector of triples (tuples), each of the form (name,
+ // capabilities, bitmask of supported operation kinds), create a
+ // vector of Devices.
+ static std::vector<std::shared_ptr<Device>>
+ makeDevices(std::vector<std::tuple<std::string, Capabilities, uint32_t>> specifications) {
+ std::vector<std::shared_ptr<Device>> devices;
+ for (const auto& specification : specifications) {
+ devices.push_back(std::make_shared<Device>(
+ std::get<0>(specification),
+ new PartitioningIDevice(std::get<1>(specification), std::get<2>(specification))));
+ devices.back()->initialize();
+ }
+ return devices;
+ }
+
+ /*-- Graph comparision ----------------------------------------------------------------*/
+
+ // An operand with certain values for its lifetime does not have a
+ // defining operation in the graph. For the purposes of the graph
+ // comparison algorithm, we encode the "defining operation" index of
+ // such an operand as follows:
+ // - NO_VALUE kPseudoDefiningOperationNoValue
+ // - MODEL_INPUT kPseudoDefiningOperationModelInput0 + (position in list of inputs)
+ // - CONSTANT_COPY kPseudoDefiningOperationConstantCopy0 + (constant value)
+ // Note: For the graphs we build in this test, we
+ // only expect to see 4-byte constants within
+ // a very restricted range, so we only make
+ // room for such constants in our encoding
+ // space.
+ // We do not expect to see CONSTANT_REFERENCE, and so we do not handle
+ // it.
+ //
+ // The encoding is intended to be relatively human readable; it is not
+ // designed to represent some optimal balance of ranges for the items
+ // within its scope (actual operations, inputs, constants).
+
+ enum PseudoDefiningOperationEncodings : uint32_t {
+ kPseudoDefiningOperationModelInput0 = 0x80000000U,
+ kPseudoDefiningOperationConstantCopy0 = 0x90000000U,
+ kPseudoDefiningOperationNoValue = 0xeeeeeeeeU,
+
+ // lowest value for special encoding
+ kPseudoDefiningOperationBase = 0x80000000U,
+
+ // range of encoded input or constant
+ kPseudoDefiningOperationRange = 0x10000000U,
+ };
+
+ // Build a map from operand to defining operation.
+ // TODO: Replace map with vector?
+ void buildDefinitionMap(const ModelBuilder* model,
+ std::map<uint32_t, uint32_t>* defMap) {
+ // actual definitions
+ ASSERT_LT(model->operationCount(), kPseudoDefiningOperationBase);
+ for (uint32_t i = 0, e = model->operationCount(); i < e; i++) {
+ const Operation& operation = model->getOperation(i);
+ for (uint32_t output : operation.outputs) {
+ (*defMap)[output] = i;
+ }
+ }
+ // inputs
+ ASSERT_LT(model->inputCount(), kPseudoDefiningOperationRange);
+ for (uint32_t i = 0, e = model->inputCount(); i < e; i++) {
+ (*defMap)[model->getInputOperandIndex(i)] = kPseudoDefiningOperationModelInput0 + i;
+ }
+ // look for NO_VALUE and CONSTANT_COPY
+ for (uint32_t i = 0, e = model->operandCount(); i < e; i++) {
+ const Operand& operand = model->getOperand(i);
+ switch (operand.lifetime) {
+ case OperandLifeTime::NO_VALUE:
+ (*defMap)[i] = kPseudoDefiningOperationNoValue;
+ break;
+ case OperandLifeTime::CONSTANT_COPY: {
+ ASSERT_EQ(operand.location.length, sizeof(uint32_t));
+ uint32_t value;
+ memcpy(&value, model->getPointerToOperandValue(operand.location.offset), sizeof(uint32_t));
+ ASSERT_LT(value, kPseudoDefiningOperationNoValue);
+ (*defMap)[i] = kPseudoDefiningOperationConstantCopy0 + value;
+ break;
+ }
+ case OperandLifeTime::TEMPORARY_VARIABLE:
+ case OperandLifeTime::MODEL_INPUT:
+ case OperandLifeTime::MODEL_OUTPUT:
+ // already handled
+ break;
+ default:
+ FAIL();
+ break;
+ }
+ }
+ // sanity check
+ ASSERT_EQ(model->operandCount(), defMap->size());
+ }
+
+#ifdef VERBOSE
+ void dump(const char* name, const std::map<uint32_t, uint32_t>* aMap) {
+ auto writeNum = [](uint32_t num) {
+ if (num >= kPseudoDefiningOperationBase) {
+ std::cout << "0x" << std::hex << num << std::dec;
+ } else {
+ std::cout << num;
+ }
+ };
+
+ std::cout << name << ": { ";
+ bool gotOne = false;
+ for (const auto& entry : *aMap) {
+ if (gotOne) {
+ std::cout << ", ";
+ } else {
+ gotOne = true;
+ }
+ std::cout << "(";
+ writeNum(entry.first);
+ std::cout << ", ";
+ writeNum(entry.second);
+ std::cout << ")";
+ }
+ std::cout << " }" << std::endl;
+ }
+#endif
+
+ bool compare(const Operand& operandA, const Operand& operandB) {
+ if (operandA.type != operandB.type ||
+ operandA.dimensions != operandB.dimensions ||
+ operandA.numberOfConsumers != operandB.numberOfConsumers ||
+ operandA.scale != operandB.scale ||
+ operandA.zeroPoint != operandB.zeroPoint) {
+ return false;
+ }
+ return true;
+ }
+
+ // Compare two graphs. We ignore operand and operation indexes (i.e.,
+ // two nodes can be the same even if they are numbered differently)
+ // but we also ignore semantics (e.g., even if an operation kind is
+ // such that the operand is commutative, we still pay attention to the
+ // order of its input operands).
+ //
+ // The comparison algorithm works by walking modelA from outputs
+ // towards inputs, along the edge from each operand to its
+ // defining operation, and then along the edges to the operation's
+ // input operands. At each step along the way, we try to match up
+ // operands and operations from modelA with equivalent operands
+ // and operations from modelB.
+ //
+ // We start by assuming that modelA's outputs and modelB's outputs
+ // match positionally (e.g., modelA's first output operand is
+ // equivalent to modelB's first output operand). Once we've
+ // discovered two equivalent operands (such as those outputs), we
+ // place them in a work queue. We repeatedly pull operands off
+ // the queue and compare their defining operations and those
+ // operations' input operands, to discover more pairs of
+ // equivalent operands. If we ever find operations that do not
+ // match (e.g., because operation kind differs), or operands that
+ // do not match (e.g., because operand type differs); or if we
+ // ever find a conflict (we've already decided that operand A's
+ // equivalent operand is B0, but it looks like we need its
+ // equivalent operand to be B1); then the graphs compare unequal.
+ // Otherwise, we'll eventually exhaust the work queue, and
+ // conclude that the graphs compare equal.
+ bool compare(const ModelBuilder* modelA, const ModelBuilder* modelB) {
+#ifdef VERBOSE
+ ::dump("compare(A)", modelA);
+ ::dump("compare(B)", modelB);
+#endif
+
+ if (modelA->operandCount() != modelB->operandCount() ||
+ modelA->operationCount() != modelB->operationCount() ||
+ modelA->inputCount() != modelB->inputCount() ||
+ modelA->outputCount() != modelB->outputCount()) {
+ RETURN_FALSE();
+ }
+
+ // Maps from operand index to index of defining operation.
+ std::map<uint32_t, uint32_t> defsA, defsB;
+ buildDefinitionMap(modelA, &defsA);
+ buildDefinitionMap(modelB, &defsB);
+ if (HasFatalFailure()) return false;
+
+ // Maps from operand index in modelA to equivalent operand index
+ // in modelB; and from operation index in modelA to equivalent
+ // operation index in modelB.
+ std::map<uint32_t, uint32_t> equivalentOperandsAToB;
+ std::map<uint32_t, uint32_t> equivalentOperationsAToB;
+
+ // Queue of operand indexes from modelA, each of whose defining
+ // operations are to be checked for equivalence with modelB.
+ std::queue<uint32_t> workQueueOperandsA;
+
+ // Seed operand equivalence map and work queue from model outputs.
+ for (uint32_t i = 0, e = modelA->outputCount(); i < e; i++) {
+ uint32_t outputA = modelA->getOutputOperandIndex(i);
+ uint32_t outputB = modelB->getOutputOperandIndex(i);
+ if (!compare(modelA->getOperand(outputA), modelB->getOperand(outputB))) {
+ RETURN_FALSE();
+ }
+ equivalentOperandsAToB[outputA] = outputB;
+ workQueueOperandsA.push(outputA);
+ }
+
+#ifdef VERBOSE
+ dump("defsA", &defsA);
+ dump("defsB", &defsB);
+#endif
+
+ // Process the queue.
+ uint32_t pseudoDefinitionCount = 0;
+ while (!workQueueOperandsA.empty()) {
+#ifdef VERBOSE
+ dump("equivalentOperandsAToB", &equivalentOperandsAToB);
+ dump("equivalentOperationsAToB", &equivalentOperationsAToB);
+#endif
+ uint32_t operandIndexA = workQueueOperandsA.front();
+#ifdef VERBOSE
+ std::cout << "operandIndexA: " << operandIndexA << std::endl;
+#endif
+ workQueueOperandsA.pop();
+ uint32_t operandIndexB = equivalentOperandsAToB.at(operandIndexA);
+
+ uint32_t operationIndexA = defsA.at(operandIndexA);
+ uint32_t operationIndexB = defsB.at(operandIndexB);
+ auto it = equivalentOperationsAToB.find(operationIndexA);
+ if (it != equivalentOperationsAToB.end()) {
+ if (it->second != operationIndexB) {
+ RETURN_FALSE();
+ }
+ continue;
+ }
+
+ // We haven't identified an equivalent operation for
+ // operationIndexA.
+
+ if ((operationIndexA >= kPseudoDefiningOperationBase) !=
+ (operationIndexB >= kPseudoDefiningOperationBase)) {
+ RETURN_FALSE();
+ }
+ // Either both operands have pseudo-definitions, or neither
+ // does.
+ if (operationIndexA >= kPseudoDefiningOperationBase) {
+ // Both operands have pseudo-definitions.
+ if (operationIndexA != operationIndexB) {
+ RETURN_FALSE();
+ }
+ equivalentOperationsAToB[operationIndexA] = operationIndexB;
+ ++pseudoDefinitionCount;
+ continue;
+ }
+
+ // If we get here, neither operation A nor operation B is a
+ // pseudo-definition.
+
+ const Operation& operationA = modelA->getOperation(operationIndexA);
+ const Operation& operationB = modelB->getOperation(operationIndexB);
+ if (operationA.type != operationB.type ||
+ operationA.inputs.size() != operationB.inputs.size() ||
+ operationA.outputs.size() != operationB.outputs.size()) {
+ RETURN_FALSE();
+ }
+ equivalentOperationsAToB[operationIndexA] = operationIndexB;
+ for (uint32_t i = 0, e = operationA.inputs.size(); i < e; i++) {
+ uint32_t inputA = operationA.inputs[i];
+ uint32_t inputB = operationB.inputs[i];
+ auto it = equivalentOperandsAToB.find(inputA);
+ if (it != equivalentOperandsAToB.end()) {
+ if (it->second != inputB) {
+ RETURN_FALSE();
+ }
+ continue;
+ }
+ // We haven't identified an equivalent operand for inputA.
+ if (!compare(modelA->getOperand(inputA), modelB->getOperand(inputB))) {
+ RETURN_FALSE();
+ }
+ equivalentOperandsAToB[inputA] = inputB;
+ workQueueOperandsA.push(inputA);
+ }
+ }
+
+ // Sanity check
+ if (modelA->operandCount() != defsA.size() ||
+ modelA->operandCount() != defsB.size() ||
+ modelA->operandCount() != equivalentOperandsAToB.size() ||
+ modelA->operationCount() + pseudoDefinitionCount != equivalentOperationsAToB.size()) {
+ RETURN_FALSE();
+ }
+
+ RETURN_TRUE();
+ }
+
+ /*-------------------------------------------------------------------------------------*/
+
+ bool compare(std::shared_ptr<const ExecutionStep> step,
+ const WrapperModel* model, std::shared_ptr<Device> device) {
+ return (step->getDevice() == device) &&
+ compare(step->getSubModel().get(),
+ reinterpret_cast<const ModelBuilder*>(model->getHandle()));
+ }
+};
+
+TEST_F(PartitioningTest, SimpleModel) {
+ PartitioningModel model;
+ uint32_t opnd0 = model.addFloatOperand();
+ uint32_t opnd1 = model.addFloatOperand();
+ uint32_t opnd2 = model.addOperation2To1(0, opnd0, opnd1);
+ uint32_t opnd3 = model.addFloatOperand();
+ uint32_t opnd4 = model.addOperation2To1(1, opnd2, opnd3);
+ model.identifyInputsAndOutputs({ opnd0, opnd1, opnd3 }, { opnd4 });
+ model.finish();
+ ASSERT_TRUE(model.isValid());
+
+ // Simple partition (two devices are each capable of everything, one is the best).
+ const auto devicesA = makeDevices(
+ {
+ {"bad", { .float32Performance = { .execTime = 1.5, .powerUsage = 1.5 },
+ .quantized8Performance = { .execTime = 1.5, .powerUsage = 1.5 } }, ~0},
+ {"good", { .float32Performance = { .execTime = 0.5, .powerUsage = 0.5 },
+ .quantized8Performance = { .execTime = 0.5, .powerUsage = 0.5 } }, ~0}
+ });
+ ExecutionPlan planA;
+ ASSERT_EQ(model.partitionTheWork(devicesA, ExecutePreference::PREFER_LOW_POWER, &planA),
+ ANEURALNETWORKS_NO_ERROR);
+ ASSERT_EQ(planA.forTest_getKind(), ExecutionPlan::Kind::SIMPLE);
+ ASSERT_EQ(planA.forTest_simpleGetDevice()->getName(), "good");
+
+ // Compound partition (two devices, each is capable of one of the
+ // two operations). We could do more extensive checking here --
+ // for example, verify that each step within the plan has the
+ // correct (model and submodel)x(inputs and outputs).
+ const auto devicesB = makeDevices(
+ {
+ {"0", { .float32Performance = { .execTime = 1.5, .powerUsage = 1.5 },
+ .quantized8Performance = { .execTime = 1.5, .powerUsage = 1.5 } }, 1<<0},
+ {"1", { .float32Performance = { .execTime = 0.5, .powerUsage = 0.5 },
+ .quantized8Performance = { .execTime = 0.5, .powerUsage = 0.5 } }, 1<<1}
+ });
+ ExecutionPlan planB;
+ ASSERT_EQ(model.partitionTheWork(devicesB, ExecutePreference::PREFER_LOW_POWER, &planB),
+ ANEURALNETWORKS_NO_ERROR);
+ ASSERT_EQ(planB.forTest_getKind(), ExecutionPlan::Kind::COMPOUND);
+ const auto& stepsB = planB.forTest_compoundGetSteps();
+ ASSERT_EQ(stepsB.size(), size_t(2));
+ {
+ // Build a model to compare against the submodel from stepsB[0].
+ PartitioningModel modelB0;
+ uint32_t b0Opnd0 = modelB0.addFloatOperand();
+ uint32_t b0Opnd1 = modelB0.addFloatOperand();
+ uint32_t b0Opnd2 = modelB0.addOperation2To1(0, b0Opnd0, b0Opnd1);
+ modelB0.identifyInputsAndOutputs({ b0Opnd0, b0Opnd1 }, { b0Opnd2 });
+ modelB0.finish();
+ ASSERT_TRUE(modelB0.isValid());
+ ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(compare(stepsB[0], &modelB0, devicesB[0])));
+ ASSERT_EQ(stepsB[0]->getModelInputs(),
+ (RemapVectorType{ { opnd0, b0Opnd0 }, { opnd1, b0Opnd1 } }));
+ ASSERT_EQ(stepsB[0]->getModelOutputs(),
+ (RemapVectorType{}));
+ ASSERT_EQ(stepsB[0]->getSubModelInputs(),
+ (RemapVectorType{}));
+ ASSERT_EQ(stepsB[0]->getSubModelOutputs(),
+ (SubModelOutputSetType{ { opnd2, b0Opnd2 } }));
+ }
+ {
+ // Build a model to compare against the submodel from stepsB[1].
+ PartitioningModel modelB1;
+ uint32_t b1Opnd2 = modelB1.addFloatOperand();
+ uint32_t b1Opnd3 = modelB1.addFloatOperand();
+ uint32_t b1Opnd4 = modelB1.addOperation2To1(1, b1Opnd2, b1Opnd3);
+ // Note: In the partitioning algorithm, submodel inputs follow
+ // model inputs. In the original model "model", opnd2 is not
+ // an input; so in the submodel "modelB1", the corresponding
+ // input b1Opnd2 is a submodel input, and must follow the
+ // model input b1Opnd3.
+ modelB1.identifyInputsAndOutputs({ b1Opnd3, b1Opnd2 }, { b1Opnd4 });
+ modelB1.finish();
+ ASSERT_TRUE(modelB1.isValid());
+ ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(compare(stepsB[1], &modelB1, devicesB[1])));
+ ASSERT_EQ(stepsB[1]->getModelInputs(),
+ (RemapVectorType{ { opnd3, b1Opnd3 } }));
+ ASSERT_EQ(stepsB[1]->getModelOutputs(),
+ (RemapVectorType{ { opnd4, b1Opnd4 } }));
+ ASSERT_EQ(stepsB[1]->getSubModelInputs(),
+ (RemapVectorType{ { opnd2, b1Opnd2 } }));
+ ASSERT_EQ(stepsB[1]->getSubModelOutputs(),
+ (SubModelOutputSetType{}));
+ }
+}
+
+TEST_F(PartitioningTest, Cpu) {
+ // Here's a model where some operations execute only on the Cpu.
+ // To make things interesting, we produce three partitions --
+ // device, cpu, same-device.
+
+ static const uint32_t kCpuOp = 1;
+ static const uint32_t kDevOp = 2;
+
+ const auto devices = makeDevices(
+ {
+ {"1", { .float32Performance = { .execTime = 0.5, .powerUsage = 0.5 },
+ .quantized8Performance = { .execTime = 0.5, .powerUsage = 0.5 } }, 1<<kDevOp}
+ });
+
+ PartitioningModel model;
+
+ uint32_t opnd0 = model.addFloatOperand();
+ uint32_t opnd1 = model.addFloatOperand();
+
+ uint32_t opnd2 = model.addOperation2To1(kDevOp, opnd0, opnd1);
+ uint32_t opnd3 = model.addOperation2To1(kDevOp, opnd0, opnd2);
+
+ uint32_t opnd4 = model.addOperation2To1(kCpuOp, opnd0, opnd3);
+ uint32_t opnd5 = model.addOperation2To1(kCpuOp, opnd2, opnd4);
+
+ uint32_t opnd6 = model.addFloatOperand();
+
+ uint32_t opnd7 = model.addOperation2To1(kDevOp, opnd3, opnd5);
+ uint32_t opnd8 = model.addOperation2To1(kDevOp, opnd6, opnd7);
+
+ model.identifyInputsAndOutputs({ opnd0, opnd1, opnd6 }, { opnd4, opnd8 });
+ model.finish();
+ ASSERT_TRUE(model.isValid());
+
+ ExecutionPlan plan;
+ ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, &plan),
+ ANEURALNETWORKS_NO_ERROR);
+ ASSERT_EQ(plan.forTest_getKind(), ExecutionPlan::Kind::COMPOUND);
+ const auto& steps = plan.forTest_compoundGetSteps();
+ ASSERT_EQ(steps.size(), size_t(3));
+ {
+ const auto& step0 = steps[0];
+
+ // Build a model to compare against the submodel from steps[0].
+ PartitioningModel model0;
+ uint32_t m0Opnd0 = model0.addFloatOperand();
+ uint32_t m0Opnd1 = model0.addFloatOperand();
+ uint32_t m0Opnd2 = model0.addOperation2To1(kDevOp, m0Opnd0, m0Opnd1);
+ uint32_t m0Opnd3 = model0.addOperation2To1(kDevOp, m0Opnd0, m0Opnd2);
+ model0.identifyInputsAndOutputs({ m0Opnd0, m0Opnd1 }, { m0Opnd2, m0Opnd3 });
+ model0.finish();
+ ASSERT_TRUE(model0.isValid());
+ ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(compare(step0, &model0, devices[0])));
+ ASSERT_EQ(step0->getModelInputs(),
+ (RemapVectorType{ { opnd0, m0Opnd0 }, { opnd1, m0Opnd1 } }));
+ ASSERT_EQ(step0->getModelOutputs(),
+ (RemapVectorType{}));
+ ASSERT_EQ(step0->getSubModelInputs(),
+ (RemapVectorType{}));
+ ASSERT_EQ(step0->getSubModelOutputs(),
+ (SubModelOutputSetType{ { opnd2, m0Opnd2 }, { opnd3, m0Opnd3 } }));
+ }
+ {
+ const auto& step1 = steps[1];
+
+ // Build a model to compare against the submodel from steps[1].
+ PartitioningModel model1;
+ uint32_t m1Opnd0 = model1.addFloatOperand();
+ uint32_t m1Opnd3 = model1.addFloatOperand();
+ uint32_t m1Opnd4 = model1.addOperation2To1(kCpuOp, m1Opnd0, m1Opnd3);
+ uint32_t m1Opnd2 = model1.addFloatOperand();
+ uint32_t m1Opnd5 = model1.addOperation2To1(kCpuOp, m1Opnd2, m1Opnd4);
+ model1.identifyInputsAndOutputs({ m1Opnd0, m1Opnd3, m1Opnd2 }, { m1Opnd4, m1Opnd5 });
+ model1.finish();
+ ASSERT_TRUE(model1.isValid());
+ ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(compare(step1, &model1, nullptr)));
+ ASSERT_EQ(step1->getModelInputs(),
+ (RemapVectorType{ { opnd0, m1Opnd0 } }));
+ ASSERT_EQ(step1->getModelOutputs(),
+ (RemapVectorType{ { opnd4, m1Opnd4 } }));
+ ASSERT_EQ(step1->getSubModelInputs(),
+ (RemapVectorType{ { opnd3, m1Opnd3 }, { opnd2, m1Opnd2 } }));
+ ASSERT_EQ(step1->getSubModelOutputs(),
+ (SubModelOutputSetType{ { opnd5, m1Opnd5 } }));
+ }
+ {
+ const auto& step2 = steps[2];
+
+ // Build a model to compare against the submodel from steps[2].
+ PartitioningModel model2;
+ uint32_t m2Opnd3 = model2.addFloatOperand();
+ uint32_t m2Opnd5 = model2.addFloatOperand();
+ uint32_t m2Opnd7 = model2.addOperation2To1(kDevOp, m2Opnd3, m2Opnd5);
+ uint32_t m2Opnd6 = model2.addFloatOperand();
+ uint32_t m2Opnd8 = model2.addOperation2To1(kDevOp, m2Opnd6, m2Opnd7);
+ model2.identifyInputsAndOutputs({ m2Opnd6, m2Opnd3, m2Opnd5 }, { m2Opnd8 });
+ model2.finish();
+ ASSERT_TRUE(model2.isValid());
+ ASSERT_NO_FATAL_FAILURE(ASSERT_TRUE(compare(step2, &model2, devices[0])));
+ ASSERT_EQ(step2->getModelInputs(),
+ (RemapVectorType{ { opnd6, m2Opnd6 } }));
+ ASSERT_EQ(step2->getModelOutputs(),
+ (RemapVectorType{ { opnd8, m2Opnd8 } }));
+ ASSERT_EQ(step2->getSubModelInputs(),
+ (RemapVectorType{ { opnd3, m2Opnd3 }, { opnd5, m2Opnd5 } }));
+ ASSERT_EQ(step2->getSubModelOutputs(),
+ (SubModelOutputSetType{}));
+ }
+}
+
+} // namespace
diff --git a/nn/runtime/test/generated/all_generated_tests.cpp b/nn/runtime/test/generated/all_generated_tests.cpp
index 269edf695..7b59f0535 100644
--- a/nn/runtime/test/generated/all_generated_tests.cpp
+++ b/nn/runtime/test/generated/all_generated_tests.cpp
@@ -463,6 +463,20 @@ TEST_F(GeneratedTests, depth_to_space_float_2) {
depth_to_space_float_2::examples);
}
+namespace depth_to_space_float_3 {
+std::vector<MixedTypedExample> examples = {
+// Generated depth_to_space_float_3 test
+#include "generated/examples/depth_to_space_float_3.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/depth_to_space_float_3.model.cpp"
+} // namespace depth_to_space_float_3
+TEST_F(GeneratedTests, depth_to_space_float_3) {
+ Execute(depth_to_space_float_3::CreateModel,
+ depth_to_space_float_3::is_ignored,
+ depth_to_space_float_3::examples);
+}
+
namespace depth_to_space_quant8_1 {
std::vector<MixedTypedExample> examples = {
// Generated depth_to_space_quant8_1 test
@@ -1037,6 +1051,34 @@ TEST_F(GeneratedTests, lstm2) {
lstm2::examples);
}
+namespace lstm2_state2 {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm2_state2 test
+#include "generated/examples/lstm2_state2.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm2_state2.model.cpp"
+} // namespace lstm2_state2
+TEST_F(GeneratedTests, lstm2_state2) {
+ Execute(lstm2_state2::CreateModel,
+ lstm2_state2::is_ignored,
+ lstm2_state2::examples);
+}
+
+namespace lstm2_state {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm2_state test
+#include "generated/examples/lstm2_state.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm2_state.model.cpp"
+} // namespace lstm2_state
+TEST_F(GeneratedTests, lstm2_state) {
+ Execute(lstm2_state::CreateModel,
+ lstm2_state::is_ignored,
+ lstm2_state::examples);
+}
+
namespace lstm3 {
std::vector<MixedTypedExample> examples = {
// Generated lstm3 test
@@ -1051,6 +1093,48 @@ TEST_F(GeneratedTests, lstm3) {
lstm3::examples);
}
+namespace lstm3_state2 {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm3_state2 test
+#include "generated/examples/lstm3_state2.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm3_state2.model.cpp"
+} // namespace lstm3_state2
+TEST_F(GeneratedTests, lstm3_state2) {
+ Execute(lstm3_state2::CreateModel,
+ lstm3_state2::is_ignored,
+ lstm3_state2::examples);
+}
+
+namespace lstm3_state3 {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm3_state3 test
+#include "generated/examples/lstm3_state3.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm3_state3.model.cpp"
+} // namespace lstm3_state3
+TEST_F(GeneratedTests, lstm3_state3) {
+ Execute(lstm3_state3::CreateModel,
+ lstm3_state3::is_ignored,
+ lstm3_state3::examples);
+}
+
+namespace lstm3_state {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm3_state test
+#include "generated/examples/lstm3_state.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm3_state.model.cpp"
+} // namespace lstm3_state
+TEST_F(GeneratedTests, lstm3_state) {
+ Execute(lstm3_state::CreateModel,
+ lstm3_state::is_ignored,
+ lstm3_state::examples);
+}
+
namespace lstm {
std::vector<MixedTypedExample> examples = {
// Generated lstm test
@@ -1065,6 +1149,34 @@ TEST_F(GeneratedTests, lstm) {
lstm::examples);
}
+namespace lstm_state2 {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm_state2 test
+#include "generated/examples/lstm_state2.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm_state2.model.cpp"
+} // namespace lstm_state2
+TEST_F(GeneratedTests, lstm_state2) {
+ Execute(lstm_state2::CreateModel,
+ lstm_state2::is_ignored,
+ lstm_state2::examples);
+}
+
+namespace lstm_state {
+std::vector<MixedTypedExample> examples = {
+// Generated lstm_state test
+#include "generated/examples/lstm_state.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/lstm_state.model.cpp"
+} // namespace lstm_state
+TEST_F(GeneratedTests, lstm_state) {
+ Execute(lstm_state::CreateModel,
+ lstm_state::is_ignored,
+ lstm_state::examples);
+}
+
namespace max_pool_float_1 {
std::vector<MixedTypedExample> examples = {
// Generated max_pool_float_1 test
@@ -1471,6 +1583,20 @@ TEST_F(GeneratedTests, rnn) {
rnn::examples);
}
+namespace rnn_state {
+std::vector<MixedTypedExample> examples = {
+// Generated rnn_state test
+#include "generated/examples/rnn_state.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/rnn_state.model.cpp"
+} // namespace rnn_state
+TEST_F(GeneratedTests, rnn_state) {
+ Execute(rnn_state::CreateModel,
+ rnn_state::is_ignored,
+ rnn_state::examples);
+}
+
namespace softmax_float_1 {
std::vector<MixedTypedExample> examples = {
// Generated softmax_float_1 test
@@ -1555,6 +1681,20 @@ TEST_F(GeneratedTests, space_to_depth_float_2) {
space_to_depth_float_2::examples);
}
+namespace space_to_depth_float_3 {
+std::vector<MixedTypedExample> examples = {
+// Generated space_to_depth_float_3 test
+#include "generated/examples/space_to_depth_float_3.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/space_to_depth_float_3.model.cpp"
+} // namespace space_to_depth_float_3
+TEST_F(GeneratedTests, space_to_depth_float_3) {
+ Execute(space_to_depth_float_3::CreateModel,
+ space_to_depth_float_3::is_ignored,
+ space_to_depth_float_3::examples);
+}
+
namespace space_to_depth_quant8_1 {
std::vector<MixedTypedExample> examples = {
// Generated space_to_depth_quant8_1 test
@@ -1597,6 +1737,20 @@ TEST_F(GeneratedTests, svdf) {
svdf::examples);
}
+namespace svdf_state {
+std::vector<MixedTypedExample> examples = {
+// Generated svdf_state test
+#include "generated/examples/svdf_state.example.cpp"
+};
+// Generated model constructor
+#include "generated/models/svdf_state.model.cpp"
+} // namespace svdf_state
+TEST_F(GeneratedTests, svdf_state) {
+ Execute(svdf_state::CreateModel,
+ svdf_state::is_ignored,
+ svdf_state::examples);
+}
+
namespace tanh {
std::vector<MixedTypedExample> examples = {
// Generated tanh test
@@ -1610,3 +1764,4 @@ TEST_F(GeneratedTests, tanh) {
tanh::is_ignored,
tanh::examples);
}
+
diff --git a/nn/runtime/test/generated/all_generated_vts_tests.cpp b/nn/runtime/test/generated/all_generated_vts_tests.cpp
index 01013f360..23f1a7182 100644
--- a/nn/runtime/test/generated/all_generated_vts_tests.cpp
+++ b/nn/runtime/test/generated/all_generated_vts_tests.cpp
@@ -496,6 +496,21 @@ TEST_F(NeuralnetworksHidlTest, depth_to_space_float_2) {
depth_to_space_float_2::examples);
}
+namespace depth_to_space_float_3 {
+std::vector<MixedTypedExample> examples = {
+// Generated depth_to_space_float_3 test
+#include "examples/depth_to_space_float_3.example.cpp"
+};
+// Generated model constructor
+#include "vts_models/depth_to_space_float_3.model.cpp"
+} // namespace depth_to_space_float_3
+TEST_F(NeuralnetworksHidlTest, depth_to_space_float_3) {
+ generated_tests::Execute(device,
+ depth_to_space_float_3::createTestModel,
+ depth_to_space_float_3::is_ignored,
+ depth_to_space_float_3::examples);
+}
+
namespace depth_to_space_quant8_1 {
std::vector<MixedTypedExample> examples = {
// Generated depth_to_space_quant8_1 test
@@ -1651,6 +1666,21 @@ TEST_F(NeuralnetworksHidlTest, space_to_depth_float_2) {
space_to_depth_float_2::examples);
}
+namespace space_to_depth_float_3 {
+std::vector<MixedTypedExample> examples = {
+// Generated space_to_depth_float_3 test
+#include "examples/space_to_depth_float_3.example.cpp"
+};
+// Generated model constructor
+#include "vts_models/space_to_depth_float_3.model.cpp"
+} // namespace space_to_depth_float_3
+TEST_F(NeuralnetworksHidlTest, space_to_depth_float_3) {
+ generated_tests::Execute(device,
+ space_to_depth_float_3::createTestModel,
+ space_to_depth_float_3::is_ignored,
+ space_to_depth_float_3::examples);
+}
+
namespace space_to_depth_quant8_1 {
std::vector<MixedTypedExample> examples = {
// Generated space_to_depth_quant8_1 test
diff --git a/nn/runtime/test/generated/examples/depth_to_space_float_3.example.cpp b/nn/runtime/test/generated/examples/depth_to_space_float_3.example.cpp
new file mode 100644
index 000000000..0124212a6
--- /dev/null
+++ b/nn/runtime/test/generated/examples/depth_to_space_float_3.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: depth_to_space_float_3.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {10, 20, 11, 21, 14, 24, 15, 25, 12, 22, 13, 23, 16, 26, 17, 27, 18, 28, 19, 29, 112, 212, 113, 213, 110, 210, 111, 211, 114, 214, 115, 215}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {10, 20, 11, 21, 12, 22, 13, 23, 14, 24, 15, 25, 16, 26, 17, 27, 18, 28, 19, 29, 110, 210, 111, 211, 112, 212, 113, 213, 114, 214, 115, 215}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/depthwise_conv2d_float_large_weights_as_inputs.example.cpp b/nn/runtime/test/generated/examples/depthwise_conv2d_float_large_weights_as_inputs.example.cpp
index 10873a7d0..410b1a397 100644
--- a/nn/runtime/test/generated/examples/depthwise_conv2d_float_large_weights_as_inputs.example.cpp
+++ b/nn/runtime/test/generated/examples/depthwise_conv2d_float_large_weights_as_inputs.example.cpp
@@ -4,7 +4,7 @@
//Input(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
- {{0, {10, 21, 100, 10, 22, 200, 10, 23, 300, 10, 24, 400}}, {1, {0.25f, 0, 0.25f, 1, 0.25f, 0, 0.25f, 1}}, {2, {100, 200}}},
+ {{0, {10, 21, 10, 22, 10, 23, 10, 24}}, {1, {0.25f, 0, 0.25f, 1, 0.25f, 0, 0.25f, 1}}, {2, {100, 200}}},
// int -> INT32 map
{},
// int -> QUANT8_ASYMM map
diff --git a/nn/runtime/test/generated/examples/embedding_lookup.example.cpp b/nn/runtime/test/generated/examples/embedding_lookup.example.cpp
index e2c7b0732..254d6f707 100644
--- a/nn/runtime/test/generated/examples/embedding_lookup.example.cpp
+++ b/nn/runtime/test/generated/examples/embedding_lookup.example.cpp
@@ -4,9 +4,9 @@
//Input(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
- {{0, {0.0f, 0.01f, 0.02f, 0.03f, 0.1f, 0.11f, 0.12000000000000001f, 0.13f, 1.0f, 1.01f, 1.02f, 1.03f, 1.1f, 1.11f, 1.12f, 1.1300000000000001f, 2.0f, 2.01f, 2.02f, 2.03f, 2.1f, 2.11f, 2.12f, 2.13f}}, {1, {1.0f, 0.0f, 2.0f}}},
+ {{1, {0.0f, 0.01f, 0.02f, 0.03f, 0.1f, 0.11f, 0.12000000000000001f, 0.13f, 1.0f, 1.01f, 1.02f, 1.03f, 1.1f, 1.11f, 1.12f, 1.1300000000000001f, 2.0f, 2.01f, 2.02f, 2.03f, 2.1f, 2.11f, 2.12f, 2.13f}}},
// int -> INT32 map
- {},
+ {{0, {1, 0, 2}}},
// int -> QUANT8_ASYMM map
{}
},
diff --git a/nn/runtime/test/generated/examples/lstm.example.cpp b/nn/runtime/test/generated/examples/lstm.example.cpp
index b5313fad1..33a2b19c3 100644
--- a/nn/runtime/test/generated/examples/lstm.example.cpp
+++ b/nn/runtime/test/generated/examples/lstm.example.cpp
@@ -13,7 +13,7 @@
//Output(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
- {{1, {0, 0, 0, 0}}, {2, {0, 0, 0, 0}}, {3, {-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ {{1, {-0.0297319f, 0.122947f, 0.208851f, -0.153588f}}, {2, {-0.145439f, 0.157475f, 0.293663f, -0.277353f}}, {3, {-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
// int -> INT32 map
{},
// int -> QUANT8_ASYMM map
diff --git a/nn/runtime/test/generated/examples/lstm2.example.cpp b/nn/runtime/test/generated/examples/lstm2.example.cpp
index 619cad0cd..7f1009482 100644
--- a/nn/runtime/test/generated/examples/lstm2.example.cpp
+++ b/nn/runtime/test/generated/examples/lstm2.example.cpp
@@ -13,7 +13,7 @@
//Output(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
- {{1, {0, 0, 0, 0}}, {2, {0, 0, 0, 0}}, {3, {-0.36444446f, -0.00352185f, 0.12886585f, -0.05163646f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ {{1, {-0.364445f, -0.00352185f, 0.128866f, -0.0516365f}}, {2, {-0.760444f, -0.0180416f, 0.182264f, -0.0649371f}}, {3, {-0.36444446f, -0.00352185f, 0.12886585f, -0.05163646f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
// int -> INT32 map
{},
// int -> QUANT8_ASYMM map
diff --git a/nn/runtime/test/generated/examples/lstm2_state.example.cpp b/nn/runtime/test/generated/examples/lstm2_state.example.cpp
new file mode 100644
index 000000000..ff9f90948
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm2_state.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm2_state.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {3.0f, 4.0f}}, {1, {}}, {2, {-0.55291498f, -0.42866567f, 0.13056988f, -0.3633365f, -0.22755712f, 0.28253698f, 0.24407166f, 0.33826375f}}, {3, {-0.49770179f, -0.27711356f, -0.09624726f, 0.05100781f, 0.04717243f, 0.48944736f, -0.38535351f, -0.17212132f}}, {4, {0.10725588f, -0.02335852f, -0.55932593f, -0.09426838f, -0.44257352f, 0.54939759f, 0.01533556f, 0.42751634f}}, {5, {}}, {6, {-0.13832897f, -0.0515101f, -0.2359007f, -0.16661474f, -0.14340827f, 0.36986142f, 0.23414481f, 0.55899f, 0.10798943f, -0.41174671f, 0.17751795f, -0.34484994f, -0.35874045f, -0.11352962f, 0.27268326f, 0.54058349f}}, {7, {0.54066205f, -0.32668582f, -0.43562764f, -0.56094903f, 0.42957711f, 0.01841056f, -0.32764608f, -0.33027974f, -0.10826075f, 0.20675004f, 0.19069612f, -0.03026325f, -0.54532051f, 0.33003211f, 0.44901288f, 0.21193194f}}, {8, {0.41613156f, 0.42610586f, -0.16495961f, -0.5663873f, 0.30579174f, -0.05115908f, -0.33941799f, 0.23364776f, 0.11178309f, 0.09481031f, -0.26424935f, 0.46261835f, 0.50248802f, 0.26114327f, -0.43736315f, 0.33149987f}}, {9, {}}, {10, {0.47485286f, -0.51955009f, -0.24458408f, 0.31544167f}}, {11, {-0.17135078f, 0.82760304f, 0.85573703f, -0.77109635f}}, {12, {}}, {13, {1.0f, 1.0f, 1.0f, 1.0f}}, {14, {0.0f, 0.0f, 0.0f, 0.0f}}, {15, {0.0f, 0.0f, 0.0f, 0.0f}}, {16, {}}, {17, {}}, {18, {-0.364445f, -0.00352185f, 0.128866f, -0.0516365f}}, {19, {-0.760444f, -0.0180416f, 0.182264f, -0.0649371f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {-0.423122f, -0.0121822f, 0.24201f, -0.0812458f}}, {2, {-0.978419f, -0.139203f, 0.338163f, -0.0983904f}}, {3, {-0.42312205f, -0.01218222f, 0.24201041f, -0.08124574f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/lstm2_state2.example.cpp b/nn/runtime/test/generated/examples/lstm2_state2.example.cpp
new file mode 100644
index 000000000..b49e6f627
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm2_state2.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm2_state2.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {1.0f, 1.0f}}, {1, {}}, {2, {-0.55291498f, -0.42866567f, 0.13056988f, -0.3633365f, -0.22755712f, 0.28253698f, 0.24407166f, 0.33826375f}}, {3, {-0.49770179f, -0.27711356f, -0.09624726f, 0.05100781f, 0.04717243f, 0.48944736f, -0.38535351f, -0.17212132f}}, {4, {0.10725588f, -0.02335852f, -0.55932593f, -0.09426838f, -0.44257352f, 0.54939759f, 0.01533556f, 0.42751634f}}, {5, {}}, {6, {-0.13832897f, -0.0515101f, -0.2359007f, -0.16661474f, -0.14340827f, 0.36986142f, 0.23414481f, 0.55899f, 0.10798943f, -0.41174671f, 0.17751795f, -0.34484994f, -0.35874045f, -0.11352962f, 0.27268326f, 0.54058349f}}, {7, {0.54066205f, -0.32668582f, -0.43562764f, -0.56094903f, 0.42957711f, 0.01841056f, -0.32764608f, -0.33027974f, -0.10826075f, 0.20675004f, 0.19069612f, -0.03026325f, -0.54532051f, 0.33003211f, 0.44901288f, 0.21193194f}}, {8, {0.41613156f, 0.42610586f, -0.16495961f, -0.5663873f, 0.30579174f, -0.05115908f, -0.33941799f, 0.23364776f, 0.11178309f, 0.09481031f, -0.26424935f, 0.46261835f, 0.50248802f, 0.26114327f, -0.43736315f, 0.33149987f}}, {9, {}}, {10, {0.47485286f, -0.51955009f, -0.24458408f, 0.31544167f}}, {11, {-0.17135078f, 0.82760304f, 0.85573703f, -0.77109635f}}, {12, {}}, {13, {1.0f, 1.0f, 1.0f, 1.0f}}, {14, {0.0f, 0.0f, 0.0f, 0.0f}}, {15, {0.0f, 0.0f, 0.0f, 0.0f}}, {16, {}}, {17, {}}, {18, {-0.423122f, -0.0121822f, 0.24201f, -0.0812458f}}, {19, {-0.978419f, -0.139203f, 0.338163f, -0.0983904f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {0, 0, 0, 0}}, {2, {0, 0, 0, 0}}, {3, {-0.358325f, -0.04621704f, 0.21641694f, -0.06471302f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/lstm3.example.cpp b/nn/runtime/test/generated/examples/lstm3.example.cpp
index 89d381479..c78dee690 100644
--- a/nn/runtime/test/generated/examples/lstm3.example.cpp
+++ b/nn/runtime/test/generated/examples/lstm3.example.cpp
@@ -13,7 +13,7 @@
//Output(s)
{ // See tools/test_generator/include/TestHarness.h:MixedTyped
// int -> FLOAT32 map
- {{1, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, {2, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, {3, {-0.00396806f, 0.029352f, -0.00279226f, 0.0159977f, -0.00835576f, -0.0211779f, 0.0283512f, -0.0114597f, 0.00907307f, -0.0244004f, -0.0152191f, -0.0259063f, 0.00914318f, 0.00415118f, 0.017147f, 0.0134203f, -0.013869f, 0.0287268f, -0.00334693f, 0.00733398f, -0.0287926f, -0.0186926f, 0.0193662f, -0.0115437f, 0.00422612f, -0.0345232f, 0.00223253f, -0.00957321f, 0.0210624f, 0.013331f, 0.0150954f, 0.02168f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ {{1, {-0.00396806f, 0.029352f, -0.00279226f, 0.0159977f, -0.00835577f, -0.0211779f, 0.0283512f, -0.0114597f, 0.00907307f, -0.0244004f, -0.0152191f, -0.0259063f, 0.00914318f, 0.00415119f, 0.017147f, 0.0134203f, -0.013869f, 0.0287268f, -0.00334694f, 0.00733397f, -0.0287926f, -0.0186926f, 0.0193662f, -0.0115437f, 0.00422612f, -0.0345232f, 0.00223253f, -0.00957321f, 0.0210624f, 0.013331f, 0.0150954f, 0.0216801f}}, {2, {-0.0531632f, -0.0118138f, 0.0870833f, 0.0347929f, -0.076144f, -0.0659219f, -0.0463811f, 0.0141307f, -0.0127706f, -0.03782f, -0.00402401f, -0.00571876f, -0.187957f, -0.0247127f, 0.0711425f, 0.008244f, 0.0492649f, 0.126972f, 0.0933097f, 0.29848f, -0.0966178f, -0.114417f, 0.0387229f, 0.0453255f, -0.181286f, -0.0651251f, -0.0996879f, -0.00276995f, 0.0617558f, -0.0100728f, 0.056304f, -0.077416f, -0.162858f, -0.0541251f, 0.0571202f, -0.0525331f, 0.0724297f, 0.171029f, 0.141738f, 0.295483f}}, {3, {-0.00396806f, 0.029352f, -0.00279226f, 0.0159977f, -0.00835576f, -0.0211779f, 0.0283512f, -0.0114597f, 0.00907307f, -0.0244004f, -0.0152191f, -0.0259063f, 0.00914318f, 0.00415118f, 0.017147f, 0.0134203f, -0.013869f, 0.0287268f, -0.00334693f, 0.00733398f, -0.0287926f, -0.0186926f, 0.0193662f, -0.0115437f, 0.00422612f, -0.0345232f, 0.00223253f, -0.00957321f, 0.0210624f, 0.013331f, 0.0150954f, 0.02168f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
// int -> INT32 map
{},
// int -> QUANT8_ASYMM map
diff --git a/nn/runtime/test/generated/examples/lstm3_state.example.cpp b/nn/runtime/test/generated/examples/lstm3_state.example.cpp
new file mode 100644
index 000000000..7f916759c
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm3_state.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm3_state.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {0.596268f, 0.998386f, 0.568695f, 0.864524f, 0.571277f, 0.642421f, 0.52426f, 0.134799f, 0.003639f, 0.162482f}}, {1, {0.021393683f, 0.06124551f, 0.046905167f, -0.014657677f, -0.03149463f, 0.09171803f, 0.14647801f, 0.10797193f, -0.0057968358f, 0.0019193048f, -0.2726754f, 0.10154029f, -0.018539885f, 0.080349885f, -0.10262385f, -0.022599787f, -0.09121155f, -0.008675967f, -0.045206103f, -0.0821282f, -0.008045952f, 0.015478081f, 0.055217247f, 0.038719587f, 0.044153627f, -0.06453243f, 0.05031825f, -0.046935108f, -0.008164439f, 0.014574226f, -0.1671009f, -0.15519552f, -0.16819797f, -0.13971269f, -0.11953059f, 0.25005487f, -0.22790983f, 0.009855087f, -0.028140958f, -0.11200698f, 0.11295408f, -0.0035217577f, 0.054485075f, 0.05184695f, 0.064711206f, 0.10989193f, 0.11674786f, 0.03490607f, 0.07727357f, 0.11390585f, -0.1863375f, -0.1034451f, -0.13945189f, -0.049401227f, -0.18767063f, 0.042483903f, 0.14233552f, 0.13832581f, 0.18350165f, 0.14545603f, -0.028545704f, 0.024939531f, 0.050929718f, 0.0076203286f, -0.0029723682f, -0.042484224f, -0.11827596f, -0.09171104f, -0.10808628f, -0.16327988f, -0.2273378f, -0.0993647f, -0.017155107f, 0.0023917493f, 0.049272764f, 0.0038534778f, 0.054764505f, 0.089753784f, 0.06947234f, 0.08014476f, -0.04544234f, -0.0497073f, -0.07135631f, -0.048929106f, -0.004042012f, -0.009284026f, 0.018042054f, 0.0036860977f, -0.07427302f, -0.11434604f, -0.018995456f, 0.031487543f, 0.012834908f, 0.019977754f, 0.044256654f, -0.39292613f, -0.18519334f, -0.11651281f, -0.06809892f, 0.011373677f}}, {2, {-0.0018401089f, -0.004852237f, 0.03698424f, 0.014181704f, 0.028273236f, -0.016726194f, -0.05249759f, -0.10204261f, 0.00861066f, -0.040979505f, -0.009899187f, 0.01923892f, -0.028177269f, -0.08535103f, -0.14585495f, 0.10662567f, -0.01909731f, -0.017883534f, -0.0047269356f, -0.045103323f, 0.0030784295f, 0.076784775f, 0.07463696f, 0.094531395f, 0.0814421f, -0.12257899f, -0.033945758f, -0.031303465f, 0.045630626f, 0.06843887f, -0.13492945f, -0.012480007f, -0.0811829f, -0.07224499f, -0.09628791f, 0.045100946f, 0.0012300825f, 0.013964662f, 0.099372394f, 0.02543059f, 0.06958324f, 0.034257296f, 0.0482646f, 0.06267997f, 0.052625068f, 0.12784666f, 0.07077897f, 0.025725935f, 0.04165009f, 0.07241905f, 0.018668644f, -0.037377294f, -0.06277783f, -0.08833636f, -0.040120605f, -0.011405586f, -0.007808335f, -0.010301386f, -0.005102167f, 0.027717464f, 0.05483423f, 0.11449111f, 0.11289652f, 0.10939839f, 0.13396506f, -0.08402166f, -0.01901462f, -0.044678304f, -0.07720565f, 0.014350063f, -0.11757958f, -0.0652038f, -0.08185733f, -0.076754324f, -0.092614375f, 0.10405491f, 0.052960336f, 0.035755895f, 0.035839386f, -0.012540553f, 0.036881298f, 0.02913376f, 0.03420159f, 0.05448447f, -0.054523353f, 0.02582715f, 0.02327355f, -0.011857179f, -0.0011980024f, -0.034641717f, -0.026125094f, -0.17582615f, -0.15923657f, -0.27486774f, -0.0006143371f, 0.0001771948f, -8.470171e-05f, 0.02651807f, 0.045790765f, 0.06956496f}}, {3, {-0.04580283f, -0.09549462f, -0.032418985f, -0.06454633f, -0.043528453f, 0.043018587f, -0.049152344f, -0.12418144f, -0.078985475f, -0.07596889f, 0.019484362f, -0.11434962f, -0.0074034138f, -0.06314844f, -0.092981495f, 0.0062155537f, -0.025034338f, -0.0028890965f, 0.048929527f, 0.06235075f, 0.10665918f, -0.032036792f, -0.08505916f, -0.10843358f, -0.13002433f, -0.036816437f, -0.02130134f, -0.016518239f, 0.0047691227f, -0.0025825808f, 0.066017866f, 0.029991534f, -0.10652836f, -0.1037554f, -0.13056071f, -0.03266643f, -0.033702414f, -0.006473424f, -0.04611692f, 0.014419339f, -0.025174323f, 0.0396852f, 0.081777506f, 0.06157468f, 0.10210095f, -0.009658194f, 0.046511717f, 0.03603906f, 0.0069369148f, 0.015960095f, -0.06507666f, 0.09551598f, 0.053568836f, 0.06408714f, 0.12835667f, -0.008714329f, -0.20211966f, -0.12093674f, 0.029450472f, 0.2849013f, -0.029227901f, 0.1164364f, -0.08560263f, 0.09941786f, -0.036999565f, -0.028842626f, -0.0033637602f, -0.017012902f, -0.09720865f, -0.11193351f, -0.029155117f, -0.017936034f, -0.009768936f, -0.04223324f, -0.036159635f, 0.06505112f, -0.021742892f, -0.023377212f, -0.07221364f, -0.06430552f, 0.05453865f, 0.091149814f, 0.06387331f, 0.007518393f, 0.055960953f, 0.069779344f, 0.046411168f, 0.10509911f, 0.07463894f, 0.0075130584f, 0.012850982f, 0.04555431f, 0.056955688f, 0.06555285f, 0.050801456f, -0.009862683f, 0.00826772f, -0.026555609f, -0.0073611983f, -0.0014897042f}}, {4, {-0.0998932f, -0.07201956f, -0.052803773f, -0.15629593f, -0.15001918f, -0.07650751f, 0.02359855f, -0.075155355f, -0.08037709f, -0.15093534f, 0.029517552f, -0.04751393f, 0.010350531f, -0.02664851f, -0.016839722f, -0.023121163f, 0.0077019283f, 0.012851257f, -0.05040649f, -0.0129761f, -0.021737747f, -0.038305793f, -0.06870586f, -0.01481247f, -0.001285394f, 0.10124236f, 0.083122835f, 0.053313006f, -0.062235646f, -0.075637154f, -0.027833903f, 0.029774971f, 0.1130802f, 0.09218906f, 0.09506135f, -0.086665764f, -0.037162706f, -0.038880914f, -0.035832845f, -0.014481564f, -0.09825003f, -0.12048569f, -0.097665586f, -0.05287633f, -0.0964047f, -0.11366429f, 0.035777505f, 0.13568819f, 0.052451383f, 0.050649304f, 0.05798951f, -0.021852335f, -0.099848844f, 0.014740475f, -0.078897946f, 0.04974699f, 0.014160473f, 0.06973932f, 0.04964942f, 0.033364646f, 0.08190124f, 0.025535367f, 0.050893165f, 0.048514254f, 0.06945813f, -0.078907564f, -0.06707616f, -0.11844508f, -0.09986688f, -0.07509403f, 0.06263226f, 0.14925587f, 0.20188436f, 0.12098451f, 0.14639415f, 0.0015017595f, -0.014267382f, -0.03417257f, 0.012711468f, 0.0028300495f, -0.024758482f, -0.05098548f, -0.0821182f, 0.014225672f, 0.021544158f, 0.08949725f, 0.07505268f, -0.0020780868f, 0.04908258f, 0.06476295f, -0.022907063f, 0.027562456f, 0.040185735f, 0.019567577f, -0.015598739f, -0.049097303f, -0.017121866f, -0.083368234f, -0.02332002f, -0.0840956f}}, {5, {-0.001374326f, -0.078856036f, 0.10672688f, 0.029162422f, -0.11585556f, 0.02557986f, -0.13446963f, -0.035785314f, -0.01244275f, 0.025961924f, -0.02337298f, -0.044228926f, -0.055839065f, -0.046598054f, -0.010546039f, -0.06900766f, 0.027239809f, 0.022582639f, -0.013296484f, -0.05459212f, 0.08981f, -0.045407712f, 0.08682226f, -0.06867011f, -0.14390695f, -0.02916037f, 0.000996957f, 0.091420636f, 0.14283475f, -0.07390571f, -0.06402044f, 0.062524505f, -0.093129106f, 0.04860203f, -0.08364217f, -0.08119002f, 0.009352075f, 0.22920375f, 0.0016303885f, 0.11583097f, -0.13732095f, 0.012405723f, -0.07551853f, 0.06343048f, 0.12162708f, -0.031923793f, -0.014335606f, 0.01790974f, -0.10650317f, -0.0724401f, 0.08554849f, -0.05727212f, 0.06556731f, -0.042729504f, -0.043227166f, 0.011683251f, -0.013082158f, -0.029302018f, -0.010899579f, -0.062036745f, -0.022509435f, -0.00964907f, -0.01567329f, 0.04260106f, -0.07787477f, -0.11576462f, 0.017356863f, 0.048673786f, -0.017577527f, -0.05527947f, -0.082487635f, -0.040137455f, -0.10820036f, -0.04666372f, 0.022746278f, -0.07851417f, 0.01068115f, 0.032956902f, 0.022433773f, 0.0026891115f, 0.08944216f, -0.0685835f, 0.010513544f, 0.07228705f, 0.02032331f, -0.059686817f, -0.0005566496f, -0.086984694f, 0.040414046f, -0.1380399f, 0.094208956f, -0.05722982f, 0.012092817f, -0.04989123f, -0.086576f, -0.003399834f, -0.04696032f, -0.045747425f, 0.10091314f, 0.048676282f, -0.029037097f, 0.031399418f, -0.0040285117f, 0.047237843f, 0.09504992f, 0.041799378f, -0.049185462f, -0.031518843f, -0.10516937f, 0.026374253f, 0.10058866f, -0.0033195973f, -0.041975245f, 0.0073591834f, 0.0033782164f, -0.004325073f, -0.10167381f, 0.042500053f, -0.01447153f, 0.06464186f, -0.017142897f, 0.03312627f, 0.009205989f, 0.024138335f, -0.011337001f, 0.035530265f, -0.010912711f, 0.0706555f, -0.005894094f, 0.051841937f, -0.1401738f, -0.02351249f, 0.0365468f, 0.07590991f, 0.08838724f, 0.021681072f, -0.10086113f, 0.019608743f, -0.06195883f, 0.077335775f, 0.023646897f, -0.095322326f, 0.02233014f, 0.09756986f, -0.048691444f, -0.009579111f, 0.07595467f, 0.11480546f, -0.09801813f, 0.019894179f, 0.08502348f, 0.004032281f, 0.037211012f, 0.068537936f, -0.048005626f, -0.091520436f, -0.028379958f, -0.01556313f, 0.06554592f, -0.045599163f, -0.01672207f, -0.020169014f, -0.011877351f, -0.20212261f, 0.010889619f, 0.0047078193f, 0.038385306f, 0.08540671f, -0.017140968f, -0.0035865551f, 0.016678626f, 0.005633034f, 0.015963363f, 0.00871737f, 0.060130805f, 0.028611384f, 0.10109069f, -0.015060172f, -0.07894427f, 0.06401885f, 0.011584063f, -0.024466386f, 0.0047652307f, -0.09041358f, 0.030737216f, -0.0046374933f, 0.14215417f, -0.11823516f, 0.019899689f, 0.006106124f, -0.027092824f, 0.0786356f, 0.05052217f, -0.058925f, -0.011402121f, -0.024987547f, -0.0013661642f, -0.06832946f, -0.015667673f, -0.1083353f, -0.00096863037f, -0.06988685f, -0.053350925f, -0.027275559f, -0.033664223f, -0.07978348f, -0.025200296f, -0.017207067f, -0.058403496f, -0.055697463f, 0.005798788f, 0.12965427f, -0.062582195f, 0.0013350133f, -0.10482091f, 0.0379771f, 0.072521195f, -0.0029455067f, -0.13797039f, -0.03628521f, 0.013806405f, -0.017858358f, -0.01008298f, -0.07700066f, -0.017081132f, 0.019358726f, 0.0027079724f, 0.004635139f, 0.062634714f, -0.02338735f, -0.039547626f, -0.02050681f, 0.03385117f, -0.083611414f, 0.002862572f, -0.09421313f, 0.058618143f, -0.08598433f, 0.00972939f, 0.023867095f, -0.053934585f, -0.023203006f, 0.07452513f, -0.048767887f, -0.07314807f, -0.056307215f, -0.10433547f, -0.06440842f, 0.04328182f, 0.04389765f, -0.020006588f, -0.09076438f, -0.11652589f, -0.021705797f, 0.03345259f, -0.010329105f, -0.025767034f, 0.013057034f, -0.07316461f, -0.10145612f, 0.06358255f, 0.18531723f, 0.07759293f, 0.12006465f, 0.1305557f, 0.058638252f, -0.03393652f, 0.09622831f, -0.16253184f, -2.4580743e-06f, 0.079869635f, -0.070196845f, -0.005644518f, 0.06857898f, -0.12598175f, -0.035084512f, 0.03156317f, -0.12794146f, -0.031963028f, 0.04692781f, 0.030070418f, 0.0071660685f, -0.095516115f, -0.004643372f, 0.040170413f, -0.062104587f, -0.0037324072f, 0.0554317f, 0.08184801f, -0.019164372f, 0.06791302f, 0.034257166f, -0.10307039f, 0.021943003f, 0.046745934f, 0.0790918f, -0.0265588f, -0.007824208f, 0.042546265f, -0.00977924f, -0.0002440307f, -0.017384544f, -0.017990116f, 0.12252321f, -0.014512694f, -0.08251313f, 0.08861942f, 0.13589665f, 0.026351685f, 0.012641483f, 0.07466548f, 0.044301085f, -0.045414884f, -0.051112458f, 0.03444247f, -0.08502782f, -0.04106223f, -0.028126027f, 0.028473156f, 0.10467447f}}, {6, {-0.057784554f, -0.026057621f, -0.068447545f, -0.022581743f, 0.14811787f, 0.10826372f, 0.09471067f, 0.03987225f, -0.0039523416f, 0.00030638507f, 0.053185795f, 0.10572994f, 0.08414449f, -0.022036452f, -0.00066928595f, -0.09203576f, 0.032950465f, -0.10985798f, -0.023809856f, 0.0021431844f, -0.02196096f, -0.00326074f, 0.00058621005f, -0.074678116f, -0.06193199f, 0.055729095f, 0.03736828f, 0.020123724f, 0.061878487f, -0.04729229f, 0.034919553f, -0.07585433f, -0.04421272f, -0.044019096f, 0.085488975f, 0.04058006f, -0.06890133f, -0.030951202f, -0.024628663f, -0.07672815f, 0.034293607f, 0.08556707f, -0.05293577f, -0.033561368f, -0.04899627f, 0.0241671f, 0.015736353f, -0.095442444f, -0.029564252f, 0.016493602f, -0.035026584f, 0.022337519f, -0.026871363f, 0.004780428f, 0.0077918363f, -0.03601621f, 0.016435321f, -0.03263031f, -0.09543275f, -0.047392778f, 0.013454138f, 0.028934088f, 0.01685226f, -0.086110644f, -0.046250615f, -0.01847454f, 0.047608484f, 0.07339695f, 0.034546845f, -0.04881143f, 0.009128804f, -0.08802852f, 0.03761666f, 0.008096139f, -0.014454086f, 0.014361001f, -0.023502491f, -0.0011840804f, -0.07607001f, 0.001856849f, -0.06509276f, -0.006021153f, -0.08570962f, -0.1451793f, 0.060212336f, 0.055259194f, 0.06974018f, 0.049454916f, -0.027794661f, -0.08077226f, -0.016179763f, 0.1169753f, 0.17213494f, -0.0056326236f, -0.053934924f, -0.0124349f, -0.11520337f, 0.05409887f, 0.088759385f, 0.0019655675f, 0.0042065294f, 0.03881498f, 0.019844765f, 0.041858196f, -0.05695512f, 0.047233116f, 0.038937137f, -0.06542224f, 0.014429736f, -0.09719407f, 0.13908425f, -0.05379757f, 0.012321099f, 0.082840554f, -0.029899208f, 0.044217527f, 0.059855383f, 0.07711018f, -0.045319796f, 0.0948846f, -0.011724666f, -0.0033288454f, -0.033542685f, -0.04764985f, -0.13873616f, 0.040668588f, 0.034832682f, -0.015319203f, -0.018715994f, 0.046002675f, 0.0599172f, -0.043107376f, 0.0294216f, -0.002314414f, -0.022424703f, 0.0030315618f, 0.0014641669f, 0.0029166266f, -0.11878115f, 0.013738511f, 0.12375372f, -0.0006038222f, 0.029104086f, 0.087442465f, 0.052958444f, 0.07558703f, 0.04817258f, 0.044462286f, -0.015213451f, -0.08783778f, -0.0561384f, -0.003008196f, 0.047060397f, -0.002058388f, 0.03429439f, -0.018839769f, 0.024734668f, 0.024614193f, -0.042046934f, 0.09597743f, -0.0043254104f, 0.04320769f, 0.0064070094f, -0.0019131786f, -0.02558259f, -0.022822596f, -0.023273505f, -0.02464396f, -0.10991725f, -0.006240552f, 0.0074488563f, 0.024044557f, 0.04383914f, -0.046476185f, 0.028658995f, 0.060410924f, 0.050786525f, 0.009452605f, -0.0073054377f, -0.024810238f, 0.0052906186f, 0.0066939713f, -0.0020913032f, 0.014515517f, 0.015898481f, 0.021362653f, -0.030262267f, 0.016587038f, -0.011442813f, 0.041154444f, -0.007631438f, -0.03423484f, -0.010977775f, 0.036152758f, 0.0066366293f, 0.11915515f, 0.02318443f, -0.041350313f, 0.021485701f, -0.10906167f, -0.028218046f, -0.00954771f, 0.020531068f, -0.11995105f, -0.03672871f, 0.024019798f, 0.014255957f, -0.05221243f, -0.00661567f, -0.04630967f, 0.033188973f, 0.10107534f, -0.014027541f, 0.030796422f, -0.10270911f, -0.035999842f, 0.15443139f, 0.07684145f, 0.036571592f, -0.035900835f, -0.0034699554f, 0.06209149f, 0.015920248f, -0.031122351f, -0.03858649f, 0.01849943f, 0.13872518f, 0.01503974f, 0.069941424f, -0.06948533f, -0.0088794185f, 0.061282158f, -0.047401894f, 0.03100163f, -0.041533746f, -0.10430945f, 0.044574402f, -0.01425562f, -0.024290353f, 0.034563623f, 0.05866852f, 0.023947537f, -0.09445152f, 0.035450947f, 0.02247216f, -0.0042998926f, 0.061146557f, -0.10250651f, 0.020881841f, -0.06747029f, 0.10062043f, -0.0023941975f, 0.03532124f, -0.016341697f, 0.09685456f, -0.016764693f, 0.051808182f, 0.05875331f, -0.04536488f, 0.001626336f, -0.028892258f, -0.01048663f, -0.009793449f, -0.017093895f, 0.010987891f, 0.02357273f, -0.00010856845f, 0.0099760275f, -0.001845119f, -0.03551521f, 0.0018358806f, 0.05763657f, -0.01769146f, 0.040995963f, 0.02235177f, -0.060430344f, 0.11475477f, -0.023854522f, 0.10071741f, 0.0686208f, -0.014250481f, 0.034261297f, 0.047418304f, 0.08562733f, -0.030519066f, 0.0060542435f, 0.014653856f, -0.038836084f, 0.04096551f, 0.032249358f, -0.08355519f, -0.026823482f, 0.056386515f, -0.010401743f, -0.028396193f, 0.08507674f, 0.014410365f, 0.020995233f, 0.17040324f, 0.11511526f, 0.02459721f, 0.0066619175f, 0.025853224f, -0.023133837f, -0.081302024f, 0.017264642f, -0.009585969f, 0.09491168f, -0.051313367f, 0.054532815f, -0.014298593f, 0.10657464f, 0.007076659f, 0.10964551f, 0.0409152f, 0.008275321f, -0.07283536f, 0.07937492f, 0.04192024f, -0.1075027f}}, {7, {-0.037322544f, 0.018592842f, 0.0056175636f, -0.06253426f, 0.055647098f, -0.05713207f, -0.05626563f, 0.005559383f, 0.03375411f, -0.025757805f, -0.088049285f, 0.06017052f, -0.06570978f, 0.007384076f, 0.035123326f, -0.07920549f, 0.053676967f, 0.044480428f, -0.07663568f, 0.0071805613f, 0.08089997f, 0.05143358f, 0.038261272f, 0.03339287f, -0.027673481f, 0.044746667f, 0.028349208f, 0.020090483f, -0.019443132f, -0.030755889f, -0.0040000007f, 0.04465846f, -0.021585021f, 0.0031670958f, 0.0053199246f, -0.056117613f, -0.10893326f, 0.076739706f, -0.08509834f, -0.027997585f, 0.037871376f, 0.01449768f, -0.09002357f, -0.06111149f, -0.046195522f, 0.0422062f, -0.005683705f, -0.1253618f, -0.012925729f, -0.04890792f, 0.06985068f, 0.037654128f, 0.03398274f, -0.004781977f, 0.007032333f, -0.031787455f, 0.010868644f, -0.031489216f, 0.09525667f, 0.013939797f, 0.0058680447f, 0.0167067f, 0.02668468f, -0.04797466f, -0.048885044f, -0.12722108f, 0.035304096f, 0.06554885f, 0.00972396f, -0.039238118f, -0.05159735f, -0.11329045f, 0.1613692f, -0.03750952f, 0.06529313f, -0.071974665f, -0.11769596f, 0.015524369f, -0.0013754242f, -0.12446318f, 0.02786344f, -0.014179351f, 0.005264273f, 0.14376344f, 0.015983658f, 0.03406988f, -0.06939408f, 0.040699873f, 0.02111075f, 0.09669095f, 0.041345075f, -0.08316494f, -0.07684199f, -0.045768797f, 0.032298047f, -0.041805092f, 0.0119405f, 0.0061010392f, 0.12652606f, 0.0064572375f, -0.024950314f, 0.11574242f, 0.04508852f, -0.04335324f, 0.06760663f, -0.027437469f, 0.07216407f, 0.06977076f, -0.05438599f, 0.034033038f, -0.028602652f, 0.05346137f, 0.043184172f, -0.037189785f, 0.10420091f, 0.00882477f, -0.054019816f, -0.074273005f, -0.030617684f, -0.0028467078f, 0.024302477f, -0.0038869337f, 0.005332455f, 0.0013399826f, 0.04361412f, -0.007001822f, 0.09631092f, -0.06702025f, -0.042049985f, -0.035070654f, -0.04103342f, -0.10273396f, 0.0544271f, 0.037184782f, -0.13150354f, -0.0058036847f, -0.008264958f, 0.042035464f, 0.05891794f, 0.029673764f, 0.0063542654f, 0.044788733f, 0.054816857f, 0.062257513f, -0.00093483756f, 0.048938446f, -0.004952862f, -0.007730018f, -0.04043371f, -0.017094059f, 0.07229206f, -0.023670016f, -0.052195564f, -0.025616996f, -0.01520939f, 0.045104615f, -0.007376126f, 0.003533447f, 0.006570588f, 0.056037236f, 0.12436656f, 0.051817212f, 0.028532185f, -0.08686856f, 0.11868599f, 0.07663395f, -0.07323171f, 0.03463402f, -0.050708205f, -0.04458982f, -0.11590894f, 0.021273347f, 0.1251325f, -0.15313013f, -0.12224372f, 0.17228661f, 0.023029093f, 0.086124025f, 0.006445803f, -0.03496501f, 0.028332196f, 0.04449512f, -0.042436164f, -0.026587414f, -0.006041347f, -0.09292539f, -0.05678812f, 0.03897832f, 0.09465633f, 0.008115513f, -0.02171956f, 0.08304309f, 0.071401566f, 0.019622514f, 0.032163795f, -0.004167056f, 0.02295182f, 0.030739572f, 0.056506045f, 0.004612461f, 0.06524936f, 0.059999723f, 0.046395954f, -0.0045512207f, -0.1335546f, -0.030136576f, 0.11584653f, -0.014678886f, 0.0020118146f, -0.09688814f, -0.0790206f, 0.039770417f, -0.0329582f, 0.07922767f, 0.029322514f, 0.026405897f, 0.04207835f, -0.07073373f, 0.063781224f, 0.0859677f, -0.10925287f, -0.07011058f, 0.048005477f, 0.03438226f, -0.09606514f, -0.006669445f, -0.043381985f, 0.04240257f, -0.06955775f, -0.06769346f, 0.043903265f, -0.026784198f, -0.017840602f, 0.024307009f, -0.040079936f, -0.019946516f, 0.045318738f, -0.12233574f, 0.026170589f, 0.0074471775f, 0.15978073f, 0.10185836f, 0.10298046f, -0.015476589f, -0.039390966f, -0.072174534f, 0.0739445f, -0.1211869f, -0.0347889f, -0.07943156f, 0.014809798f, -0.12412325f, -0.0030663363f, 0.039695457f, 0.0647603f, -0.08291318f, -0.018529687f, -0.004423833f, 0.0037507233f, 0.084633216f, -0.01514876f, -0.056505352f, -0.012800942f, -0.06994386f, 0.012962922f, -0.031234352f, 0.07029052f, 0.016418684f, 0.03618972f, 0.055686004f, -0.08663945f, -0.017404709f, -0.054761406f, 0.029065743f, 0.052404847f, 0.020238016f, 0.0048197987f, -0.0214882f, 0.07078733f, 0.013016777f, 0.06262858f, 0.009184685f, 0.020785125f, -0.043904778f, -0.0270329f, -0.03299152f, -0.060088247f, -0.015162964f, -0.001828936f, 0.12642565f, -0.056757294f, 0.013586685f, 0.09232601f, -0.035886683f, 0.06000002f, 0.05229691f, -0.052580316f, -0.082029596f, -0.010794592f, 0.012947712f, -0.036429964f, -0.085508935f, -0.13127148f, -0.017744139f, 0.031502828f, 0.036232427f, -0.031581745f, 0.023051167f, -0.05325106f, -0.03421577f, 0.028793324f, -0.034633752f, -0.009881397f, -0.043551125f, -0.018609839f, 0.0019097115f, -0.008799762f, 0.056595087f, 0.0022273948f, 0.055752404f}}, {8, {0.025825322f, -0.05813119f, 0.09495884f, -0.045984812f, -0.01255415f, -0.0026479573f, -0.08196161f, -0.054914974f, -0.0046604523f, -0.029587349f, -0.044576716f, -0.07480124f, -0.082868785f, 0.023254942f, 0.027502948f, -0.0039728214f, -0.08683098f, -0.08116779f, -0.014675607f, -0.037924774f, -0.023314456f, -0.007401714f, -0.09255757f, 0.029460307f, -0.08829125f, -0.005139627f, -0.08989442f, -0.0555066f, 0.13596267f, -0.025062224f, -0.048351806f, -0.03850004f, 0.07266485f, -0.022414139f, 0.05940088f, 0.075114764f, 0.09597592f, -0.010211725f, -0.0049794707f, -0.011523867f, -0.025980417f, 0.072999895f, 0.11091378f, -0.081685916f, 0.014416728f, 0.043229222f, 0.034178585f, -0.07530371f, 0.035837382f, -0.085607f, -0.007721233f, -0.03287832f, -0.043848954f, -0.06404588f, -0.06632928f, -0.073643476f, 0.008214239f, -0.045984086f, 0.039764922f, 0.03474462f, 0.060612556f, -0.080590084f, 0.049127717f, 0.04151091f, -0.030063879f, 0.008801774f, -0.023021035f, -0.019558564f, 0.05158114f, -0.010947698f, -0.011825728f, 0.0075720972f, 0.0699727f, -0.0039981045f, 0.069350146f, 0.08799282f, 0.016156472f, 0.035502106f, 0.11695009f, 0.006217345f, 0.13392477f, -0.037875112f, 0.025745004f, 0.08940699f, -0.00924166f, 0.0046702605f, -0.036598757f, -0.08811812f, 0.10522024f, -0.032441203f, 0.008176899f, -0.04454919f, 0.07058152f, 0.0067963637f, 0.039206743f, 0.03259838f, 0.03725492f, -0.09515802f, 0.013326398f, -0.052055415f, -0.025676316f, 0.03198509f, -0.015951829f, -0.058556724f, 0.036879618f, 0.043357447f, 0.028362012f, -0.05908629f, 0.0059240665f, -0.04995891f, -0.019187413f, 0.0276265f, -0.01628143f, 0.0025863599f, 0.08800015f, 0.035250366f, -0.022165963f, -0.07328642f, -0.009415526f, -0.07455109f, 0.11690406f, 0.0363299f, 0.07411125f, 0.042103454f, -0.009660886f, 0.019076364f, 0.018299393f, -0.046004917f, 0.08891175f, 0.0431396f, -0.026327137f, -0.051502608f, 0.08979574f, -0.051670972f, 0.04940282f, -0.07491107f, -0.021240504f, 0.022596184f, -0.034280192f, 0.060163025f, -0.058211457f, -0.051837247f, -0.01349775f, -0.04639988f, -0.035936575f, -0.011681591f, 0.064818054f, 0.0073146066f, -0.021745546f, -0.043124277f, -0.06471268f, -0.07053354f, -0.029321948f, -0.05330136f, 0.016933719f, -0.053782392f, 0.13747959f, -0.1361751f, -0.11569455f, 0.0033329215f, 0.05693899f, -0.053219706f, 0.063698f, 0.07977434f, -0.07924483f, 0.06936997f, 0.0034815092f, -0.007305279f, -0.037325785f, -0.07251102f, -0.033633437f, -0.08677009f, 0.091591336f, -0.14165086f, 0.021752775f, 0.019683983f, 0.0011612234f, -0.058154266f, 0.049996935f, 0.0288841f, -0.0024567875f, -0.14345716f, 0.010955264f, -0.10234828f, 0.1183656f, -0.0010731248f, -0.023590032f, -0.072285876f, -0.0724771f, -0.026382286f, -0.0014920527f, 0.042667855f, 0.0018776858f, 0.02986552f, 0.009814309f, 0.0733756f, 0.12289186f, 0.018043943f, -0.0458958f, 0.049412545f, 0.033632483f, 0.05495232f, 0.036686596f, -0.013781798f, -0.010036754f, 0.02576849f, -0.08307328f, 0.010112348f, 0.042521734f, -0.05869831f, -0.071689695f, 0.03876447f, -0.13275425f, -0.0352966f, -0.023077697f, 0.10285965f, 0.084736146f, 0.15568255f, -0.00040734606f, 0.027835453f, -0.10292561f, -0.032401145f, 0.10053256f, -0.026142767f, -0.08271222f, -0.0030240538f, -0.016368777f, 0.1070414f, 0.042672627f, 0.013456989f, -0.0437609f, -0.022309763f, 0.11576483f, 0.04108048f, 0.061026827f, -0.0190714f, -0.0869359f, 0.037901703f, 0.0610107f, 0.07202949f, 0.01675338f, 0.086139716f, -0.08795751f, -0.014898893f, -0.023771819f, -0.01965048f, 0.007955471f, -0.043740474f, 0.03346837f, -0.10549954f, 0.090567775f, 0.042013682f, -0.03176985f, 0.12569028f, -0.02421228f, -0.029526481f, 0.023851605f, 0.031539805f, 0.05292009f, -0.02344001f, -0.07811758f, -0.08834428f, 0.10094801f, 0.16594367f, -0.06861939f, -0.021256343f, -0.041093912f, -0.06669611f, 0.035498552f, 0.021757556f, -0.09302526f, -0.015403468f, -0.06614931f, -0.051798206f, -0.013874718f, 0.03630673f, 0.010412845f, -0.08077351f, 0.046185967f, 0.0035662893f, 0.03541868f, -0.094149634f, -0.034814864f, 0.003128424f, -0.020674974f, -0.03944324f, -0.008110165f, -0.11113267f, 0.08484226f, 0.043586485f, 0.040582247f, 0.0968012f, -0.065249965f, -0.028036479f, 0.0050708856f, 0.0017462453f, 0.0326779f, 0.041296225f, 0.09164146f, -0.047743853f, -0.015952192f, -0.034451712f, 0.084197424f, -0.05347844f, -0.11768019f, 0.085926116f, -0.08251791f, -0.045081906f, 0.0948852f, 0.068401024f, 0.024856757f, 0.06978981f, -0.057309967f, -0.012775832f, -0.0032452994f, 0.01977615f, -0.041040014f, -0.024264973f, 0.063464895f, 0.05431621f}}, {9, {0.040369894f, 0.030746894f, 0.24704495f, 0.018586371f, -0.037586458f, -0.15312155f, -0.11812848f, -0.11465643f, 0.20259799f, 0.11418174f, -0.10116027f, -0.011334949f, 0.12411352f, -0.076769054f, -0.052169047f, 0.21198851f, -0.38871562f, -0.09061183f, -0.09683246f, -0.21929175f}}, {10, {-0.01998659f, -0.15568835f, -0.24248174f, -0.012770197f, 0.041331276f, -0.072311886f, -0.052123554f, -0.0066330447f, -0.043891653f, 0.036225766f, -0.047248036f, 0.021479502f, 0.033189066f, 0.11952997f, -0.020432774f, 0.64658105f, -0.06650122f, -0.03467612f, 0.095340036f, 0.23647355f}}, {11, {0.08286371f, -0.08261836f, -0.51210177f, 0.002913762f, 0.17764764f, -0.5495371f, -0.08460716f, -0.24552552f, 0.030037103f, 0.04123544f, -0.11940523f, 0.007358328f, 0.1890978f, 0.4833202f, -0.34441817f, 0.36312827f, -0.26375428f, 0.1457655f, -0.19724406f, 0.15548733f}}, {12, {0.02234832f, 0.14757581f, 0.18176508f, 0.10380666f, 0.053110216f, -0.06928846f, -0.13942584f, -0.11816189f, 0.19483899f, 0.03652339f, -0.10250295f, 0.036714908f, -0.18426876f, 0.036065217f, 0.21810818f, 0.02383196f, -0.043370757f, 0.08690144f, -0.04444982f, 0.00030581196f}}, {13, {0.035185695f, -0.042891346f, -0.03032477f, 0.23027696f, 0.11098921f, 0.15378423f, 0.09263801f, 0.09790885f, 0.09508917f, 0.061199076f, 0.07665568f, -0.015443159f, -0.03499149f, 0.046190713f, 0.08895977f, 0.10899629f, 0.40694186f, 0.06030037f, 0.012413437f, -0.06108739f}}, {14, {-0.024379363f, 0.0055531194f, 0.23377132f, 0.033463873f, -0.1483596f, -0.10639995f, -0.091433935f, 0.058573797f, -0.06809782f, -0.07889636f, -0.043246906f, -0.09829136f, -0.4279842f, 0.034901652f, 0.18797937f, 0.0075234566f, 0.016178843f, 0.1749513f, 0.13975595f, 0.92058027f}}, {15, {0.046159424f, -0.0012809046f, 0.03563469f, 0.12648113f, 0.027195795f, 0.35373217f, -0.018957434f, 0.008907322f, -0.0762701f, 0.12018895f, 0.04216877f, 0.0022856654f, 0.040952638f, 0.3147856f, 0.08225149f, -0.057416286f, -0.14995944f, -0.008040261f, 0.13208859f, 0.029760877f}}, {16, {-0.009802181f, 0.09401916f, 0.0717386f, -0.13895074f, 0.09641832f, 0.060420845f, 0.08539281f, 0.054285463f, 0.061395317f, 0.034448683f, -0.042991187f, 0.019801661f, -0.16840284f, -0.015726732f, -0.23041931f, -0.024478018f, -0.10959692f, -0.013875541f, 0.18600968f, -0.061274476f, 0.0138165f, -0.08160894f, -0.07661644f, 0.032372914f, 0.16169067f, 0.22465782f, -0.03993472f, -0.004017731f, 0.08633481f, -0.28869787f, 0.08682067f, 0.17240396f, 0.014975425f, 0.056431185f, 0.031037588f, 0.16702051f, 0.0077946745f, 0.15140012f, 0.29405436f, 0.120285f, -0.188994f, -0.027265169f, 0.043389652f, -0.022061434f, 0.014777949f, -0.20203483f, 0.094781205f, 0.19100232f, 0.13987629f, -0.036132768f, -0.06426278f, -0.05108664f, 0.13221376f, 0.009441198f, -0.16715929f, 0.15859416f, -0.040437475f, 0.050779544f, -0.022187516f, 0.012166504f, 0.027685808f, -0.07675938f, -0.0055694645f, -0.09444123f, 0.0046453946f, 0.050794356f, 0.10770313f, -0.20790008f, -0.07149004f, -0.11425117f, 0.008225835f, -0.035802525f, 0.14374903f, 0.15262283f, 0.048710253f, 0.1847461f, -0.007487823f, 0.11000021f, -0.09542012f, 0.22619456f, -0.029149994f, 0.08527916f, 0.009043713f, 0.0042746216f, 0.016261552f, 0.022461696f, 0.12689082f, -0.043589946f, -0.12035478f, -0.08361797f, -0.050666027f, -0.1248618f, -0.1275799f, -0.071875185f, 0.07377272f, 0.09944291f, -0.18897448f, -0.1593054f, -0.06526116f, -0.040107165f, -0.004618631f, -0.067624845f, -0.007576253f, 0.10727444f, 0.041546922f, -0.20424393f, 0.06907816f, 0.050412357f, 0.00724631f, 0.039827548f, 0.12449835f, 0.10747581f, 0.13708383f, 0.09134148f, -0.12617786f, -0.06428341f, 0.09956831f, 0.1208086f, -0.14676677f, -0.0727722f, 0.1126304f, 0.010139365f, 0.015571211f, -0.038128063f, 0.022913318f, -0.042050496f, 0.16842307f, -0.060597885f, 0.10531834f, -0.06411776f, -0.07451711f, -0.03410368f, -0.13393489f, 0.06534304f, 0.003620307f, 0.04490757f, 0.05970546f, 0.05197996f, 0.02839995f, 0.10434969f, -0.013699693f, -0.028353551f, -0.07260381f, 0.047201227f, -0.024575593f, -0.036445823f, 0.07155557f, 0.009672501f, -0.02328883f, 0.009533515f, -0.03606021f, -0.07421458f, -0.028082801f, -0.2678904f, -0.13221288f, 0.18419984f, -0.13012612f, -0.014588381f, -0.035059117f, -0.04824723f, 0.07830115f, -0.056184657f, 0.03277091f, 0.025466874f, 0.14494097f, -0.12522776f, -0.098633975f, -0.10766018f, -0.08317623f, 0.08594209f, 0.07749552f, 0.039474737f, 0.1776665f, -0.07409566f, -0.0477268f, 0.29323658f, 0.10801441f, 0.1154011f, 0.013952499f, 0.10739139f, 0.10708251f, -0.051456142f, 0.0074137426f, -0.10430189f, 0.10034707f, 0.045594677f, 0.0635285f, -0.0715442f, -0.089667566f, -0.10811871f, 0.00026344223f, 0.08298446f, -0.009525053f, 0.006585689f, -0.24567553f, -0.09450807f, 0.09648481f, 0.026996298f, -0.06419476f, -0.04752702f, -0.11063944f, -0.23441927f, -0.17608605f, -0.052156363f, 0.067035615f, 0.19271925f, -0.0032889997f, -0.043264326f, 0.09663576f, -0.057112187f, -0.10100678f, 0.0628376f, 0.04447668f, 0.017961001f, -0.10094388f, -0.10190601f, 0.18335468f, 0.10494553f, -0.052095775f, -0.0026118709f, 0.10539724f, -0.04383912f, -0.042349473f, 0.08438151f, -0.1947263f, 0.02251204f, 0.11216432f, -0.10307853f, 0.17351969f, -0.039091777f, 0.08066188f, -0.00561982f, 0.12633002f, 0.11335965f, -0.0088127935f, -0.019777594f, 0.06864014f, -0.059751723f, 0.016233567f, -0.06894641f, -0.28651384f, -0.004228674f, 0.019708522f, -0.16305895f, -0.07468996f, -0.0855457f, 0.099339016f, -0.07580735f, -0.13775392f, 0.08434318f, 0.08330512f, -0.12131499f, 0.031935584f, 0.09180414f, -0.08876437f, -0.08049874f, 0.008753825f, 0.03498998f, 0.030215185f, 0.03907079f, 0.089751154f, 0.029194152f, -0.03337423f, -0.019092513f, 0.04331237f, 0.04299654f, -0.036394123f, -0.12915532f, 0.09793732f, 0.07512415f, -0.11319543f, -0.032502122f, 0.15661901f, 0.07671967f, -0.005491124f, -0.19379048f, -0.218606f, 0.21448623f, 0.017840758f, 0.1416943f, -0.07051762f, 0.19488361f, 0.02664691f, -0.18104725f, -0.09334311f, 0.15026465f, -0.15493552f, -0.057762887f, -0.11604192f, -0.262013f, -0.01391798f, 0.012185008f, 0.11156489f, -0.07483202f, 0.06693364f, -0.26151478f, 0.046425626f, 0.036540434f, -0.16435726f, 0.17338543f, -0.21401681f, -0.11385144f, -0.08283257f, -0.069031075f, 0.030635102f, 0.010969227f, 0.11109743f, 0.010919218f, 0.027526086f, 0.13519906f, 0.01891392f, -0.046839405f, -0.040167913f, 0.017953383f, -0.09700955f, 0.0061885654f, -0.07000971f, 0.026893595f, -0.038844477f, 0.14543656f}}, {17, {}}, {18, {-0.00396806f, 0.029352f, -0.00279226f, 0.0159977f, -0.00835577f, -0.0211779f, 0.0283512f, -0.0114597f, 0.00907307f, -0.0244004f, -0.0152191f, -0.0259063f, 0.00914318f, 0.00415119f, 0.017147f, 0.0134203f, -0.013869f, 0.0287268f, -0.00334694f, 0.00733397f, -0.0287926f, -0.0186926f, 0.0193662f, -0.0115437f, 0.00422612f, -0.0345232f, 0.00223253f, -0.00957321f, 0.0210624f, 0.013331f, 0.0150954f, 0.0216801f}}, {19, {-0.0531632f, -0.0118138f, 0.0870833f, 0.0347929f, -0.076144f, -0.0659219f, -0.0463811f, 0.0141307f, -0.0127706f, -0.03782f, -0.00402401f, -0.00571876f, -0.187957f, -0.0247127f, 0.0711425f, 0.008244f, 0.0492649f, 0.126972f, 0.0933097f, 0.29848f, -0.0966178f, -0.114417f, 0.0387229f, 0.0453255f, -0.181286f, -0.0651251f, -0.0996879f, -0.00276995f, 0.0617558f, -0.0100728f, 0.056304f, -0.077416f, -0.162858f, -0.0541251f, 0.0571202f, -0.0525331f, 0.0724297f, 0.171029f, 0.141738f, 0.295483f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {-0.0166936f, 0.0381209f, 0.000889684f, 0.0143363f, -0.0328911f, -0.0234288f, 0.0333051f, -0.012229f, 0.0110322f, -0.0457725f, -0.000832209f, -0.0202817f, 0.0327257f, 0.0121309f, 0.0155969f, 0.0312091f, -0.0141913f, 0.0322082f, 0.00227024f, 0.0260507f, -0.0188721f, -0.0296489f, 0.0399134f, -0.0160509f, 0.011604f, -0.0447318f, -0.0150515f, -0.0277406f, 0.0316596f, 0.0118233f, 0.0214762f, 0.0293641f}}, {2, {-0.154022f, -0.124934f, 0.0478463f, 0.0607819f, -0.218727f, -0.111053f, -0.103885f, -0.00447221f, 0.0554757f, -0.0207068f, 0.0595767f, -0.116297f, -0.249466f, -0.0723206f, 0.0794942f, -0.0377107f, 0.124532f, 0.249952f, 0.188641f, 0.411865f, -0.11012f, -0.0694494f, 0.103501f, 0.0428427f, -0.167345f, -0.106061f, -0.0775679f, 0.00936161f, 0.0105526f, -0.0314523f, 0.0243475f, -0.132179f, -0.258763f, -0.0307266f, 0.107047f, -0.0115197f, 0.0995485f, 0.220027f, 0.158355f, 0.436369f}}, {3, {-0.0166936f, 0.0381209f, 0.000889694f, 0.0143363f, -0.0328911f, -0.0234288f, 0.0333051f, -0.012229f, 0.0110322f, -0.0457725f, -0.000832209f, -0.0202817f, 0.0327257f, 0.0121308f, 0.0155969f, 0.0312091f, -0.0141913f, 0.0322082f, 0.00227024f, 0.0260507f, -0.0188721f, -0.0296489f, 0.0399134f, -0.0160509f, 0.0116039f, -0.0447318f, -0.0150515f, -0.0277406f, 0.0316596f, 0.0118233f, 0.0214762f, 0.0293641f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/lstm3_state2.example.cpp b/nn/runtime/test/generated/examples/lstm3_state2.example.cpp
new file mode 100644
index 000000000..770143bd1
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm3_state2.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm3_state2.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {0.073204f, 0.296072f, 0.743333f, 0.069199f, 0.045348f, 0.640394f, 0.930399f, 0.050782f, 0.432485f, 0.988078f}}, {1, {0.021393683f, 0.06124551f, 0.046905167f, -0.014657677f, -0.03149463f, 0.09171803f, 0.14647801f, 0.10797193f, -0.0057968358f, 0.0019193048f, -0.2726754f, 0.10154029f, -0.018539885f, 0.080349885f, -0.10262385f, -0.022599787f, -0.09121155f, -0.008675967f, -0.045206103f, -0.0821282f, -0.008045952f, 0.015478081f, 0.055217247f, 0.038719587f, 0.044153627f, -0.06453243f, 0.05031825f, -0.046935108f, -0.008164439f, 0.014574226f, -0.1671009f, -0.15519552f, -0.16819797f, -0.13971269f, -0.11953059f, 0.25005487f, -0.22790983f, 0.009855087f, -0.028140958f, -0.11200698f, 0.11295408f, -0.0035217577f, 0.054485075f, 0.05184695f, 0.064711206f, 0.10989193f, 0.11674786f, 0.03490607f, 0.07727357f, 0.11390585f, -0.1863375f, -0.1034451f, -0.13945189f, -0.049401227f, -0.18767063f, 0.042483903f, 0.14233552f, 0.13832581f, 0.18350165f, 0.14545603f, -0.028545704f, 0.024939531f, 0.050929718f, 0.0076203286f, -0.0029723682f, -0.042484224f, -0.11827596f, -0.09171104f, -0.10808628f, -0.16327988f, -0.2273378f, -0.0993647f, -0.017155107f, 0.0023917493f, 0.049272764f, 0.0038534778f, 0.054764505f, 0.089753784f, 0.06947234f, 0.08014476f, -0.04544234f, -0.0497073f, -0.07135631f, -0.048929106f, -0.004042012f, -0.009284026f, 0.018042054f, 0.0036860977f, -0.07427302f, -0.11434604f, -0.018995456f, 0.031487543f, 0.012834908f, 0.019977754f, 0.044256654f, -0.39292613f, -0.18519334f, -0.11651281f, -0.06809892f, 0.011373677f}}, {2, {-0.0018401089f, -0.004852237f, 0.03698424f, 0.014181704f, 0.028273236f, -0.016726194f, -0.05249759f, -0.10204261f, 0.00861066f, -0.040979505f, -0.009899187f, 0.01923892f, -0.028177269f, -0.08535103f, -0.14585495f, 0.10662567f, -0.01909731f, -0.017883534f, -0.0047269356f, -0.045103323f, 0.0030784295f, 0.076784775f, 0.07463696f, 0.094531395f, 0.0814421f, -0.12257899f, -0.033945758f, -0.031303465f, 0.045630626f, 0.06843887f, -0.13492945f, -0.012480007f, -0.0811829f, -0.07224499f, -0.09628791f, 0.045100946f, 0.0012300825f, 0.013964662f, 0.099372394f, 0.02543059f, 0.06958324f, 0.034257296f, 0.0482646f, 0.06267997f, 0.052625068f, 0.12784666f, 0.07077897f, 0.025725935f, 0.04165009f, 0.07241905f, 0.018668644f, -0.037377294f, -0.06277783f, -0.08833636f, -0.040120605f, -0.011405586f, -0.007808335f, -0.010301386f, -0.005102167f, 0.027717464f, 0.05483423f, 0.11449111f, 0.11289652f, 0.10939839f, 0.13396506f, -0.08402166f, -0.01901462f, -0.044678304f, -0.07720565f, 0.014350063f, -0.11757958f, -0.0652038f, -0.08185733f, -0.076754324f, -0.092614375f, 0.10405491f, 0.052960336f, 0.035755895f, 0.035839386f, -0.012540553f, 0.036881298f, 0.02913376f, 0.03420159f, 0.05448447f, -0.054523353f, 0.02582715f, 0.02327355f, -0.011857179f, -0.0011980024f, -0.034641717f, -0.026125094f, -0.17582615f, -0.15923657f, -0.27486774f, -0.0006143371f, 0.0001771948f, -8.470171e-05f, 0.02651807f, 0.045790765f, 0.06956496f}}, {3, {-0.04580283f, -0.09549462f, -0.032418985f, -0.06454633f, -0.043528453f, 0.043018587f, -0.049152344f, -0.12418144f, -0.078985475f, -0.07596889f, 0.019484362f, -0.11434962f, -0.0074034138f, -0.06314844f, -0.092981495f, 0.0062155537f, -0.025034338f, -0.0028890965f, 0.048929527f, 0.06235075f, 0.10665918f, -0.032036792f, -0.08505916f, -0.10843358f, -0.13002433f, -0.036816437f, -0.02130134f, -0.016518239f, 0.0047691227f, -0.0025825808f, 0.066017866f, 0.029991534f, -0.10652836f, -0.1037554f, -0.13056071f, -0.03266643f, -0.033702414f, -0.006473424f, -0.04611692f, 0.014419339f, -0.025174323f, 0.0396852f, 0.081777506f, 0.06157468f, 0.10210095f, -0.009658194f, 0.046511717f, 0.03603906f, 0.0069369148f, 0.015960095f, -0.06507666f, 0.09551598f, 0.053568836f, 0.06408714f, 0.12835667f, -0.008714329f, -0.20211966f, -0.12093674f, 0.029450472f, 0.2849013f, -0.029227901f, 0.1164364f, -0.08560263f, 0.09941786f, -0.036999565f, -0.028842626f, -0.0033637602f, -0.017012902f, -0.09720865f, -0.11193351f, -0.029155117f, -0.017936034f, -0.009768936f, -0.04223324f, -0.036159635f, 0.06505112f, -0.021742892f, -0.023377212f, -0.07221364f, -0.06430552f, 0.05453865f, 0.091149814f, 0.06387331f, 0.007518393f, 0.055960953f, 0.069779344f, 0.046411168f, 0.10509911f, 0.07463894f, 0.0075130584f, 0.012850982f, 0.04555431f, 0.056955688f, 0.06555285f, 0.050801456f, -0.009862683f, 0.00826772f, -0.026555609f, -0.0073611983f, -0.0014897042f}}, {4, {-0.0998932f, -0.07201956f, -0.052803773f, -0.15629593f, -0.15001918f, -0.07650751f, 0.02359855f, -0.075155355f, -0.08037709f, -0.15093534f, 0.029517552f, -0.04751393f, 0.010350531f, -0.02664851f, -0.016839722f, -0.023121163f, 0.0077019283f, 0.012851257f, -0.05040649f, -0.0129761f, -0.021737747f, -0.038305793f, -0.06870586f, -0.01481247f, -0.001285394f, 0.10124236f, 0.083122835f, 0.053313006f, -0.062235646f, -0.075637154f, -0.027833903f, 0.029774971f, 0.1130802f, 0.09218906f, 0.09506135f, -0.086665764f, -0.037162706f, -0.038880914f, -0.035832845f, -0.014481564f, -0.09825003f, -0.12048569f, -0.097665586f, -0.05287633f, -0.0964047f, -0.11366429f, 0.035777505f, 0.13568819f, 0.052451383f, 0.050649304f, 0.05798951f, -0.021852335f, -0.099848844f, 0.014740475f, -0.078897946f, 0.04974699f, 0.014160473f, 0.06973932f, 0.04964942f, 0.033364646f, 0.08190124f, 0.025535367f, 0.050893165f, 0.048514254f, 0.06945813f, -0.078907564f, -0.06707616f, -0.11844508f, -0.09986688f, -0.07509403f, 0.06263226f, 0.14925587f, 0.20188436f, 0.12098451f, 0.14639415f, 0.0015017595f, -0.014267382f, -0.03417257f, 0.012711468f, 0.0028300495f, -0.024758482f, -0.05098548f, -0.0821182f, 0.014225672f, 0.021544158f, 0.08949725f, 0.07505268f, -0.0020780868f, 0.04908258f, 0.06476295f, -0.022907063f, 0.027562456f, 0.040185735f, 0.019567577f, -0.015598739f, -0.049097303f, -0.017121866f, -0.083368234f, -0.02332002f, -0.0840956f}}, {5, {-0.001374326f, -0.078856036f, 0.10672688f, 0.029162422f, -0.11585556f, 0.02557986f, -0.13446963f, -0.035785314f, -0.01244275f, 0.025961924f, -0.02337298f, -0.044228926f, -0.055839065f, -0.046598054f, -0.010546039f, -0.06900766f, 0.027239809f, 0.022582639f, -0.013296484f, -0.05459212f, 0.08981f, -0.045407712f, 0.08682226f, -0.06867011f, -0.14390695f, -0.02916037f, 0.000996957f, 0.091420636f, 0.14283475f, -0.07390571f, -0.06402044f, 0.062524505f, -0.093129106f, 0.04860203f, -0.08364217f, -0.08119002f, 0.009352075f, 0.22920375f, 0.0016303885f, 0.11583097f, -0.13732095f, 0.012405723f, -0.07551853f, 0.06343048f, 0.12162708f, -0.031923793f, -0.014335606f, 0.01790974f, -0.10650317f, -0.0724401f, 0.08554849f, -0.05727212f, 0.06556731f, -0.042729504f, -0.043227166f, 0.011683251f, -0.013082158f, -0.029302018f, -0.010899579f, -0.062036745f, -0.022509435f, -0.00964907f, -0.01567329f, 0.04260106f, -0.07787477f, -0.11576462f, 0.017356863f, 0.048673786f, -0.017577527f, -0.05527947f, -0.082487635f, -0.040137455f, -0.10820036f, -0.04666372f, 0.022746278f, -0.07851417f, 0.01068115f, 0.032956902f, 0.022433773f, 0.0026891115f, 0.08944216f, -0.0685835f, 0.010513544f, 0.07228705f, 0.02032331f, -0.059686817f, -0.0005566496f, -0.086984694f, 0.040414046f, -0.1380399f, 0.094208956f, -0.05722982f, 0.012092817f, -0.04989123f, -0.086576f, -0.003399834f, -0.04696032f, -0.045747425f, 0.10091314f, 0.048676282f, -0.029037097f, 0.031399418f, -0.0040285117f, 0.047237843f, 0.09504992f, 0.041799378f, -0.049185462f, -0.031518843f, -0.10516937f, 0.026374253f, 0.10058866f, -0.0033195973f, -0.041975245f, 0.0073591834f, 0.0033782164f, -0.004325073f, -0.10167381f, 0.042500053f, -0.01447153f, 0.06464186f, -0.017142897f, 0.03312627f, 0.009205989f, 0.024138335f, -0.011337001f, 0.035530265f, -0.010912711f, 0.0706555f, -0.005894094f, 0.051841937f, -0.1401738f, -0.02351249f, 0.0365468f, 0.07590991f, 0.08838724f, 0.021681072f, -0.10086113f, 0.019608743f, -0.06195883f, 0.077335775f, 0.023646897f, -0.095322326f, 0.02233014f, 0.09756986f, -0.048691444f, -0.009579111f, 0.07595467f, 0.11480546f, -0.09801813f, 0.019894179f, 0.08502348f, 0.004032281f, 0.037211012f, 0.068537936f, -0.048005626f, -0.091520436f, -0.028379958f, -0.01556313f, 0.06554592f, -0.045599163f, -0.01672207f, -0.020169014f, -0.011877351f, -0.20212261f, 0.010889619f, 0.0047078193f, 0.038385306f, 0.08540671f, -0.017140968f, -0.0035865551f, 0.016678626f, 0.005633034f, 0.015963363f, 0.00871737f, 0.060130805f, 0.028611384f, 0.10109069f, -0.015060172f, -0.07894427f, 0.06401885f, 0.011584063f, -0.024466386f, 0.0047652307f, -0.09041358f, 0.030737216f, -0.0046374933f, 0.14215417f, -0.11823516f, 0.019899689f, 0.006106124f, -0.027092824f, 0.0786356f, 0.05052217f, -0.058925f, -0.011402121f, -0.024987547f, -0.0013661642f, -0.06832946f, -0.015667673f, -0.1083353f, -0.00096863037f, -0.06988685f, -0.053350925f, -0.027275559f, -0.033664223f, -0.07978348f, -0.025200296f, -0.017207067f, -0.058403496f, -0.055697463f, 0.005798788f, 0.12965427f, -0.062582195f, 0.0013350133f, -0.10482091f, 0.0379771f, 0.072521195f, -0.0029455067f, -0.13797039f, -0.03628521f, 0.013806405f, -0.017858358f, -0.01008298f, -0.07700066f, -0.017081132f, 0.019358726f, 0.0027079724f, 0.004635139f, 0.062634714f, -0.02338735f, -0.039547626f, -0.02050681f, 0.03385117f, -0.083611414f, 0.002862572f, -0.09421313f, 0.058618143f, -0.08598433f, 0.00972939f, 0.023867095f, -0.053934585f, -0.023203006f, 0.07452513f, -0.048767887f, -0.07314807f, -0.056307215f, -0.10433547f, -0.06440842f, 0.04328182f, 0.04389765f, -0.020006588f, -0.09076438f, -0.11652589f, -0.021705797f, 0.03345259f, -0.010329105f, -0.025767034f, 0.013057034f, -0.07316461f, -0.10145612f, 0.06358255f, 0.18531723f, 0.07759293f, 0.12006465f, 0.1305557f, 0.058638252f, -0.03393652f, 0.09622831f, -0.16253184f, -2.4580743e-06f, 0.079869635f, -0.070196845f, -0.005644518f, 0.06857898f, -0.12598175f, -0.035084512f, 0.03156317f, -0.12794146f, -0.031963028f, 0.04692781f, 0.030070418f, 0.0071660685f, -0.095516115f, -0.004643372f, 0.040170413f, -0.062104587f, -0.0037324072f, 0.0554317f, 0.08184801f, -0.019164372f, 0.06791302f, 0.034257166f, -0.10307039f, 0.021943003f, 0.046745934f, 0.0790918f, -0.0265588f, -0.007824208f, 0.042546265f, -0.00977924f, -0.0002440307f, -0.017384544f, -0.017990116f, 0.12252321f, -0.014512694f, -0.08251313f, 0.08861942f, 0.13589665f, 0.026351685f, 0.012641483f, 0.07466548f, 0.044301085f, -0.045414884f, -0.051112458f, 0.03444247f, -0.08502782f, -0.04106223f, -0.028126027f, 0.028473156f, 0.10467447f}}, {6, {-0.057784554f, -0.026057621f, -0.068447545f, -0.022581743f, 0.14811787f, 0.10826372f, 0.09471067f, 0.03987225f, -0.0039523416f, 0.00030638507f, 0.053185795f, 0.10572994f, 0.08414449f, -0.022036452f, -0.00066928595f, -0.09203576f, 0.032950465f, -0.10985798f, -0.023809856f, 0.0021431844f, -0.02196096f, -0.00326074f, 0.00058621005f, -0.074678116f, -0.06193199f, 0.055729095f, 0.03736828f, 0.020123724f, 0.061878487f, -0.04729229f, 0.034919553f, -0.07585433f, -0.04421272f, -0.044019096f, 0.085488975f, 0.04058006f, -0.06890133f, -0.030951202f, -0.024628663f, -0.07672815f, 0.034293607f, 0.08556707f, -0.05293577f, -0.033561368f, -0.04899627f, 0.0241671f, 0.015736353f, -0.095442444f, -0.029564252f, 0.016493602f, -0.035026584f, 0.022337519f, -0.026871363f, 0.004780428f, 0.0077918363f, -0.03601621f, 0.016435321f, -0.03263031f, -0.09543275f, -0.047392778f, 0.013454138f, 0.028934088f, 0.01685226f, -0.086110644f, -0.046250615f, -0.01847454f, 0.047608484f, 0.07339695f, 0.034546845f, -0.04881143f, 0.009128804f, -0.08802852f, 0.03761666f, 0.008096139f, -0.014454086f, 0.014361001f, -0.023502491f, -0.0011840804f, -0.07607001f, 0.001856849f, -0.06509276f, -0.006021153f, -0.08570962f, -0.1451793f, 0.060212336f, 0.055259194f, 0.06974018f, 0.049454916f, -0.027794661f, -0.08077226f, -0.016179763f, 0.1169753f, 0.17213494f, -0.0056326236f, -0.053934924f, -0.0124349f, -0.11520337f, 0.05409887f, 0.088759385f, 0.0019655675f, 0.0042065294f, 0.03881498f, 0.019844765f, 0.041858196f, -0.05695512f, 0.047233116f, 0.038937137f, -0.06542224f, 0.014429736f, -0.09719407f, 0.13908425f, -0.05379757f, 0.012321099f, 0.082840554f, -0.029899208f, 0.044217527f, 0.059855383f, 0.07711018f, -0.045319796f, 0.0948846f, -0.011724666f, -0.0033288454f, -0.033542685f, -0.04764985f, -0.13873616f, 0.040668588f, 0.034832682f, -0.015319203f, -0.018715994f, 0.046002675f, 0.0599172f, -0.043107376f, 0.0294216f, -0.002314414f, -0.022424703f, 0.0030315618f, 0.0014641669f, 0.0029166266f, -0.11878115f, 0.013738511f, 0.12375372f, -0.0006038222f, 0.029104086f, 0.087442465f, 0.052958444f, 0.07558703f, 0.04817258f, 0.044462286f, -0.015213451f, -0.08783778f, -0.0561384f, -0.003008196f, 0.047060397f, -0.002058388f, 0.03429439f, -0.018839769f, 0.024734668f, 0.024614193f, -0.042046934f, 0.09597743f, -0.0043254104f, 0.04320769f, 0.0064070094f, -0.0019131786f, -0.02558259f, -0.022822596f, -0.023273505f, -0.02464396f, -0.10991725f, -0.006240552f, 0.0074488563f, 0.024044557f, 0.04383914f, -0.046476185f, 0.028658995f, 0.060410924f, 0.050786525f, 0.009452605f, -0.0073054377f, -0.024810238f, 0.0052906186f, 0.0066939713f, -0.0020913032f, 0.014515517f, 0.015898481f, 0.021362653f, -0.030262267f, 0.016587038f, -0.011442813f, 0.041154444f, -0.007631438f, -0.03423484f, -0.010977775f, 0.036152758f, 0.0066366293f, 0.11915515f, 0.02318443f, -0.041350313f, 0.021485701f, -0.10906167f, -0.028218046f, -0.00954771f, 0.020531068f, -0.11995105f, -0.03672871f, 0.024019798f, 0.014255957f, -0.05221243f, -0.00661567f, -0.04630967f, 0.033188973f, 0.10107534f, -0.014027541f, 0.030796422f, -0.10270911f, -0.035999842f, 0.15443139f, 0.07684145f, 0.036571592f, -0.035900835f, -0.0034699554f, 0.06209149f, 0.015920248f, -0.031122351f, -0.03858649f, 0.01849943f, 0.13872518f, 0.01503974f, 0.069941424f, -0.06948533f, -0.0088794185f, 0.061282158f, -0.047401894f, 0.03100163f, -0.041533746f, -0.10430945f, 0.044574402f, -0.01425562f, -0.024290353f, 0.034563623f, 0.05866852f, 0.023947537f, -0.09445152f, 0.035450947f, 0.02247216f, -0.0042998926f, 0.061146557f, -0.10250651f, 0.020881841f, -0.06747029f, 0.10062043f, -0.0023941975f, 0.03532124f, -0.016341697f, 0.09685456f, -0.016764693f, 0.051808182f, 0.05875331f, -0.04536488f, 0.001626336f, -0.028892258f, -0.01048663f, -0.009793449f, -0.017093895f, 0.010987891f, 0.02357273f, -0.00010856845f, 0.0099760275f, -0.001845119f, -0.03551521f, 0.0018358806f, 0.05763657f, -0.01769146f, 0.040995963f, 0.02235177f, -0.060430344f, 0.11475477f, -0.023854522f, 0.10071741f, 0.0686208f, -0.014250481f, 0.034261297f, 0.047418304f, 0.08562733f, -0.030519066f, 0.0060542435f, 0.014653856f, -0.038836084f, 0.04096551f, 0.032249358f, -0.08355519f, -0.026823482f, 0.056386515f, -0.010401743f, -0.028396193f, 0.08507674f, 0.014410365f, 0.020995233f, 0.17040324f, 0.11511526f, 0.02459721f, 0.0066619175f, 0.025853224f, -0.023133837f, -0.081302024f, 0.017264642f, -0.009585969f, 0.09491168f, -0.051313367f, 0.054532815f, -0.014298593f, 0.10657464f, 0.007076659f, 0.10964551f, 0.0409152f, 0.008275321f, -0.07283536f, 0.07937492f, 0.04192024f, -0.1075027f}}, {7, {-0.037322544f, 0.018592842f, 0.0056175636f, -0.06253426f, 0.055647098f, -0.05713207f, -0.05626563f, 0.005559383f, 0.03375411f, -0.025757805f, -0.088049285f, 0.06017052f, -0.06570978f, 0.007384076f, 0.035123326f, -0.07920549f, 0.053676967f, 0.044480428f, -0.07663568f, 0.0071805613f, 0.08089997f, 0.05143358f, 0.038261272f, 0.03339287f, -0.027673481f, 0.044746667f, 0.028349208f, 0.020090483f, -0.019443132f, -0.030755889f, -0.0040000007f, 0.04465846f, -0.021585021f, 0.0031670958f, 0.0053199246f, -0.056117613f, -0.10893326f, 0.076739706f, -0.08509834f, -0.027997585f, 0.037871376f, 0.01449768f, -0.09002357f, -0.06111149f, -0.046195522f, 0.0422062f, -0.005683705f, -0.1253618f, -0.012925729f, -0.04890792f, 0.06985068f, 0.037654128f, 0.03398274f, -0.004781977f, 0.007032333f, -0.031787455f, 0.010868644f, -0.031489216f, 0.09525667f, 0.013939797f, 0.0058680447f, 0.0167067f, 0.02668468f, -0.04797466f, -0.048885044f, -0.12722108f, 0.035304096f, 0.06554885f, 0.00972396f, -0.039238118f, -0.05159735f, -0.11329045f, 0.1613692f, -0.03750952f, 0.06529313f, -0.071974665f, -0.11769596f, 0.015524369f, -0.0013754242f, -0.12446318f, 0.02786344f, -0.014179351f, 0.005264273f, 0.14376344f, 0.015983658f, 0.03406988f, -0.06939408f, 0.040699873f, 0.02111075f, 0.09669095f, 0.041345075f, -0.08316494f, -0.07684199f, -0.045768797f, 0.032298047f, -0.041805092f, 0.0119405f, 0.0061010392f, 0.12652606f, 0.0064572375f, -0.024950314f, 0.11574242f, 0.04508852f, -0.04335324f, 0.06760663f, -0.027437469f, 0.07216407f, 0.06977076f, -0.05438599f, 0.034033038f, -0.028602652f, 0.05346137f, 0.043184172f, -0.037189785f, 0.10420091f, 0.00882477f, -0.054019816f, -0.074273005f, -0.030617684f, -0.0028467078f, 0.024302477f, -0.0038869337f, 0.005332455f, 0.0013399826f, 0.04361412f, -0.007001822f, 0.09631092f, -0.06702025f, -0.042049985f, -0.035070654f, -0.04103342f, -0.10273396f, 0.0544271f, 0.037184782f, -0.13150354f, -0.0058036847f, -0.008264958f, 0.042035464f, 0.05891794f, 0.029673764f, 0.0063542654f, 0.044788733f, 0.054816857f, 0.062257513f, -0.00093483756f, 0.048938446f, -0.004952862f, -0.007730018f, -0.04043371f, -0.017094059f, 0.07229206f, -0.023670016f, -0.052195564f, -0.025616996f, -0.01520939f, 0.045104615f, -0.007376126f, 0.003533447f, 0.006570588f, 0.056037236f, 0.12436656f, 0.051817212f, 0.028532185f, -0.08686856f, 0.11868599f, 0.07663395f, -0.07323171f, 0.03463402f, -0.050708205f, -0.04458982f, -0.11590894f, 0.021273347f, 0.1251325f, -0.15313013f, -0.12224372f, 0.17228661f, 0.023029093f, 0.086124025f, 0.006445803f, -0.03496501f, 0.028332196f, 0.04449512f, -0.042436164f, -0.026587414f, -0.006041347f, -0.09292539f, -0.05678812f, 0.03897832f, 0.09465633f, 0.008115513f, -0.02171956f, 0.08304309f, 0.071401566f, 0.019622514f, 0.032163795f, -0.004167056f, 0.02295182f, 0.030739572f, 0.056506045f, 0.004612461f, 0.06524936f, 0.059999723f, 0.046395954f, -0.0045512207f, -0.1335546f, -0.030136576f, 0.11584653f, -0.014678886f, 0.0020118146f, -0.09688814f, -0.0790206f, 0.039770417f, -0.0329582f, 0.07922767f, 0.029322514f, 0.026405897f, 0.04207835f, -0.07073373f, 0.063781224f, 0.0859677f, -0.10925287f, -0.07011058f, 0.048005477f, 0.03438226f, -0.09606514f, -0.006669445f, -0.043381985f, 0.04240257f, -0.06955775f, -0.06769346f, 0.043903265f, -0.026784198f, -0.017840602f, 0.024307009f, -0.040079936f, -0.019946516f, 0.045318738f, -0.12233574f, 0.026170589f, 0.0074471775f, 0.15978073f, 0.10185836f, 0.10298046f, -0.015476589f, -0.039390966f, -0.072174534f, 0.0739445f, -0.1211869f, -0.0347889f, -0.07943156f, 0.014809798f, -0.12412325f, -0.0030663363f, 0.039695457f, 0.0647603f, -0.08291318f, -0.018529687f, -0.004423833f, 0.0037507233f, 0.084633216f, -0.01514876f, -0.056505352f, -0.012800942f, -0.06994386f, 0.012962922f, -0.031234352f, 0.07029052f, 0.016418684f, 0.03618972f, 0.055686004f, -0.08663945f, -0.017404709f, -0.054761406f, 0.029065743f, 0.052404847f, 0.020238016f, 0.0048197987f, -0.0214882f, 0.07078733f, 0.013016777f, 0.06262858f, 0.009184685f, 0.020785125f, -0.043904778f, -0.0270329f, -0.03299152f, -0.060088247f, -0.015162964f, -0.001828936f, 0.12642565f, -0.056757294f, 0.013586685f, 0.09232601f, -0.035886683f, 0.06000002f, 0.05229691f, -0.052580316f, -0.082029596f, -0.010794592f, 0.012947712f, -0.036429964f, -0.085508935f, -0.13127148f, -0.017744139f, 0.031502828f, 0.036232427f, -0.031581745f, 0.023051167f, -0.05325106f, -0.03421577f, 0.028793324f, -0.034633752f, -0.009881397f, -0.043551125f, -0.018609839f, 0.0019097115f, -0.008799762f, 0.056595087f, 0.0022273948f, 0.055752404f}}, {8, {0.025825322f, -0.05813119f, 0.09495884f, -0.045984812f, -0.01255415f, -0.0026479573f, -0.08196161f, -0.054914974f, -0.0046604523f, -0.029587349f, -0.044576716f, -0.07480124f, -0.082868785f, 0.023254942f, 0.027502948f, -0.0039728214f, -0.08683098f, -0.08116779f, -0.014675607f, -0.037924774f, -0.023314456f, -0.007401714f, -0.09255757f, 0.029460307f, -0.08829125f, -0.005139627f, -0.08989442f, -0.0555066f, 0.13596267f, -0.025062224f, -0.048351806f, -0.03850004f, 0.07266485f, -0.022414139f, 0.05940088f, 0.075114764f, 0.09597592f, -0.010211725f, -0.0049794707f, -0.011523867f, -0.025980417f, 0.072999895f, 0.11091378f, -0.081685916f, 0.014416728f, 0.043229222f, 0.034178585f, -0.07530371f, 0.035837382f, -0.085607f, -0.007721233f, -0.03287832f, -0.043848954f, -0.06404588f, -0.06632928f, -0.073643476f, 0.008214239f, -0.045984086f, 0.039764922f, 0.03474462f, 0.060612556f, -0.080590084f, 0.049127717f, 0.04151091f, -0.030063879f, 0.008801774f, -0.023021035f, -0.019558564f, 0.05158114f, -0.010947698f, -0.011825728f, 0.0075720972f, 0.0699727f, -0.0039981045f, 0.069350146f, 0.08799282f, 0.016156472f, 0.035502106f, 0.11695009f, 0.006217345f, 0.13392477f, -0.037875112f, 0.025745004f, 0.08940699f, -0.00924166f, 0.0046702605f, -0.036598757f, -0.08811812f, 0.10522024f, -0.032441203f, 0.008176899f, -0.04454919f, 0.07058152f, 0.0067963637f, 0.039206743f, 0.03259838f, 0.03725492f, -0.09515802f, 0.013326398f, -0.052055415f, -0.025676316f, 0.03198509f, -0.015951829f, -0.058556724f, 0.036879618f, 0.043357447f, 0.028362012f, -0.05908629f, 0.0059240665f, -0.04995891f, -0.019187413f, 0.0276265f, -0.01628143f, 0.0025863599f, 0.08800015f, 0.035250366f, -0.022165963f, -0.07328642f, -0.009415526f, -0.07455109f, 0.11690406f, 0.0363299f, 0.07411125f, 0.042103454f, -0.009660886f, 0.019076364f, 0.018299393f, -0.046004917f, 0.08891175f, 0.0431396f, -0.026327137f, -0.051502608f, 0.08979574f, -0.051670972f, 0.04940282f, -0.07491107f, -0.021240504f, 0.022596184f, -0.034280192f, 0.060163025f, -0.058211457f, -0.051837247f, -0.01349775f, -0.04639988f, -0.035936575f, -0.011681591f, 0.064818054f, 0.0073146066f, -0.021745546f, -0.043124277f, -0.06471268f, -0.07053354f, -0.029321948f, -0.05330136f, 0.016933719f, -0.053782392f, 0.13747959f, -0.1361751f, -0.11569455f, 0.0033329215f, 0.05693899f, -0.053219706f, 0.063698f, 0.07977434f, -0.07924483f, 0.06936997f, 0.0034815092f, -0.007305279f, -0.037325785f, -0.07251102f, -0.033633437f, -0.08677009f, 0.091591336f, -0.14165086f, 0.021752775f, 0.019683983f, 0.0011612234f, -0.058154266f, 0.049996935f, 0.0288841f, -0.0024567875f, -0.14345716f, 0.010955264f, -0.10234828f, 0.1183656f, -0.0010731248f, -0.023590032f, -0.072285876f, -0.0724771f, -0.026382286f, -0.0014920527f, 0.042667855f, 0.0018776858f, 0.02986552f, 0.009814309f, 0.0733756f, 0.12289186f, 0.018043943f, -0.0458958f, 0.049412545f, 0.033632483f, 0.05495232f, 0.036686596f, -0.013781798f, -0.010036754f, 0.02576849f, -0.08307328f, 0.010112348f, 0.042521734f, -0.05869831f, -0.071689695f, 0.03876447f, -0.13275425f, -0.0352966f, -0.023077697f, 0.10285965f, 0.084736146f, 0.15568255f, -0.00040734606f, 0.027835453f, -0.10292561f, -0.032401145f, 0.10053256f, -0.026142767f, -0.08271222f, -0.0030240538f, -0.016368777f, 0.1070414f, 0.042672627f, 0.013456989f, -0.0437609f, -0.022309763f, 0.11576483f, 0.04108048f, 0.061026827f, -0.0190714f, -0.0869359f, 0.037901703f, 0.0610107f, 0.07202949f, 0.01675338f, 0.086139716f, -0.08795751f, -0.014898893f, -0.023771819f, -0.01965048f, 0.007955471f, -0.043740474f, 0.03346837f, -0.10549954f, 0.090567775f, 0.042013682f, -0.03176985f, 0.12569028f, -0.02421228f, -0.029526481f, 0.023851605f, 0.031539805f, 0.05292009f, -0.02344001f, -0.07811758f, -0.08834428f, 0.10094801f, 0.16594367f, -0.06861939f, -0.021256343f, -0.041093912f, -0.06669611f, 0.035498552f, 0.021757556f, -0.09302526f, -0.015403468f, -0.06614931f, -0.051798206f, -0.013874718f, 0.03630673f, 0.010412845f, -0.08077351f, 0.046185967f, 0.0035662893f, 0.03541868f, -0.094149634f, -0.034814864f, 0.003128424f, -0.020674974f, -0.03944324f, -0.008110165f, -0.11113267f, 0.08484226f, 0.043586485f, 0.040582247f, 0.0968012f, -0.065249965f, -0.028036479f, 0.0050708856f, 0.0017462453f, 0.0326779f, 0.041296225f, 0.09164146f, -0.047743853f, -0.015952192f, -0.034451712f, 0.084197424f, -0.05347844f, -0.11768019f, 0.085926116f, -0.08251791f, -0.045081906f, 0.0948852f, 0.068401024f, 0.024856757f, 0.06978981f, -0.057309967f, -0.012775832f, -0.0032452994f, 0.01977615f, -0.041040014f, -0.024264973f, 0.063464895f, 0.05431621f}}, {9, {0.040369894f, 0.030746894f, 0.24704495f, 0.018586371f, -0.037586458f, -0.15312155f, -0.11812848f, -0.11465643f, 0.20259799f, 0.11418174f, -0.10116027f, -0.011334949f, 0.12411352f, -0.076769054f, -0.052169047f, 0.21198851f, -0.38871562f, -0.09061183f, -0.09683246f, -0.21929175f}}, {10, {-0.01998659f, -0.15568835f, -0.24248174f, -0.012770197f, 0.041331276f, -0.072311886f, -0.052123554f, -0.0066330447f, -0.043891653f, 0.036225766f, -0.047248036f, 0.021479502f, 0.033189066f, 0.11952997f, -0.020432774f, 0.64658105f, -0.06650122f, -0.03467612f, 0.095340036f, 0.23647355f}}, {11, {0.08286371f, -0.08261836f, -0.51210177f, 0.002913762f, 0.17764764f, -0.5495371f, -0.08460716f, -0.24552552f, 0.030037103f, 0.04123544f, -0.11940523f, 0.007358328f, 0.1890978f, 0.4833202f, -0.34441817f, 0.36312827f, -0.26375428f, 0.1457655f, -0.19724406f, 0.15548733f}}, {12, {0.02234832f, 0.14757581f, 0.18176508f, 0.10380666f, 0.053110216f, -0.06928846f, -0.13942584f, -0.11816189f, 0.19483899f, 0.03652339f, -0.10250295f, 0.036714908f, -0.18426876f, 0.036065217f, 0.21810818f, 0.02383196f, -0.043370757f, 0.08690144f, -0.04444982f, 0.00030581196f}}, {13, {0.035185695f, -0.042891346f, -0.03032477f, 0.23027696f, 0.11098921f, 0.15378423f, 0.09263801f, 0.09790885f, 0.09508917f, 0.061199076f, 0.07665568f, -0.015443159f, -0.03499149f, 0.046190713f, 0.08895977f, 0.10899629f, 0.40694186f, 0.06030037f, 0.012413437f, -0.06108739f}}, {14, {-0.024379363f, 0.0055531194f, 0.23377132f, 0.033463873f, -0.1483596f, -0.10639995f, -0.091433935f, 0.058573797f, -0.06809782f, -0.07889636f, -0.043246906f, -0.09829136f, -0.4279842f, 0.034901652f, 0.18797937f, 0.0075234566f, 0.016178843f, 0.1749513f, 0.13975595f, 0.92058027f}}, {15, {0.046159424f, -0.0012809046f, 0.03563469f, 0.12648113f, 0.027195795f, 0.35373217f, -0.018957434f, 0.008907322f, -0.0762701f, 0.12018895f, 0.04216877f, 0.0022856654f, 0.040952638f, 0.3147856f, 0.08225149f, -0.057416286f, -0.14995944f, -0.008040261f, 0.13208859f, 0.029760877f}}, {16, {-0.009802181f, 0.09401916f, 0.0717386f, -0.13895074f, 0.09641832f, 0.060420845f, 0.08539281f, 0.054285463f, 0.061395317f, 0.034448683f, -0.042991187f, 0.019801661f, -0.16840284f, -0.015726732f, -0.23041931f, -0.024478018f, -0.10959692f, -0.013875541f, 0.18600968f, -0.061274476f, 0.0138165f, -0.08160894f, -0.07661644f, 0.032372914f, 0.16169067f, 0.22465782f, -0.03993472f, -0.004017731f, 0.08633481f, -0.28869787f, 0.08682067f, 0.17240396f, 0.014975425f, 0.056431185f, 0.031037588f, 0.16702051f, 0.0077946745f, 0.15140012f, 0.29405436f, 0.120285f, -0.188994f, -0.027265169f, 0.043389652f, -0.022061434f, 0.014777949f, -0.20203483f, 0.094781205f, 0.19100232f, 0.13987629f, -0.036132768f, -0.06426278f, -0.05108664f, 0.13221376f, 0.009441198f, -0.16715929f, 0.15859416f, -0.040437475f, 0.050779544f, -0.022187516f, 0.012166504f, 0.027685808f, -0.07675938f, -0.0055694645f, -0.09444123f, 0.0046453946f, 0.050794356f, 0.10770313f, -0.20790008f, -0.07149004f, -0.11425117f, 0.008225835f, -0.035802525f, 0.14374903f, 0.15262283f, 0.048710253f, 0.1847461f, -0.007487823f, 0.11000021f, -0.09542012f, 0.22619456f, -0.029149994f, 0.08527916f, 0.009043713f, 0.0042746216f, 0.016261552f, 0.022461696f, 0.12689082f, -0.043589946f, -0.12035478f, -0.08361797f, -0.050666027f, -0.1248618f, -0.1275799f, -0.071875185f, 0.07377272f, 0.09944291f, -0.18897448f, -0.1593054f, -0.06526116f, -0.040107165f, -0.004618631f, -0.067624845f, -0.007576253f, 0.10727444f, 0.041546922f, -0.20424393f, 0.06907816f, 0.050412357f, 0.00724631f, 0.039827548f, 0.12449835f, 0.10747581f, 0.13708383f, 0.09134148f, -0.12617786f, -0.06428341f, 0.09956831f, 0.1208086f, -0.14676677f, -0.0727722f, 0.1126304f, 0.010139365f, 0.015571211f, -0.038128063f, 0.022913318f, -0.042050496f, 0.16842307f, -0.060597885f, 0.10531834f, -0.06411776f, -0.07451711f, -0.03410368f, -0.13393489f, 0.06534304f, 0.003620307f, 0.04490757f, 0.05970546f, 0.05197996f, 0.02839995f, 0.10434969f, -0.013699693f, -0.028353551f, -0.07260381f, 0.047201227f, -0.024575593f, -0.036445823f, 0.07155557f, 0.009672501f, -0.02328883f, 0.009533515f, -0.03606021f, -0.07421458f, -0.028082801f, -0.2678904f, -0.13221288f, 0.18419984f, -0.13012612f, -0.014588381f, -0.035059117f, -0.04824723f, 0.07830115f, -0.056184657f, 0.03277091f, 0.025466874f, 0.14494097f, -0.12522776f, -0.098633975f, -0.10766018f, -0.08317623f, 0.08594209f, 0.07749552f, 0.039474737f, 0.1776665f, -0.07409566f, -0.0477268f, 0.29323658f, 0.10801441f, 0.1154011f, 0.013952499f, 0.10739139f, 0.10708251f, -0.051456142f, 0.0074137426f, -0.10430189f, 0.10034707f, 0.045594677f, 0.0635285f, -0.0715442f, -0.089667566f, -0.10811871f, 0.00026344223f, 0.08298446f, -0.009525053f, 0.006585689f, -0.24567553f, -0.09450807f, 0.09648481f, 0.026996298f, -0.06419476f, -0.04752702f, -0.11063944f, -0.23441927f, -0.17608605f, -0.052156363f, 0.067035615f, 0.19271925f, -0.0032889997f, -0.043264326f, 0.09663576f, -0.057112187f, -0.10100678f, 0.0628376f, 0.04447668f, 0.017961001f, -0.10094388f, -0.10190601f, 0.18335468f, 0.10494553f, -0.052095775f, -0.0026118709f, 0.10539724f, -0.04383912f, -0.042349473f, 0.08438151f, -0.1947263f, 0.02251204f, 0.11216432f, -0.10307853f, 0.17351969f, -0.039091777f, 0.08066188f, -0.00561982f, 0.12633002f, 0.11335965f, -0.0088127935f, -0.019777594f, 0.06864014f, -0.059751723f, 0.016233567f, -0.06894641f, -0.28651384f, -0.004228674f, 0.019708522f, -0.16305895f, -0.07468996f, -0.0855457f, 0.099339016f, -0.07580735f, -0.13775392f, 0.08434318f, 0.08330512f, -0.12131499f, 0.031935584f, 0.09180414f, -0.08876437f, -0.08049874f, 0.008753825f, 0.03498998f, 0.030215185f, 0.03907079f, 0.089751154f, 0.029194152f, -0.03337423f, -0.019092513f, 0.04331237f, 0.04299654f, -0.036394123f, -0.12915532f, 0.09793732f, 0.07512415f, -0.11319543f, -0.032502122f, 0.15661901f, 0.07671967f, -0.005491124f, -0.19379048f, -0.218606f, 0.21448623f, 0.017840758f, 0.1416943f, -0.07051762f, 0.19488361f, 0.02664691f, -0.18104725f, -0.09334311f, 0.15026465f, -0.15493552f, -0.057762887f, -0.11604192f, -0.262013f, -0.01391798f, 0.012185008f, 0.11156489f, -0.07483202f, 0.06693364f, -0.26151478f, 0.046425626f, 0.036540434f, -0.16435726f, 0.17338543f, -0.21401681f, -0.11385144f, -0.08283257f, -0.069031075f, 0.030635102f, 0.010969227f, 0.11109743f, 0.010919218f, 0.027526086f, 0.13519906f, 0.01891392f, -0.046839405f, -0.040167913f, 0.017953383f, -0.09700955f, 0.0061885654f, -0.07000971f, 0.026893595f, -0.038844477f, 0.14543656f}}, {17, {}}, {18, {-0.0166936f, 0.0381209f, 0.000889684f, 0.0143363f, -0.0328911f, -0.0234288f, 0.0333051f, -0.012229f, 0.0110322f, -0.0457725f, -0.000832209f, -0.0202817f, 0.0327257f, 0.0121309f, 0.0155969f, 0.0312091f, -0.0141913f, 0.0322082f, 0.00227024f, 0.0260507f, -0.0188721f, -0.0296489f, 0.0399134f, -0.0160509f, 0.011604f, -0.0447318f, -0.0150515f, -0.0277406f, 0.0316596f, 0.0118233f, 0.0214762f, 0.0293641f}}, {19, {-0.154022f, -0.124934f, 0.0478463f, 0.0607819f, -0.218727f, -0.111053f, -0.103885f, -0.00447221f, 0.0554757f, -0.0207068f, 0.0595767f, -0.116297f, -0.249466f, -0.0723206f, 0.0794942f, -0.0377107f, 0.124532f, 0.249952f, 0.188641f, 0.411865f, -0.11012f, -0.0694494f, 0.103501f, 0.0428427f, -0.167345f, -0.106061f, -0.0775679f, 0.00936161f, 0.0105526f, -0.0314523f, 0.0243475f, -0.132179f, -0.258763f, -0.0307266f, 0.107047f, -0.0115197f, 0.0995485f, 0.220027f, 0.158355f, 0.436369f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {-0.0213783f, 0.0350169f, 0.000324787f, 0.0276012f, -0.0263374f, -0.0371449f, 0.0446149f, -0.0205474f, 0.0103729f, -0.0576349f, -0.0150052f, -0.0292043f, 0.0376827f, 0.0136115f, 0.0243435f, 0.0354492f, -0.0204549f, 0.0450315f, -0.00117379f, 0.0167673f, -0.0375007f, -0.0238314f, 0.038784f, -0.0174034f, 0.0131743f, -0.0506589f, -0.00484469f, -0.0240239f, 0.0325789f, 0.00790064f, 0.0220157f, 0.0333314f}}, {2, {-0.126572f, -0.121882f, 0.121569f, 0.0489971f, -0.240177f, -0.124685f, -0.122565f, 0.0162748f, 0.0317536f, -0.0270355f, 0.0418199f, -0.179755f, -0.327279f, -0.0342741f, 0.133831f, -0.0238279f, 0.122148f, 0.269115f, 0.185989f, 0.525976f, -0.167208f, -0.109612f, 0.0531226f, 0.0695387f, -0.248335f, -0.134123f, -0.108246f, 0.00628498f, 0.0492984f, -0.0264919f, 0.0698144f, -0.0635602f, -0.295363f, -0.0760078f, 0.102725f, -0.0351708f, 0.149804f, 0.259131f, 0.202573f, 0.500664f}}, {3, {-0.0213783f, 0.0350169f, 0.000324794f, 0.0276012f, -0.0263374f, -0.0371449f, 0.0446149f, -0.0205474f, 0.0103729f, -0.0576349f, -0.0150052f, -0.0292043f, 0.0376827f, 0.0136115f, 0.0243435f, 0.0354492f, -0.0204549f, 0.0450315f, -0.00117378f, 0.0167673f, -0.0375007f, -0.0238314f, 0.038784f, -0.0174034f, 0.0131743f, -0.0506589f, -0.0048447f, -0.0240239f, 0.0325789f, 0.00790065f, 0.0220157f, 0.0333314f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/lstm3_state3.example.cpp b/nn/runtime/test/generated/examples/lstm3_state3.example.cpp
new file mode 100644
index 000000000..0c269a6db
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm3_state3.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm3_state3.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {0.867394f, 0.291279f, 0.013714f, 0.482521f, 0.626339f, 0.082922f, 0.563329f, 0.865614f, 0.333232f, 0.259916f}}, {1, {0.021393683f, 0.06124551f, 0.046905167f, -0.014657677f, -0.03149463f, 0.09171803f, 0.14647801f, 0.10797193f, -0.0057968358f, 0.0019193048f, -0.2726754f, 0.10154029f, -0.018539885f, 0.080349885f, -0.10262385f, -0.022599787f, -0.09121155f, -0.008675967f, -0.045206103f, -0.0821282f, -0.008045952f, 0.015478081f, 0.055217247f, 0.038719587f, 0.044153627f, -0.06453243f, 0.05031825f, -0.046935108f, -0.008164439f, 0.014574226f, -0.1671009f, -0.15519552f, -0.16819797f, -0.13971269f, -0.11953059f, 0.25005487f, -0.22790983f, 0.009855087f, -0.028140958f, -0.11200698f, 0.11295408f, -0.0035217577f, 0.054485075f, 0.05184695f, 0.064711206f, 0.10989193f, 0.11674786f, 0.03490607f, 0.07727357f, 0.11390585f, -0.1863375f, -0.1034451f, -0.13945189f, -0.049401227f, -0.18767063f, 0.042483903f, 0.14233552f, 0.13832581f, 0.18350165f, 0.14545603f, -0.028545704f, 0.024939531f, 0.050929718f, 0.0076203286f, -0.0029723682f, -0.042484224f, -0.11827596f, -0.09171104f, -0.10808628f, -0.16327988f, -0.2273378f, -0.0993647f, -0.017155107f, 0.0023917493f, 0.049272764f, 0.0038534778f, 0.054764505f, 0.089753784f, 0.06947234f, 0.08014476f, -0.04544234f, -0.0497073f, -0.07135631f, -0.048929106f, -0.004042012f, -0.009284026f, 0.018042054f, 0.0036860977f, -0.07427302f, -0.11434604f, -0.018995456f, 0.031487543f, 0.012834908f, 0.019977754f, 0.044256654f, -0.39292613f, -0.18519334f, -0.11651281f, -0.06809892f, 0.011373677f}}, {2, {-0.0018401089f, -0.004852237f, 0.03698424f, 0.014181704f, 0.028273236f, -0.016726194f, -0.05249759f, -0.10204261f, 0.00861066f, -0.040979505f, -0.009899187f, 0.01923892f, -0.028177269f, -0.08535103f, -0.14585495f, 0.10662567f, -0.01909731f, -0.017883534f, -0.0047269356f, -0.045103323f, 0.0030784295f, 0.076784775f, 0.07463696f, 0.094531395f, 0.0814421f, -0.12257899f, -0.033945758f, -0.031303465f, 0.045630626f, 0.06843887f, -0.13492945f, -0.012480007f, -0.0811829f, -0.07224499f, -0.09628791f, 0.045100946f, 0.0012300825f, 0.013964662f, 0.099372394f, 0.02543059f, 0.06958324f, 0.034257296f, 0.0482646f, 0.06267997f, 0.052625068f, 0.12784666f, 0.07077897f, 0.025725935f, 0.04165009f, 0.07241905f, 0.018668644f, -0.037377294f, -0.06277783f, -0.08833636f, -0.040120605f, -0.011405586f, -0.007808335f, -0.010301386f, -0.005102167f, 0.027717464f, 0.05483423f, 0.11449111f, 0.11289652f, 0.10939839f, 0.13396506f, -0.08402166f, -0.01901462f, -0.044678304f, -0.07720565f, 0.014350063f, -0.11757958f, -0.0652038f, -0.08185733f, -0.076754324f, -0.092614375f, 0.10405491f, 0.052960336f, 0.035755895f, 0.035839386f, -0.012540553f, 0.036881298f, 0.02913376f, 0.03420159f, 0.05448447f, -0.054523353f, 0.02582715f, 0.02327355f, -0.011857179f, -0.0011980024f, -0.034641717f, -0.026125094f, -0.17582615f, -0.15923657f, -0.27486774f, -0.0006143371f, 0.0001771948f, -8.470171e-05f, 0.02651807f, 0.045790765f, 0.06956496f}}, {3, {-0.04580283f, -0.09549462f, -0.032418985f, -0.06454633f, -0.043528453f, 0.043018587f, -0.049152344f, -0.12418144f, -0.078985475f, -0.07596889f, 0.019484362f, -0.11434962f, -0.0074034138f, -0.06314844f, -0.092981495f, 0.0062155537f, -0.025034338f, -0.0028890965f, 0.048929527f, 0.06235075f, 0.10665918f, -0.032036792f, -0.08505916f, -0.10843358f, -0.13002433f, -0.036816437f, -0.02130134f, -0.016518239f, 0.0047691227f, -0.0025825808f, 0.066017866f, 0.029991534f, -0.10652836f, -0.1037554f, -0.13056071f, -0.03266643f, -0.033702414f, -0.006473424f, -0.04611692f, 0.014419339f, -0.025174323f, 0.0396852f, 0.081777506f, 0.06157468f, 0.10210095f, -0.009658194f, 0.046511717f, 0.03603906f, 0.0069369148f, 0.015960095f, -0.06507666f, 0.09551598f, 0.053568836f, 0.06408714f, 0.12835667f, -0.008714329f, -0.20211966f, -0.12093674f, 0.029450472f, 0.2849013f, -0.029227901f, 0.1164364f, -0.08560263f, 0.09941786f, -0.036999565f, -0.028842626f, -0.0033637602f, -0.017012902f, -0.09720865f, -0.11193351f, -0.029155117f, -0.017936034f, -0.009768936f, -0.04223324f, -0.036159635f, 0.06505112f, -0.021742892f, -0.023377212f, -0.07221364f, -0.06430552f, 0.05453865f, 0.091149814f, 0.06387331f, 0.007518393f, 0.055960953f, 0.069779344f, 0.046411168f, 0.10509911f, 0.07463894f, 0.0075130584f, 0.012850982f, 0.04555431f, 0.056955688f, 0.06555285f, 0.050801456f, -0.009862683f, 0.00826772f, -0.026555609f, -0.0073611983f, -0.0014897042f}}, {4, {-0.0998932f, -0.07201956f, -0.052803773f, -0.15629593f, -0.15001918f, -0.07650751f, 0.02359855f, -0.075155355f, -0.08037709f, -0.15093534f, 0.029517552f, -0.04751393f, 0.010350531f, -0.02664851f, -0.016839722f, -0.023121163f, 0.0077019283f, 0.012851257f, -0.05040649f, -0.0129761f, -0.021737747f, -0.038305793f, -0.06870586f, -0.01481247f, -0.001285394f, 0.10124236f, 0.083122835f, 0.053313006f, -0.062235646f, -0.075637154f, -0.027833903f, 0.029774971f, 0.1130802f, 0.09218906f, 0.09506135f, -0.086665764f, -0.037162706f, -0.038880914f, -0.035832845f, -0.014481564f, -0.09825003f, -0.12048569f, -0.097665586f, -0.05287633f, -0.0964047f, -0.11366429f, 0.035777505f, 0.13568819f, 0.052451383f, 0.050649304f, 0.05798951f, -0.021852335f, -0.099848844f, 0.014740475f, -0.078897946f, 0.04974699f, 0.014160473f, 0.06973932f, 0.04964942f, 0.033364646f, 0.08190124f, 0.025535367f, 0.050893165f, 0.048514254f, 0.06945813f, -0.078907564f, -0.06707616f, -0.11844508f, -0.09986688f, -0.07509403f, 0.06263226f, 0.14925587f, 0.20188436f, 0.12098451f, 0.14639415f, 0.0015017595f, -0.014267382f, -0.03417257f, 0.012711468f, 0.0028300495f, -0.024758482f, -0.05098548f, -0.0821182f, 0.014225672f, 0.021544158f, 0.08949725f, 0.07505268f, -0.0020780868f, 0.04908258f, 0.06476295f, -0.022907063f, 0.027562456f, 0.040185735f, 0.019567577f, -0.015598739f, -0.049097303f, -0.017121866f, -0.083368234f, -0.02332002f, -0.0840956f}}, {5, {-0.001374326f, -0.078856036f, 0.10672688f, 0.029162422f, -0.11585556f, 0.02557986f, -0.13446963f, -0.035785314f, -0.01244275f, 0.025961924f, -0.02337298f, -0.044228926f, -0.055839065f, -0.046598054f, -0.010546039f, -0.06900766f, 0.027239809f, 0.022582639f, -0.013296484f, -0.05459212f, 0.08981f, -0.045407712f, 0.08682226f, -0.06867011f, -0.14390695f, -0.02916037f, 0.000996957f, 0.091420636f, 0.14283475f, -0.07390571f, -0.06402044f, 0.062524505f, -0.093129106f, 0.04860203f, -0.08364217f, -0.08119002f, 0.009352075f, 0.22920375f, 0.0016303885f, 0.11583097f, -0.13732095f, 0.012405723f, -0.07551853f, 0.06343048f, 0.12162708f, -0.031923793f, -0.014335606f, 0.01790974f, -0.10650317f, -0.0724401f, 0.08554849f, -0.05727212f, 0.06556731f, -0.042729504f, -0.043227166f, 0.011683251f, -0.013082158f, -0.029302018f, -0.010899579f, -0.062036745f, -0.022509435f, -0.00964907f, -0.01567329f, 0.04260106f, -0.07787477f, -0.11576462f, 0.017356863f, 0.048673786f, -0.017577527f, -0.05527947f, -0.082487635f, -0.040137455f, -0.10820036f, -0.04666372f, 0.022746278f, -0.07851417f, 0.01068115f, 0.032956902f, 0.022433773f, 0.0026891115f, 0.08944216f, -0.0685835f, 0.010513544f, 0.07228705f, 0.02032331f, -0.059686817f, -0.0005566496f, -0.086984694f, 0.040414046f, -0.1380399f, 0.094208956f, -0.05722982f, 0.012092817f, -0.04989123f, -0.086576f, -0.003399834f, -0.04696032f, -0.045747425f, 0.10091314f, 0.048676282f, -0.029037097f, 0.031399418f, -0.0040285117f, 0.047237843f, 0.09504992f, 0.041799378f, -0.049185462f, -0.031518843f, -0.10516937f, 0.026374253f, 0.10058866f, -0.0033195973f, -0.041975245f, 0.0073591834f, 0.0033782164f, -0.004325073f, -0.10167381f, 0.042500053f, -0.01447153f, 0.06464186f, -0.017142897f, 0.03312627f, 0.009205989f, 0.024138335f, -0.011337001f, 0.035530265f, -0.010912711f, 0.0706555f, -0.005894094f, 0.051841937f, -0.1401738f, -0.02351249f, 0.0365468f, 0.07590991f, 0.08838724f, 0.021681072f, -0.10086113f, 0.019608743f, -0.06195883f, 0.077335775f, 0.023646897f, -0.095322326f, 0.02233014f, 0.09756986f, -0.048691444f, -0.009579111f, 0.07595467f, 0.11480546f, -0.09801813f, 0.019894179f, 0.08502348f, 0.004032281f, 0.037211012f, 0.068537936f, -0.048005626f, -0.091520436f, -0.028379958f, -0.01556313f, 0.06554592f, -0.045599163f, -0.01672207f, -0.020169014f, -0.011877351f, -0.20212261f, 0.010889619f, 0.0047078193f, 0.038385306f, 0.08540671f, -0.017140968f, -0.0035865551f, 0.016678626f, 0.005633034f, 0.015963363f, 0.00871737f, 0.060130805f, 0.028611384f, 0.10109069f, -0.015060172f, -0.07894427f, 0.06401885f, 0.011584063f, -0.024466386f, 0.0047652307f, -0.09041358f, 0.030737216f, -0.0046374933f, 0.14215417f, -0.11823516f, 0.019899689f, 0.006106124f, -0.027092824f, 0.0786356f, 0.05052217f, -0.058925f, -0.011402121f, -0.024987547f, -0.0013661642f, -0.06832946f, -0.015667673f, -0.1083353f, -0.00096863037f, -0.06988685f, -0.053350925f, -0.027275559f, -0.033664223f, -0.07978348f, -0.025200296f, -0.017207067f, -0.058403496f, -0.055697463f, 0.005798788f, 0.12965427f, -0.062582195f, 0.0013350133f, -0.10482091f, 0.0379771f, 0.072521195f, -0.0029455067f, -0.13797039f, -0.03628521f, 0.013806405f, -0.017858358f, -0.01008298f, -0.07700066f, -0.017081132f, 0.019358726f, 0.0027079724f, 0.004635139f, 0.062634714f, -0.02338735f, -0.039547626f, -0.02050681f, 0.03385117f, -0.083611414f, 0.002862572f, -0.09421313f, 0.058618143f, -0.08598433f, 0.00972939f, 0.023867095f, -0.053934585f, -0.023203006f, 0.07452513f, -0.048767887f, -0.07314807f, -0.056307215f, -0.10433547f, -0.06440842f, 0.04328182f, 0.04389765f, -0.020006588f, -0.09076438f, -0.11652589f, -0.021705797f, 0.03345259f, -0.010329105f, -0.025767034f, 0.013057034f, -0.07316461f, -0.10145612f, 0.06358255f, 0.18531723f, 0.07759293f, 0.12006465f, 0.1305557f, 0.058638252f, -0.03393652f, 0.09622831f, -0.16253184f, -2.4580743e-06f, 0.079869635f, -0.070196845f, -0.005644518f, 0.06857898f, -0.12598175f, -0.035084512f, 0.03156317f, -0.12794146f, -0.031963028f, 0.04692781f, 0.030070418f, 0.0071660685f, -0.095516115f, -0.004643372f, 0.040170413f, -0.062104587f, -0.0037324072f, 0.0554317f, 0.08184801f, -0.019164372f, 0.06791302f, 0.034257166f, -0.10307039f, 0.021943003f, 0.046745934f, 0.0790918f, -0.0265588f, -0.007824208f, 0.042546265f, -0.00977924f, -0.0002440307f, -0.017384544f, -0.017990116f, 0.12252321f, -0.014512694f, -0.08251313f, 0.08861942f, 0.13589665f, 0.026351685f, 0.012641483f, 0.07466548f, 0.044301085f, -0.045414884f, -0.051112458f, 0.03444247f, -0.08502782f, -0.04106223f, -0.028126027f, 0.028473156f, 0.10467447f}}, {6, {-0.057784554f, -0.026057621f, -0.068447545f, -0.022581743f, 0.14811787f, 0.10826372f, 0.09471067f, 0.03987225f, -0.0039523416f, 0.00030638507f, 0.053185795f, 0.10572994f, 0.08414449f, -0.022036452f, -0.00066928595f, -0.09203576f, 0.032950465f, -0.10985798f, -0.023809856f, 0.0021431844f, -0.02196096f, -0.00326074f, 0.00058621005f, -0.074678116f, -0.06193199f, 0.055729095f, 0.03736828f, 0.020123724f, 0.061878487f, -0.04729229f, 0.034919553f, -0.07585433f, -0.04421272f, -0.044019096f, 0.085488975f, 0.04058006f, -0.06890133f, -0.030951202f, -0.024628663f, -0.07672815f, 0.034293607f, 0.08556707f, -0.05293577f, -0.033561368f, -0.04899627f, 0.0241671f, 0.015736353f, -0.095442444f, -0.029564252f, 0.016493602f, -0.035026584f, 0.022337519f, -0.026871363f, 0.004780428f, 0.0077918363f, -0.03601621f, 0.016435321f, -0.03263031f, -0.09543275f, -0.047392778f, 0.013454138f, 0.028934088f, 0.01685226f, -0.086110644f, -0.046250615f, -0.01847454f, 0.047608484f, 0.07339695f, 0.034546845f, -0.04881143f, 0.009128804f, -0.08802852f, 0.03761666f, 0.008096139f, -0.014454086f, 0.014361001f, -0.023502491f, -0.0011840804f, -0.07607001f, 0.001856849f, -0.06509276f, -0.006021153f, -0.08570962f, -0.1451793f, 0.060212336f, 0.055259194f, 0.06974018f, 0.049454916f, -0.027794661f, -0.08077226f, -0.016179763f, 0.1169753f, 0.17213494f, -0.0056326236f, -0.053934924f, -0.0124349f, -0.11520337f, 0.05409887f, 0.088759385f, 0.0019655675f, 0.0042065294f, 0.03881498f, 0.019844765f, 0.041858196f, -0.05695512f, 0.047233116f, 0.038937137f, -0.06542224f, 0.014429736f, -0.09719407f, 0.13908425f, -0.05379757f, 0.012321099f, 0.082840554f, -0.029899208f, 0.044217527f, 0.059855383f, 0.07711018f, -0.045319796f, 0.0948846f, -0.011724666f, -0.0033288454f, -0.033542685f, -0.04764985f, -0.13873616f, 0.040668588f, 0.034832682f, -0.015319203f, -0.018715994f, 0.046002675f, 0.0599172f, -0.043107376f, 0.0294216f, -0.002314414f, -0.022424703f, 0.0030315618f, 0.0014641669f, 0.0029166266f, -0.11878115f, 0.013738511f, 0.12375372f, -0.0006038222f, 0.029104086f, 0.087442465f, 0.052958444f, 0.07558703f, 0.04817258f, 0.044462286f, -0.015213451f, -0.08783778f, -0.0561384f, -0.003008196f, 0.047060397f, -0.002058388f, 0.03429439f, -0.018839769f, 0.024734668f, 0.024614193f, -0.042046934f, 0.09597743f, -0.0043254104f, 0.04320769f, 0.0064070094f, -0.0019131786f, -0.02558259f, -0.022822596f, -0.023273505f, -0.02464396f, -0.10991725f, -0.006240552f, 0.0074488563f, 0.024044557f, 0.04383914f, -0.046476185f, 0.028658995f, 0.060410924f, 0.050786525f, 0.009452605f, -0.0073054377f, -0.024810238f, 0.0052906186f, 0.0066939713f, -0.0020913032f, 0.014515517f, 0.015898481f, 0.021362653f, -0.030262267f, 0.016587038f, -0.011442813f, 0.041154444f, -0.007631438f, -0.03423484f, -0.010977775f, 0.036152758f, 0.0066366293f, 0.11915515f, 0.02318443f, -0.041350313f, 0.021485701f, -0.10906167f, -0.028218046f, -0.00954771f, 0.020531068f, -0.11995105f, -0.03672871f, 0.024019798f, 0.014255957f, -0.05221243f, -0.00661567f, -0.04630967f, 0.033188973f, 0.10107534f, -0.014027541f, 0.030796422f, -0.10270911f, -0.035999842f, 0.15443139f, 0.07684145f, 0.036571592f, -0.035900835f, -0.0034699554f, 0.06209149f, 0.015920248f, -0.031122351f, -0.03858649f, 0.01849943f, 0.13872518f, 0.01503974f, 0.069941424f, -0.06948533f, -0.0088794185f, 0.061282158f, -0.047401894f, 0.03100163f, -0.041533746f, -0.10430945f, 0.044574402f, -0.01425562f, -0.024290353f, 0.034563623f, 0.05866852f, 0.023947537f, -0.09445152f, 0.035450947f, 0.02247216f, -0.0042998926f, 0.061146557f, -0.10250651f, 0.020881841f, -0.06747029f, 0.10062043f, -0.0023941975f, 0.03532124f, -0.016341697f, 0.09685456f, -0.016764693f, 0.051808182f, 0.05875331f, -0.04536488f, 0.001626336f, -0.028892258f, -0.01048663f, -0.009793449f, -0.017093895f, 0.010987891f, 0.02357273f, -0.00010856845f, 0.0099760275f, -0.001845119f, -0.03551521f, 0.0018358806f, 0.05763657f, -0.01769146f, 0.040995963f, 0.02235177f, -0.060430344f, 0.11475477f, -0.023854522f, 0.10071741f, 0.0686208f, -0.014250481f, 0.034261297f, 0.047418304f, 0.08562733f, -0.030519066f, 0.0060542435f, 0.014653856f, -0.038836084f, 0.04096551f, 0.032249358f, -0.08355519f, -0.026823482f, 0.056386515f, -0.010401743f, -0.028396193f, 0.08507674f, 0.014410365f, 0.020995233f, 0.17040324f, 0.11511526f, 0.02459721f, 0.0066619175f, 0.025853224f, -0.023133837f, -0.081302024f, 0.017264642f, -0.009585969f, 0.09491168f, -0.051313367f, 0.054532815f, -0.014298593f, 0.10657464f, 0.007076659f, 0.10964551f, 0.0409152f, 0.008275321f, -0.07283536f, 0.07937492f, 0.04192024f, -0.1075027f}}, {7, {-0.037322544f, 0.018592842f, 0.0056175636f, -0.06253426f, 0.055647098f, -0.05713207f, -0.05626563f, 0.005559383f, 0.03375411f, -0.025757805f, -0.088049285f, 0.06017052f, -0.06570978f, 0.007384076f, 0.035123326f, -0.07920549f, 0.053676967f, 0.044480428f, -0.07663568f, 0.0071805613f, 0.08089997f, 0.05143358f, 0.038261272f, 0.03339287f, -0.027673481f, 0.044746667f, 0.028349208f, 0.020090483f, -0.019443132f, -0.030755889f, -0.0040000007f, 0.04465846f, -0.021585021f, 0.0031670958f, 0.0053199246f, -0.056117613f, -0.10893326f, 0.076739706f, -0.08509834f, -0.027997585f, 0.037871376f, 0.01449768f, -0.09002357f, -0.06111149f, -0.046195522f, 0.0422062f, -0.005683705f, -0.1253618f, -0.012925729f, -0.04890792f, 0.06985068f, 0.037654128f, 0.03398274f, -0.004781977f, 0.007032333f, -0.031787455f, 0.010868644f, -0.031489216f, 0.09525667f, 0.013939797f, 0.0058680447f, 0.0167067f, 0.02668468f, -0.04797466f, -0.048885044f, -0.12722108f, 0.035304096f, 0.06554885f, 0.00972396f, -0.039238118f, -0.05159735f, -0.11329045f, 0.1613692f, -0.03750952f, 0.06529313f, -0.071974665f, -0.11769596f, 0.015524369f, -0.0013754242f, -0.12446318f, 0.02786344f, -0.014179351f, 0.005264273f, 0.14376344f, 0.015983658f, 0.03406988f, -0.06939408f, 0.040699873f, 0.02111075f, 0.09669095f, 0.041345075f, -0.08316494f, -0.07684199f, -0.045768797f, 0.032298047f, -0.041805092f, 0.0119405f, 0.0061010392f, 0.12652606f, 0.0064572375f, -0.024950314f, 0.11574242f, 0.04508852f, -0.04335324f, 0.06760663f, -0.027437469f, 0.07216407f, 0.06977076f, -0.05438599f, 0.034033038f, -0.028602652f, 0.05346137f, 0.043184172f, -0.037189785f, 0.10420091f, 0.00882477f, -0.054019816f, -0.074273005f, -0.030617684f, -0.0028467078f, 0.024302477f, -0.0038869337f, 0.005332455f, 0.0013399826f, 0.04361412f, -0.007001822f, 0.09631092f, -0.06702025f, -0.042049985f, -0.035070654f, -0.04103342f, -0.10273396f, 0.0544271f, 0.037184782f, -0.13150354f, -0.0058036847f, -0.008264958f, 0.042035464f, 0.05891794f, 0.029673764f, 0.0063542654f, 0.044788733f, 0.054816857f, 0.062257513f, -0.00093483756f, 0.048938446f, -0.004952862f, -0.007730018f, -0.04043371f, -0.017094059f, 0.07229206f, -0.023670016f, -0.052195564f, -0.025616996f, -0.01520939f, 0.045104615f, -0.007376126f, 0.003533447f, 0.006570588f, 0.056037236f, 0.12436656f, 0.051817212f, 0.028532185f, -0.08686856f, 0.11868599f, 0.07663395f, -0.07323171f, 0.03463402f, -0.050708205f, -0.04458982f, -0.11590894f, 0.021273347f, 0.1251325f, -0.15313013f, -0.12224372f, 0.17228661f, 0.023029093f, 0.086124025f, 0.006445803f, -0.03496501f, 0.028332196f, 0.04449512f, -0.042436164f, -0.026587414f, -0.006041347f, -0.09292539f, -0.05678812f, 0.03897832f, 0.09465633f, 0.008115513f, -0.02171956f, 0.08304309f, 0.071401566f, 0.019622514f, 0.032163795f, -0.004167056f, 0.02295182f, 0.030739572f, 0.056506045f, 0.004612461f, 0.06524936f, 0.059999723f, 0.046395954f, -0.0045512207f, -0.1335546f, -0.030136576f, 0.11584653f, -0.014678886f, 0.0020118146f, -0.09688814f, -0.0790206f, 0.039770417f, -0.0329582f, 0.07922767f, 0.029322514f, 0.026405897f, 0.04207835f, -0.07073373f, 0.063781224f, 0.0859677f, -0.10925287f, -0.07011058f, 0.048005477f, 0.03438226f, -0.09606514f, -0.006669445f, -0.043381985f, 0.04240257f, -0.06955775f, -0.06769346f, 0.043903265f, -0.026784198f, -0.017840602f, 0.024307009f, -0.040079936f, -0.019946516f, 0.045318738f, -0.12233574f, 0.026170589f, 0.0074471775f, 0.15978073f, 0.10185836f, 0.10298046f, -0.015476589f, -0.039390966f, -0.072174534f, 0.0739445f, -0.1211869f, -0.0347889f, -0.07943156f, 0.014809798f, -0.12412325f, -0.0030663363f, 0.039695457f, 0.0647603f, -0.08291318f, -0.018529687f, -0.004423833f, 0.0037507233f, 0.084633216f, -0.01514876f, -0.056505352f, -0.012800942f, -0.06994386f, 0.012962922f, -0.031234352f, 0.07029052f, 0.016418684f, 0.03618972f, 0.055686004f, -0.08663945f, -0.017404709f, -0.054761406f, 0.029065743f, 0.052404847f, 0.020238016f, 0.0048197987f, -0.0214882f, 0.07078733f, 0.013016777f, 0.06262858f, 0.009184685f, 0.020785125f, -0.043904778f, -0.0270329f, -0.03299152f, -0.060088247f, -0.015162964f, -0.001828936f, 0.12642565f, -0.056757294f, 0.013586685f, 0.09232601f, -0.035886683f, 0.06000002f, 0.05229691f, -0.052580316f, -0.082029596f, -0.010794592f, 0.012947712f, -0.036429964f, -0.085508935f, -0.13127148f, -0.017744139f, 0.031502828f, 0.036232427f, -0.031581745f, 0.023051167f, -0.05325106f, -0.03421577f, 0.028793324f, -0.034633752f, -0.009881397f, -0.043551125f, -0.018609839f, 0.0019097115f, -0.008799762f, 0.056595087f, 0.0022273948f, 0.055752404f}}, {8, {0.025825322f, -0.05813119f, 0.09495884f, -0.045984812f, -0.01255415f, -0.0026479573f, -0.08196161f, -0.054914974f, -0.0046604523f, -0.029587349f, -0.044576716f, -0.07480124f, -0.082868785f, 0.023254942f, 0.027502948f, -0.0039728214f, -0.08683098f, -0.08116779f, -0.014675607f, -0.037924774f, -0.023314456f, -0.007401714f, -0.09255757f, 0.029460307f, -0.08829125f, -0.005139627f, -0.08989442f, -0.0555066f, 0.13596267f, -0.025062224f, -0.048351806f, -0.03850004f, 0.07266485f, -0.022414139f, 0.05940088f, 0.075114764f, 0.09597592f, -0.010211725f, -0.0049794707f, -0.011523867f, -0.025980417f, 0.072999895f, 0.11091378f, -0.081685916f, 0.014416728f, 0.043229222f, 0.034178585f, -0.07530371f, 0.035837382f, -0.085607f, -0.007721233f, -0.03287832f, -0.043848954f, -0.06404588f, -0.06632928f, -0.073643476f, 0.008214239f, -0.045984086f, 0.039764922f, 0.03474462f, 0.060612556f, -0.080590084f, 0.049127717f, 0.04151091f, -0.030063879f, 0.008801774f, -0.023021035f, -0.019558564f, 0.05158114f, -0.010947698f, -0.011825728f, 0.0075720972f, 0.0699727f, -0.0039981045f, 0.069350146f, 0.08799282f, 0.016156472f, 0.035502106f, 0.11695009f, 0.006217345f, 0.13392477f, -0.037875112f, 0.025745004f, 0.08940699f, -0.00924166f, 0.0046702605f, -0.036598757f, -0.08811812f, 0.10522024f, -0.032441203f, 0.008176899f, -0.04454919f, 0.07058152f, 0.0067963637f, 0.039206743f, 0.03259838f, 0.03725492f, -0.09515802f, 0.013326398f, -0.052055415f, -0.025676316f, 0.03198509f, -0.015951829f, -0.058556724f, 0.036879618f, 0.043357447f, 0.028362012f, -0.05908629f, 0.0059240665f, -0.04995891f, -0.019187413f, 0.0276265f, -0.01628143f, 0.0025863599f, 0.08800015f, 0.035250366f, -0.022165963f, -0.07328642f, -0.009415526f, -0.07455109f, 0.11690406f, 0.0363299f, 0.07411125f, 0.042103454f, -0.009660886f, 0.019076364f, 0.018299393f, -0.046004917f, 0.08891175f, 0.0431396f, -0.026327137f, -0.051502608f, 0.08979574f, -0.051670972f, 0.04940282f, -0.07491107f, -0.021240504f, 0.022596184f, -0.034280192f, 0.060163025f, -0.058211457f, -0.051837247f, -0.01349775f, -0.04639988f, -0.035936575f, -0.011681591f, 0.064818054f, 0.0073146066f, -0.021745546f, -0.043124277f, -0.06471268f, -0.07053354f, -0.029321948f, -0.05330136f, 0.016933719f, -0.053782392f, 0.13747959f, -0.1361751f, -0.11569455f, 0.0033329215f, 0.05693899f, -0.053219706f, 0.063698f, 0.07977434f, -0.07924483f, 0.06936997f, 0.0034815092f, -0.007305279f, -0.037325785f, -0.07251102f, -0.033633437f, -0.08677009f, 0.091591336f, -0.14165086f, 0.021752775f, 0.019683983f, 0.0011612234f, -0.058154266f, 0.049996935f, 0.0288841f, -0.0024567875f, -0.14345716f, 0.010955264f, -0.10234828f, 0.1183656f, -0.0010731248f, -0.023590032f, -0.072285876f, -0.0724771f, -0.026382286f, -0.0014920527f, 0.042667855f, 0.0018776858f, 0.02986552f, 0.009814309f, 0.0733756f, 0.12289186f, 0.018043943f, -0.0458958f, 0.049412545f, 0.033632483f, 0.05495232f, 0.036686596f, -0.013781798f, -0.010036754f, 0.02576849f, -0.08307328f, 0.010112348f, 0.042521734f, -0.05869831f, -0.071689695f, 0.03876447f, -0.13275425f, -0.0352966f, -0.023077697f, 0.10285965f, 0.084736146f, 0.15568255f, -0.00040734606f, 0.027835453f, -0.10292561f, -0.032401145f, 0.10053256f, -0.026142767f, -0.08271222f, -0.0030240538f, -0.016368777f, 0.1070414f, 0.042672627f, 0.013456989f, -0.0437609f, -0.022309763f, 0.11576483f, 0.04108048f, 0.061026827f, -0.0190714f, -0.0869359f, 0.037901703f, 0.0610107f, 0.07202949f, 0.01675338f, 0.086139716f, -0.08795751f, -0.014898893f, -0.023771819f, -0.01965048f, 0.007955471f, -0.043740474f, 0.03346837f, -0.10549954f, 0.090567775f, 0.042013682f, -0.03176985f, 0.12569028f, -0.02421228f, -0.029526481f, 0.023851605f, 0.031539805f, 0.05292009f, -0.02344001f, -0.07811758f, -0.08834428f, 0.10094801f, 0.16594367f, -0.06861939f, -0.021256343f, -0.041093912f, -0.06669611f, 0.035498552f, 0.021757556f, -0.09302526f, -0.015403468f, -0.06614931f, -0.051798206f, -0.013874718f, 0.03630673f, 0.010412845f, -0.08077351f, 0.046185967f, 0.0035662893f, 0.03541868f, -0.094149634f, -0.034814864f, 0.003128424f, -0.020674974f, -0.03944324f, -0.008110165f, -0.11113267f, 0.08484226f, 0.043586485f, 0.040582247f, 0.0968012f, -0.065249965f, -0.028036479f, 0.0050708856f, 0.0017462453f, 0.0326779f, 0.041296225f, 0.09164146f, -0.047743853f, -0.015952192f, -0.034451712f, 0.084197424f, -0.05347844f, -0.11768019f, 0.085926116f, -0.08251791f, -0.045081906f, 0.0948852f, 0.068401024f, 0.024856757f, 0.06978981f, -0.057309967f, -0.012775832f, -0.0032452994f, 0.01977615f, -0.041040014f, -0.024264973f, 0.063464895f, 0.05431621f}}, {9, {0.040369894f, 0.030746894f, 0.24704495f, 0.018586371f, -0.037586458f, -0.15312155f, -0.11812848f, -0.11465643f, 0.20259799f, 0.11418174f, -0.10116027f, -0.011334949f, 0.12411352f, -0.076769054f, -0.052169047f, 0.21198851f, -0.38871562f, -0.09061183f, -0.09683246f, -0.21929175f}}, {10, {-0.01998659f, -0.15568835f, -0.24248174f, -0.012770197f, 0.041331276f, -0.072311886f, -0.052123554f, -0.0066330447f, -0.043891653f, 0.036225766f, -0.047248036f, 0.021479502f, 0.033189066f, 0.11952997f, -0.020432774f, 0.64658105f, -0.06650122f, -0.03467612f, 0.095340036f, 0.23647355f}}, {11, {0.08286371f, -0.08261836f, -0.51210177f, 0.002913762f, 0.17764764f, -0.5495371f, -0.08460716f, -0.24552552f, 0.030037103f, 0.04123544f, -0.11940523f, 0.007358328f, 0.1890978f, 0.4833202f, -0.34441817f, 0.36312827f, -0.26375428f, 0.1457655f, -0.19724406f, 0.15548733f}}, {12, {0.02234832f, 0.14757581f, 0.18176508f, 0.10380666f, 0.053110216f, -0.06928846f, -0.13942584f, -0.11816189f, 0.19483899f, 0.03652339f, -0.10250295f, 0.036714908f, -0.18426876f, 0.036065217f, 0.21810818f, 0.02383196f, -0.043370757f, 0.08690144f, -0.04444982f, 0.00030581196f}}, {13, {0.035185695f, -0.042891346f, -0.03032477f, 0.23027696f, 0.11098921f, 0.15378423f, 0.09263801f, 0.09790885f, 0.09508917f, 0.061199076f, 0.07665568f, -0.015443159f, -0.03499149f, 0.046190713f, 0.08895977f, 0.10899629f, 0.40694186f, 0.06030037f, 0.012413437f, -0.06108739f}}, {14, {-0.024379363f, 0.0055531194f, 0.23377132f, 0.033463873f, -0.1483596f, -0.10639995f, -0.091433935f, 0.058573797f, -0.06809782f, -0.07889636f, -0.043246906f, -0.09829136f, -0.4279842f, 0.034901652f, 0.18797937f, 0.0075234566f, 0.016178843f, 0.1749513f, 0.13975595f, 0.92058027f}}, {15, {0.046159424f, -0.0012809046f, 0.03563469f, 0.12648113f, 0.027195795f, 0.35373217f, -0.018957434f, 0.008907322f, -0.0762701f, 0.12018895f, 0.04216877f, 0.0022856654f, 0.040952638f, 0.3147856f, 0.08225149f, -0.057416286f, -0.14995944f, -0.008040261f, 0.13208859f, 0.029760877f}}, {16, {-0.009802181f, 0.09401916f, 0.0717386f, -0.13895074f, 0.09641832f, 0.060420845f, 0.08539281f, 0.054285463f, 0.061395317f, 0.034448683f, -0.042991187f, 0.019801661f, -0.16840284f, -0.015726732f, -0.23041931f, -0.024478018f, -0.10959692f, -0.013875541f, 0.18600968f, -0.061274476f, 0.0138165f, -0.08160894f, -0.07661644f, 0.032372914f, 0.16169067f, 0.22465782f, -0.03993472f, -0.004017731f, 0.08633481f, -0.28869787f, 0.08682067f, 0.17240396f, 0.014975425f, 0.056431185f, 0.031037588f, 0.16702051f, 0.0077946745f, 0.15140012f, 0.29405436f, 0.120285f, -0.188994f, -0.027265169f, 0.043389652f, -0.022061434f, 0.014777949f, -0.20203483f, 0.094781205f, 0.19100232f, 0.13987629f, -0.036132768f, -0.06426278f, -0.05108664f, 0.13221376f, 0.009441198f, -0.16715929f, 0.15859416f, -0.040437475f, 0.050779544f, -0.022187516f, 0.012166504f, 0.027685808f, -0.07675938f, -0.0055694645f, -0.09444123f, 0.0046453946f, 0.050794356f, 0.10770313f, -0.20790008f, -0.07149004f, -0.11425117f, 0.008225835f, -0.035802525f, 0.14374903f, 0.15262283f, 0.048710253f, 0.1847461f, -0.007487823f, 0.11000021f, -0.09542012f, 0.22619456f, -0.029149994f, 0.08527916f, 0.009043713f, 0.0042746216f, 0.016261552f, 0.022461696f, 0.12689082f, -0.043589946f, -0.12035478f, -0.08361797f, -0.050666027f, -0.1248618f, -0.1275799f, -0.071875185f, 0.07377272f, 0.09944291f, -0.18897448f, -0.1593054f, -0.06526116f, -0.040107165f, -0.004618631f, -0.067624845f, -0.007576253f, 0.10727444f, 0.041546922f, -0.20424393f, 0.06907816f, 0.050412357f, 0.00724631f, 0.039827548f, 0.12449835f, 0.10747581f, 0.13708383f, 0.09134148f, -0.12617786f, -0.06428341f, 0.09956831f, 0.1208086f, -0.14676677f, -0.0727722f, 0.1126304f, 0.010139365f, 0.015571211f, -0.038128063f, 0.022913318f, -0.042050496f, 0.16842307f, -0.060597885f, 0.10531834f, -0.06411776f, -0.07451711f, -0.03410368f, -0.13393489f, 0.06534304f, 0.003620307f, 0.04490757f, 0.05970546f, 0.05197996f, 0.02839995f, 0.10434969f, -0.013699693f, -0.028353551f, -0.07260381f, 0.047201227f, -0.024575593f, -0.036445823f, 0.07155557f, 0.009672501f, -0.02328883f, 0.009533515f, -0.03606021f, -0.07421458f, -0.028082801f, -0.2678904f, -0.13221288f, 0.18419984f, -0.13012612f, -0.014588381f, -0.035059117f, -0.04824723f, 0.07830115f, -0.056184657f, 0.03277091f, 0.025466874f, 0.14494097f, -0.12522776f, -0.098633975f, -0.10766018f, -0.08317623f, 0.08594209f, 0.07749552f, 0.039474737f, 0.1776665f, -0.07409566f, -0.0477268f, 0.29323658f, 0.10801441f, 0.1154011f, 0.013952499f, 0.10739139f, 0.10708251f, -0.051456142f, 0.0074137426f, -0.10430189f, 0.10034707f, 0.045594677f, 0.0635285f, -0.0715442f, -0.089667566f, -0.10811871f, 0.00026344223f, 0.08298446f, -0.009525053f, 0.006585689f, -0.24567553f, -0.09450807f, 0.09648481f, 0.026996298f, -0.06419476f, -0.04752702f, -0.11063944f, -0.23441927f, -0.17608605f, -0.052156363f, 0.067035615f, 0.19271925f, -0.0032889997f, -0.043264326f, 0.09663576f, -0.057112187f, -0.10100678f, 0.0628376f, 0.04447668f, 0.017961001f, -0.10094388f, -0.10190601f, 0.18335468f, 0.10494553f, -0.052095775f, -0.0026118709f, 0.10539724f, -0.04383912f, -0.042349473f, 0.08438151f, -0.1947263f, 0.02251204f, 0.11216432f, -0.10307853f, 0.17351969f, -0.039091777f, 0.08066188f, -0.00561982f, 0.12633002f, 0.11335965f, -0.0088127935f, -0.019777594f, 0.06864014f, -0.059751723f, 0.016233567f, -0.06894641f, -0.28651384f, -0.004228674f, 0.019708522f, -0.16305895f, -0.07468996f, -0.0855457f, 0.099339016f, -0.07580735f, -0.13775392f, 0.08434318f, 0.08330512f, -0.12131499f, 0.031935584f, 0.09180414f, -0.08876437f, -0.08049874f, 0.008753825f, 0.03498998f, 0.030215185f, 0.03907079f, 0.089751154f, 0.029194152f, -0.03337423f, -0.019092513f, 0.04331237f, 0.04299654f, -0.036394123f, -0.12915532f, 0.09793732f, 0.07512415f, -0.11319543f, -0.032502122f, 0.15661901f, 0.07671967f, -0.005491124f, -0.19379048f, -0.218606f, 0.21448623f, 0.017840758f, 0.1416943f, -0.07051762f, 0.19488361f, 0.02664691f, -0.18104725f, -0.09334311f, 0.15026465f, -0.15493552f, -0.057762887f, -0.11604192f, -0.262013f, -0.01391798f, 0.012185008f, 0.11156489f, -0.07483202f, 0.06693364f, -0.26151478f, 0.046425626f, 0.036540434f, -0.16435726f, 0.17338543f, -0.21401681f, -0.11385144f, -0.08283257f, -0.069031075f, 0.030635102f, 0.010969227f, 0.11109743f, 0.010919218f, 0.027526086f, 0.13519906f, 0.01891392f, -0.046839405f, -0.040167913f, 0.017953383f, -0.09700955f, 0.0061885654f, -0.07000971f, 0.026893595f, -0.038844477f, 0.14543656f}}, {17, {}}, {18, {-0.0213783f, 0.0350169f, 0.000324787f, 0.0276012f, -0.0263374f, -0.0371449f, 0.0446149f, -0.0205474f, 0.0103729f, -0.0576349f, -0.0150052f, -0.0292043f, 0.0376827f, 0.0136115f, 0.0243435f, 0.0354492f, -0.0204549f, 0.0450315f, -0.00117379f, 0.0167673f, -0.0375007f, -0.0238314f, 0.038784f, -0.0174034f, 0.0131743f, -0.0506589f, -0.00484469f, -0.0240239f, 0.0325789f, 0.00790064f, 0.0220157f, 0.0333314f}}, {19, {-0.126572f, -0.121882f, 0.121569f, 0.0489971f, -0.240177f, -0.124685f, -0.122565f, 0.0162748f, 0.0317536f, -0.0270355f, 0.0418199f, -0.179755f, -0.327279f, -0.0342741f, 0.133831f, -0.0238279f, 0.122148f, 0.269115f, 0.185989f, 0.525976f, -0.167208f, -0.109612f, 0.0531226f, 0.0695387f, -0.248335f, -0.134123f, -0.108246f, 0.00628498f, 0.0492984f, -0.0264919f, 0.0698144f, -0.0635602f, -0.295363f, -0.0760078f, 0.102725f, -0.0351708f, 0.149804f, 0.259131f, 0.202573f, 0.500664f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, {2, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, {3, {-0.0189322f, 0.0464512f, -0.00251373f, 0.0225745f, -0.0308346f, -0.0317124f, 0.0460407f, -0.0189395f, 0.0149363f, -0.0530162f, -0.0150767f, -0.0340193f, 0.0286833f, 0.00824207f, 0.0264887f, 0.0305169f, -0.0264787f, 0.0387855f, -0.000764675f, 0.0217599f, -0.037537f, -0.0335206f, 0.0431679f, -0.0211424f, 0.010203f, -0.062785f, -0.00832363f, -0.025181f, 0.0412031f, 0.0118723f, 0.0239643f, 0.0394009f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/lstm_state.example.cpp b/nn/runtime/test/generated/examples/lstm_state.example.cpp
new file mode 100644
index 000000000..2a8c9c449
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm_state.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm_state.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {3.0f, 4.0f}}, {1, {-0.45018822f, -0.02338299f, -0.0870589f, -0.34550029f, 0.04266912f, -0.15680569f, -0.34856534f, 0.43890524f}}, {2, {0.09701663f, 0.20334584f, -0.50592935f, -0.31343272f, -0.40032279f, 0.44781327f, 0.01387155f, -0.35593212f}}, {3, {-0.50013041f, 0.1370284f, 0.11810488f, 0.2013163f, -0.20583314f, 0.44344562f, 0.22077113f, -0.29909778f}}, {4, {-0.25065863f, -0.28290087f, 0.04613829f, 0.40525138f, 0.44272184f, 0.03897077f, -0.1556896f, 0.19487578f}}, {5, {-0.0063535f, -0.2042388f, 0.31454784f, -0.35746509f, 0.28902304f, 0.08183324f, -0.16555229f, 0.02286911f, -0.13566875f, 0.03034258f, 0.48091322f, -0.12528998f, 0.24077177f, -0.51332325f, -0.33502164f, 0.10629296f}}, {6, {-0.48684245f, -0.06655136f, 0.42224967f, 0.2112639f, 0.27654213f, 0.20864892f, -0.07646349f, 0.45877004f, 0.00141793f, -0.14609534f, 0.36447752f, 0.09196436f, 0.28053468f, 0.01560611f, -0.20127171f, -0.01140004f}}, {7, {-0.3407414f, 0.24443203f, -0.2078532f, 0.26320225f, 0.05695659f, -0.00123841f, -0.4744786f, -0.35869038f, -0.06418842f, -0.13502428f, -0.501764f, 0.22830659f, -0.46367589f, 0.26016325f, -0.03894562f, -0.16368064f}}, {8, {0.43385774f, -0.17194885f, 0.2718237f, 0.09215671f, 0.24107647f, -0.39835793f, 0.18212086f, 0.01301402f, 0.48572797f, -0.50656658f, 0.20047462f, -0.20607421f, -0.51818722f, -0.15390486f, 0.0468148f, 0.39922136f}}, {9, {}}, {10, {}}, {11, {}}, {12, {0.0f, 0.0f, 0.0f, 0.0f}}, {13, {1.0f, 1.0f, 1.0f, 1.0f}}, {14, {0.0f, 0.0f, 0.0f, 0.0f}}, {15, {0.0f, 0.0f, 0.0f, 0.0f}}, {16, {}}, {17, {}}, {18, {-0.0297319f, 0.122947f, 0.208851f, -0.153588f}}, {19, {-0.145439f, 0.157475f, 0.293663f, -0.277353f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {-0.0371611f, 0.125073f, 0.411934f, -0.208605f}}, {2, {-0.287121f, 0.148115f, 0.556837f, -0.388276f}}, {3, {-0.03716109f, 0.12507336f, 0.41193449f, -0.20860538f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/lstm_state2.example.cpp b/nn/runtime/test/generated/examples/lstm_state2.example.cpp
new file mode 100644
index 000000000..c67c7d537
--- /dev/null
+++ b/nn/runtime/test/generated/examples/lstm_state2.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: lstm_state2.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {1.0f, 1.0f}}, {1, {-0.45018822f, -0.02338299f, -0.0870589f, -0.34550029f, 0.04266912f, -0.15680569f, -0.34856534f, 0.43890524f}}, {2, {0.09701663f, 0.20334584f, -0.50592935f, -0.31343272f, -0.40032279f, 0.44781327f, 0.01387155f, -0.35593212f}}, {3, {-0.50013041f, 0.1370284f, 0.11810488f, 0.2013163f, -0.20583314f, 0.44344562f, 0.22077113f, -0.29909778f}}, {4, {-0.25065863f, -0.28290087f, 0.04613829f, 0.40525138f, 0.44272184f, 0.03897077f, -0.1556896f, 0.19487578f}}, {5, {-0.0063535f, -0.2042388f, 0.31454784f, -0.35746509f, 0.28902304f, 0.08183324f, -0.16555229f, 0.02286911f, -0.13566875f, 0.03034258f, 0.48091322f, -0.12528998f, 0.24077177f, -0.51332325f, -0.33502164f, 0.10629296f}}, {6, {-0.48684245f, -0.06655136f, 0.42224967f, 0.2112639f, 0.27654213f, 0.20864892f, -0.07646349f, 0.45877004f, 0.00141793f, -0.14609534f, 0.36447752f, 0.09196436f, 0.28053468f, 0.01560611f, -0.20127171f, -0.01140004f}}, {7, {-0.3407414f, 0.24443203f, -0.2078532f, 0.26320225f, 0.05695659f, -0.00123841f, -0.4744786f, -0.35869038f, -0.06418842f, -0.13502428f, -0.501764f, 0.22830659f, -0.46367589f, 0.26016325f, -0.03894562f, -0.16368064f}}, {8, {0.43385774f, -0.17194885f, 0.2718237f, 0.09215671f, 0.24107647f, -0.39835793f, 0.18212086f, 0.01301402f, 0.48572797f, -0.50656658f, 0.20047462f, -0.20607421f, -0.51818722f, -0.15390486f, 0.0468148f, 0.39922136f}}, {9, {}}, {10, {}}, {11, {}}, {12, {0.0f, 0.0f, 0.0f, 0.0f}}, {13, {1.0f, 1.0f, 1.0f, 1.0f}}, {14, {0.0f, 0.0f, 0.0f, 0.0f}}, {15, {0.0f, 0.0f, 0.0f, 0.0f}}, {16, {}}, {17, {}}, {18, {-0.0371611f, 0.125073f, 0.411934f, -0.208605f}}, {19, {-0.287121f, 0.148115f, 0.556837f, -0.388276f}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {0, 0, 0, 0}}, {2, {0, 0, 0, 0}}, {3, {-0.15053082f, 0.09120187f, 0.24278517f, -0.12222792f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/rnn_state.example.cpp b/nn/runtime/test/generated/examples/rnn_state.example.cpp
new file mode 100644
index 000000000..d62b30e98
--- /dev/null
+++ b/nn/runtime/test/generated/examples/rnn_state.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: rnn_state.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {-0.69424844f, -0.93421471f, -0.87287879f, 0.37144363f, -0.62476718f, 0.23791671f, 0.40060222f, 0.1356622f, -0.69424844f, -0.93421471f, -0.87287879f, 0.37144363f, -0.62476718f, 0.23791671f, 0.40060222f, 0.1356622f}}, {1, {0.461459f, 0.153381f, 0.529743f, -0.00371218f, 0.676267f, -0.211346f, 0.317493f, 0.969689f, -0.343251f, 0.186423f, 0.398151f, 0.152399f, 0.448504f, 0.317662f, 0.523556f, -0.323514f, 0.480877f, 0.333113f, -0.757714f, -0.674487f, -0.643585f, 0.217766f, -0.0251462f, 0.79512f, -0.595574f, -0.422444f, 0.371572f, -0.452178f, -0.556069f, -0.482188f, -0.685456f, -0.727851f, 0.841829f, 0.551535f, -0.232336f, 0.729158f, -0.00294906f, -0.69754f, 0.766073f, -0.178424f, 0.369513f, -0.423241f, 0.548547f, -0.0152023f, -0.757482f, -0.85491f, 0.251331f, -0.989183f, 0.306261f, -0.340716f, 0.886103f, -0.0726757f, -0.723523f, -0.784303f, 0.0354295f, 0.566564f, -0.485469f, -0.620498f, 0.832546f, 0.697884f, -0.279115f, 0.294415f, -0.584313f, 0.548772f, 0.0648819f, 0.968726f, 0.723834f, -0.0080452f, -0.350386f, -0.272803f, 0.115121f, -0.412644f, -0.824713f, -0.992843f, -0.592904f, -0.417893f, 0.863791f, -0.423461f, -0.147601f, -0.770664f, -0.479006f, 0.654782f, 0.587314f, -0.639158f, 0.816969f, -0.337228f, 0.659878f, 0.73107f, 0.754768f, -0.337042f, 0.0960841f, 0.368357f, 0.244191f, -0.817703f, -0.211223f, 0.442012f, 0.37225f, -0.623598f, -0.405423f, 0.455101f, 0.673656f, -0.145345f, -0.511346f, -0.901675f, -0.81252f, -0.127006f, 0.809865f, -0.721884f, 0.636255f, 0.868989f, -0.347973f, -0.10179f, -0.777449f, 0.917274f, 0.819286f, 0.206218f, -0.00785118f, 0.167141f, 0.45872f, 0.972934f, -0.276798f, 0.837861f, 0.747958f, -0.0151566f, -0.330057f, -0.469077f, 0.277308f, 0.415818f}}, {2, {0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1f}}, {3, {0.065691948f, -0.69055247f, 0.1107955f, -0.97084129f, -0.23957068f, -0.23566568f, -0.389184f, 0.47481549f, -0.4791103f, 0.29931796f, 0.10463274f, 0.83918178f, 0.37197268f, 0.61957061f, 0.3956964f, -0.37609905f}}, {4, {0.496726f, 0, 0.965996f, 0, 0.0584256f, 0, 0, 0.12315f, 0, 0, 0.612267f, 0.456601f, 0, 0.52286f, 1.16099f, 0.0291233f, 0.496726f, 0, 0.965996f, 0, 0.0584256f, 0, 0, 0.12315f, 0, 0, 0.612267f, 0.456601f, 0, 0.52286f, 1.16099f, 0.0291233f}}},
+ // int -> INT32 map
+ {{5, {1}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {0, 0, 0.524902f, 0, 0, 0, 0, 1.02116f, 0, 1.35762f, 0, 0.356909f, 0.436415f, 0.0355731f, 0, 0, 0, 0, 0.524902f, 0, 0, 0, 0, 1.02116f, 0, 1.35762f, 0, 0.356909f, 0.436415f, 0.0355731f, 0, 0}}, {1, {0, 0, 0.524901f, 0, 0, 0, 0, 1.02116f, 0, 1.35762f, 0, 0.356909f, 0.436415f, 0.0355727f, 0, 0, 0, 0, 0.524901f, 0, 0, 0, 0, 1.02116f, 0, 1.35762f, 0, 0.356909f, 0.436415f, 0.0355727f, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/space_to_depth_float_3.example.cpp b/nn/runtime/test/generated/examples/space_to_depth_float_3.example.cpp
new file mode 100644
index 000000000..ef6928b25
--- /dev/null
+++ b/nn/runtime/test/generated/examples/space_to_depth_float_3.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: space_to_depth_float_3.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {10, 20, 11, 21, 12, 22, 13, 23, 14, 24, 15, 25, 16, 26, 17, 27, 18, 28, 19, 29, 110, 210, 111, 211, 112, 212, 113, 213, 114, 214, 115, 215}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {10, 20, 11, 21, 14, 24, 15, 25, 12, 22, 13, 23, 16, 26, 17, 27, 18, 28, 19, 29, 112, 212, 113, 213, 110, 210, 111, 211, 114, 214, 115, 215}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/examples/svdf_state.example.cpp b/nn/runtime/test/generated/examples/svdf_state.example.cpp
new file mode 100644
index 000000000..ffe02125c
--- /dev/null
+++ b/nn/runtime/test/generated/examples/svdf_state.example.cpp
@@ -0,0 +1,22 @@
+// Generated file (from: svdf_state.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {0.14278367f, -1.64410412f, -0.75222826f, 0.14278367f, -1.64410412f, -0.75222826f}}, {1, {-0.31930989f, -0.36118156f, 0.0079667f, 0.37613347f, 0.22197971f, 0.12416199f, 0.27901134f, 0.27557442f, 0.3905206f, -0.36137494f, -0.06634006f, -0.10640851f}}, {2, {-0.31930989f, 0.37613347f, 0.27901134f, -0.36137494f, -0.36118156f, 0.22197971f, 0.27557442f, -0.06634006f, 0.0079667f, 0.12416199f, 0.3905206f, -0.10640851f, -0.0976817f, 0.15294972f, 0.39635518f, -0.02702999f, 0.39296314f, 0.15785322f, 0.21931258f, 0.31053296f, -0.36916667f, 0.38031587f, -0.21580373f, 0.27072677f, 0.23622236f, 0.34936687f, 0.18174365f, 0.35907319f, -0.17493086f, 0.324846f, -0.10781813f, 0.27201805f, 0.14324132f, -0.23681851f, -0.27115166f, -0.01580888f, -0.14943552f, 0.15465137f, 0.09784451f, -0.0337657f}}, {3, {}}, {4, {0, 0, 0, 0, 0, 0, 0, 0, 0.119996f, 0, 0, 0, 0, 0, 0, 0, 0, -0.166701f, 0, 0, 0, 0, 0, 0, 0, 0, -0.44244f, 0, 0, 0, 0, 0, 0, 0, 0, 0.0805206f, 0, 0, 0, 0, 0, 0, 0, 0, 0.119996f, 0, 0, 0, 0, 0, 0, 0, 0, -0.166701f, 0, 0, 0, 0, 0, 0, 0, 0, -0.44244f, 0, 0, 0, 0, 0, 0, 0, 0, 0.0805206f, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {{5, {1}}, {6, {0}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {0.068281f, -0.162217f, -0.152268f, 0.00323521f, 0.068281f, -0.162217f, -0.152268f, 0.00323521f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0.119996f, 0.542235f, 0, 0, 0, 0, 0, 0, 0, -0.166701f, -0.40465f, 0, 0, 0, 0, 0, 0, 0, -0.44244f, -0.706995f, 0, 0, 0, 0, 0, 0, 0, 0.0805206f, 0.137515f, 0, 0, 0, 0, 0, 0, 0, 0.119996f, 0.542235f, 0, 0, 0, 0, 0, 0, 0, -0.166701f, -0.40465f, 0, 0, 0, 0, 0, 0, 0, -0.44244f, -0.706995f, 0, 0, 0, 0, 0, 0, 0, 0.0805206f, 0.137515f, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/runtime/test/generated/models/conv_3_h3_w2_SAME.model.cpp b/nn/runtime/test/generated/models/conv_3_h3_w2_SAME.model.cpp
index dec85782d..5424ef003 100644
--- a/nn/runtime/test/generated/models/conv_3_h3_w2_SAME.model.cpp
+++ b/nn/runtime/test/generated/models/conv_3_h3_w2_SAME.model.cpp
@@ -24,7 +24,7 @@ void CreateModel(Model *model) {
model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
int32_t b7_init[] = {0};
model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
- float op0_init[] = {-0.966213, -0.579455, -0.684259, 0.738216, 0.184325, 0.0973683, -0.176863, -0.23936, -0.000233404, 0.055546, -0.232658, -0.316404, -0.012904, 0.320705, -0.326657, -0.919674, 0.868081, -0.824608, -0.467474, 0.0278809, 0.563238, 0.386045, -0.270568, -0.941308, -0.779227, -0.261492, -0.774804, -0.79665, 0.22473, -0.414312, 0.685897, -0.327792, 0.77395, -0.714578, -0.972365, 0.0696099, -0.82203, -0.79946, 0.37289, -0.917775, 0.82236, -0.144706, -0.167188, 0.268062, 0.702641, -0.412223, 0.755759, 0.721547, -0.43637, -0.274905, -0.269165, 0.16102, 0.819857, -0.312008};
+ static float op0_init[] = {-0.966213, -0.579455, -0.684259, 0.738216, 0.184325, 0.0973683, -0.176863, -0.23936, -0.000233404, 0.055546, -0.232658, -0.316404, -0.012904, 0.320705, -0.326657, -0.919674, 0.868081, -0.824608, -0.467474, 0.0278809, 0.563238, 0.386045, -0.270568, -0.941308, -0.779227, -0.261492, -0.774804, -0.79665, 0.22473, -0.414312, 0.685897, -0.327792, 0.77395, -0.714578, -0.972365, 0.0696099, -0.82203, -0.79946, 0.37289, -0.917775, 0.82236, -0.144706, -0.167188, 0.268062, 0.702641, -0.412223, 0.755759, 0.721547, -0.43637, -0.274905, -0.269165, 0.16102, 0.819857, -0.312008};
model->setOperandValue(op0, op0_init, sizeof(float) * 54);
float op1_init[] = {0, 0, 0};
model->setOperandValue(op1, op1_init, sizeof(float) * 3);
diff --git a/nn/runtime/test/generated/models/conv_3_h3_w2_VALID.model.cpp b/nn/runtime/test/generated/models/conv_3_h3_w2_VALID.model.cpp
index c6cbb0ac4..3ee875265 100644
--- a/nn/runtime/test/generated/models/conv_3_h3_w2_VALID.model.cpp
+++ b/nn/runtime/test/generated/models/conv_3_h3_w2_VALID.model.cpp
@@ -22,7 +22,7 @@ void CreateModel(Model *model) {
model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
int32_t b7_init[] = {0};
model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
- float op0_init[] = {-0.966213, -0.579455, -0.684259, 0.738216, 0.184325, 0.0973683, -0.176863, -0.23936, -0.000233404, 0.055546, -0.232658, -0.316404, -0.012904, 0.320705, -0.326657, -0.919674, 0.868081, -0.824608, -0.467474, 0.0278809, 0.563238, 0.386045, -0.270568, -0.941308, -0.779227, -0.261492, -0.774804, -0.79665, 0.22473, -0.414312, 0.685897, -0.327792, 0.77395, -0.714578, -0.972365, 0.0696099, -0.82203, -0.79946, 0.37289, -0.917775, 0.82236, -0.144706, -0.167188, 0.268062, 0.702641, -0.412223, 0.755759, 0.721547, -0.43637, -0.274905, -0.269165, 0.16102, 0.819857, -0.312008};
+ static float op0_init[] = {-0.966213, -0.579455, -0.684259, 0.738216, 0.184325, 0.0973683, -0.176863, -0.23936, -0.000233404, 0.055546, -0.232658, -0.316404, -0.012904, 0.320705, -0.326657, -0.919674, 0.868081, -0.824608, -0.467474, 0.0278809, 0.563238, 0.386045, -0.270568, -0.941308, -0.779227, -0.261492, -0.774804, -0.79665, 0.22473, -0.414312, 0.685897, -0.327792, 0.77395, -0.714578, -0.972365, 0.0696099, -0.82203, -0.79946, 0.37289, -0.917775, 0.82236, -0.144706, -0.167188, 0.268062, 0.702641, -0.412223, 0.755759, 0.721547, -0.43637, -0.274905, -0.269165, 0.16102, 0.819857, -0.312008};
model->setOperandValue(op0, op0_init, sizeof(float) * 54);
float op1_init[] = {0, 0, 0};
model->setOperandValue(op1, op1_init, sizeof(float) * 3);
diff --git a/nn/runtime/test/generated/models/depth_to_space_float_1.model.cpp b/nn/runtime/test/generated/models/depth_to_space_float_1.model.cpp
index 12a8b691e..d45c9bc9f 100644
--- a/nn/runtime/test/generated/models/depth_to_space_float_1.model.cpp
+++ b/nn/runtime/test/generated/models/depth_to_space_float_1.model.cpp
@@ -5,12 +5,12 @@ void CreateModel(Model *model) {
OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
// Phase 1, operands
auto input = model->addOperand(&type0);
- auto radius = model->addOperand(&type1);
+ auto block_size = model->addOperand(&type1);
auto output = model->addOperand(&type2);
// Phase 2, operations
- static int32_t radius_init[] = {2};
- model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {input, radius}, {output});
+ static int32_t block_size_init[] = {2};
+ model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {input, block_size}, {output});
// Phase 3, inputs and outputs
model->identifyInputsAndOutputs(
{input},
diff --git a/nn/runtime/test/generated/models/depth_to_space_float_2.model.cpp b/nn/runtime/test/generated/models/depth_to_space_float_2.model.cpp
index 80e27f52e..8392d15e9 100644
--- a/nn/runtime/test/generated/models/depth_to_space_float_2.model.cpp
+++ b/nn/runtime/test/generated/models/depth_to_space_float_2.model.cpp
@@ -5,12 +5,12 @@ void CreateModel(Model *model) {
OperandType type2(Type::TENSOR_FLOAT32, {1, 4, 4, 1});
// Phase 1, operands
auto input = model->addOperand(&type0);
- auto radius = model->addOperand(&type1);
+ auto block_size = model->addOperand(&type1);
auto output = model->addOperand(&type2);
// Phase 2, operations
- static int32_t radius_init[] = {2};
- model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {input, radius}, {output});
+ static int32_t block_size_init[] = {2};
+ model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {input, block_size}, {output});
// Phase 3, inputs and outputs
model->identifyInputsAndOutputs(
{input},
diff --git a/nn/runtime/test/generated/models/depth_to_space_float_3.model.cpp b/nn/runtime/test/generated/models/depth_to_space_float_3.model.cpp
new file mode 100644
index 000000000..3df413b5b
--- /dev/null
+++ b/nn/runtime/test/generated/models/depth_to_space_float_3.model.cpp
@@ -0,0 +1,24 @@
+// Generated file (from: depth_to_space_float_3.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::INT32, {});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 8});
+ OperandType type2(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto block_size = model->addOperand(&type1);
+ auto output = model->addOperand(&type2);
+ // Phase 2, operations
+ static int32_t block_size_init[] = {2};
+ model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_DEPTH_TO_SPACE, {input, block_size}, {output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input},
+ {output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp b/nn/runtime/test/generated/models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp
index 80bf5b1d6..0500e0f7d 100644
--- a/nn/runtime/test/generated/models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp
@@ -1,19 +1,18 @@
// Generated file (from: depthwise_conv2d_float_large_weights_as_inputs.mod.py). Do not edit
void CreateModel(Model *model) {
- OperandType type3(Type::INT32, {});
- OperandType type4(Type::TENSOR_FLOAT32, {1, 1, 1, 2});
- OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
- OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 3});
- OperandType type2(Type::TENSOR_FLOAT32, {2});
+ OperandType type2(Type::INT32, {});
+ OperandType type3(Type::TENSOR_FLOAT32, {1, 1, 1, 2});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
+ OperandType type1(Type::TENSOR_FLOAT32, {2});
// Phase 1, operands
auto op1 = model->addOperand(&type0);
- auto op2 = model->addOperand(&type1);
- auto op3 = model->addOperand(&type2);
- auto pad0 = model->addOperand(&type3);
- auto act = model->addOperand(&type3);
- auto stride = model->addOperand(&type3);
- auto channelMultiplier = model->addOperand(&type3);
- auto op4 = model->addOperand(&type4);
+ auto op2 = model->addOperand(&type0);
+ auto op3 = model->addOperand(&type1);
+ auto pad0 = model->addOperand(&type2);
+ auto act = model->addOperand(&type2);
+ auto stride = model->addOperand(&type2);
+ auto channelMultiplier = model->addOperand(&type2);
+ auto op4 = model->addOperand(&type3);
// Phase 2, operations
static int32_t pad0_init[] = {0};
model->setOperandValue(pad0, pad0_init, sizeof(int32_t) * 1);
diff --git a/nn/runtime/test/generated/models/embedding_lookup.model.cpp b/nn/runtime/test/generated/models/embedding_lookup.model.cpp
index e59f4deae..a7b82c79d 100644
--- a/nn/runtime/test/generated/models/embedding_lookup.model.cpp
+++ b/nn/runtime/test/generated/models/embedding_lookup.model.cpp
@@ -1,16 +1,16 @@
// Generated file (from: embedding_lookup.mod.py). Do not edit
void CreateModel(Model *model) {
- OperandType type0(Type::TENSOR_FLOAT32, {3, 2, 4});
- OperandType type1(Type::TENSOR_FLOAT32, {3});
+ OperandType type1(Type::TENSOR_FLOAT32, {3, 2, 4});
+ OperandType type0(Type::TENSOR_INT32, {3});
// Phase 1, operands
- auto value = model->addOperand(&type0);
- auto index = model->addOperand(&type1);
- auto output = model->addOperand(&type0);
+ auto index = model->addOperand(&type0);
+ auto value = model->addOperand(&type1);
+ auto output = model->addOperand(&type1);
// Phase 2, operations
- model->addOperation(ANEURALNETWORKS_EMBEDDING_LOOKUP, {value, index}, {output});
+ model->addOperation(ANEURALNETWORKS_EMBEDDING_LOOKUP, {index, value}, {output});
// Phase 3, inputs and outputs
model->identifyInputsAndOutputs(
- {value, index},
+ {index, value},
{output});
assert(model->isValid());
}
diff --git a/nn/runtime/test/generated/models/lstm.model.cpp b/nn/runtime/test/generated/models/lstm.model.cpp
index 528bc5fbb..2308ba84d 100644
--- a/nn/runtime/test/generated/models/lstm.model.cpp
+++ b/nn/runtime/test/generated/models/lstm.model.cpp
@@ -48,6 +48,6 @@ void CreateModel(Model *model) {
}
bool is_ignored(int i) {
- static std::set<int> ignore = {1, 2, 0};
+ static std::set<int> ignore = {0};
return ignore.find(i) != ignore.end();
}
diff --git a/nn/runtime/test/generated/models/lstm2.model.cpp b/nn/runtime/test/generated/models/lstm2.model.cpp
index 4286acd71..cf7a8f401 100644
--- a/nn/runtime/test/generated/models/lstm2.model.cpp
+++ b/nn/runtime/test/generated/models/lstm2.model.cpp
@@ -48,6 +48,6 @@ void CreateModel(Model *model) {
}
bool is_ignored(int i) {
- static std::set<int> ignore = {1, 2, 0};
+ static std::set<int> ignore = {0};
return ignore.find(i) != ignore.end();
}
diff --git a/nn/runtime/test/generated/models/lstm2_state.model.cpp b/nn/runtime/test/generated/models/lstm2_state.model.cpp
new file mode 100644
index 000000000..ec59fe7b0
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm2_state.model.cpp
@@ -0,0 +1,53 @@
+// Generated file (from: lstm2_state.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0,0});
+ OperandType type3(Type::TENSOR_FLOAT32, {0});
+ OperandType type9(Type::TENSOR_FLOAT32, {1, 12});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
+ OperandType type6(Type::TENSOR_FLOAT32, {1, 4});
+ OperandType type8(Type::TENSOR_FLOAT32, {1});
+ OperandType type1(Type::TENSOR_FLOAT32, {4, 2});
+ OperandType type2(Type::TENSOR_FLOAT32, {4, 4});
+ OperandType type4(Type::TENSOR_FLOAT32, {4});
+ OperandType type7(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type4);
+ auto cell_to_output_weights = model->addOperand(&type4);
+ auto input_gate_bias = model->addOperand(&type4);
+ auto forget_gate_bias = model->addOperand(&type4);
+ auto cell_gate_bias = model->addOperand(&type4);
+ auto output_gate_bias = model->addOperand(&type4);
+ auto projection_weights = model->addOperand(&type5);
+ auto projection_bias = model->addOperand(&type3);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type6);
+ auto activation_param = model->addOperand(&type7);
+ auto cell_clip_param = model->addOperand(&type8);
+ auto proj_clip_param = model->addOperand(&type8);
+ auto scratch_buffer = model->addOperand(&type9);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type6);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/lstm2_state2.model.cpp b/nn/runtime/test/generated/models/lstm2_state2.model.cpp
new file mode 100644
index 000000000..60d0e147d
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm2_state2.model.cpp
@@ -0,0 +1,53 @@
+// Generated file (from: lstm2_state2.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0,0});
+ OperandType type3(Type::TENSOR_FLOAT32, {0});
+ OperandType type9(Type::TENSOR_FLOAT32, {1, 12});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
+ OperandType type6(Type::TENSOR_FLOAT32, {1, 4});
+ OperandType type8(Type::TENSOR_FLOAT32, {1});
+ OperandType type1(Type::TENSOR_FLOAT32, {4, 2});
+ OperandType type2(Type::TENSOR_FLOAT32, {4, 4});
+ OperandType type4(Type::TENSOR_FLOAT32, {4});
+ OperandType type7(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type4);
+ auto cell_to_output_weights = model->addOperand(&type4);
+ auto input_gate_bias = model->addOperand(&type4);
+ auto forget_gate_bias = model->addOperand(&type4);
+ auto cell_gate_bias = model->addOperand(&type4);
+ auto output_gate_bias = model->addOperand(&type4);
+ auto projection_weights = model->addOperand(&type5);
+ auto projection_bias = model->addOperand(&type3);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type6);
+ auto activation_param = model->addOperand(&type7);
+ auto cell_clip_param = model->addOperand(&type8);
+ auto proj_clip_param = model->addOperand(&type8);
+ auto scratch_buffer = model->addOperand(&type9);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type6);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {1, 2, 0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/lstm3.model.cpp b/nn/runtime/test/generated/models/lstm3.model.cpp
index 64b00560b..2100fc949 100644
--- a/nn/runtime/test/generated/models/lstm3.model.cpp
+++ b/nn/runtime/test/generated/models/lstm3.model.cpp
@@ -49,6 +49,6 @@ void CreateModel(Model *model) {
}
bool is_ignored(int i) {
- static std::set<int> ignore = {1, 2, 0};
+ static std::set<int> ignore = {0};
return ignore.find(i) != ignore.end();
}
diff --git a/nn/runtime/test/generated/models/lstm3_state.model.cpp b/nn/runtime/test/generated/models/lstm3_state.model.cpp
new file mode 100644
index 000000000..bee11fa10
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm3_state.model.cpp
@@ -0,0 +1,54 @@
+// Generated file (from: lstm3_state.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0});
+ OperandType type4(Type::TENSOR_FLOAT32, {16,20});
+ OperandType type9(Type::TENSOR_FLOAT32, {1});
+ OperandType type6(Type::TENSOR_FLOAT32, {2, 16});
+ OperandType type7(Type::TENSOR_FLOAT32, {2, 20});
+ OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
+ OperandType type10(Type::TENSOR_FLOAT32, {2, 80});
+ OperandType type2(Type::TENSOR_FLOAT32, {20, 16});
+ OperandType type1(Type::TENSOR_FLOAT32, {20, 5});
+ OperandType type3(Type::TENSOR_FLOAT32, {20});
+ OperandType type8(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type3);
+ auto cell_to_output_weights = model->addOperand(&type3);
+ auto input_gate_bias = model->addOperand(&type3);
+ auto forget_gate_bias = model->addOperand(&type3);
+ auto cell_gate_bias = model->addOperand(&type3);
+ auto output_gate_bias = model->addOperand(&type3);
+ auto projection_weights = model->addOperand(&type4);
+ auto projection_bias = model->addOperand(&type5);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type7);
+ auto activation_param = model->addOperand(&type8);
+ auto cell_clip_param = model->addOperand(&type9);
+ auto proj_clip_param = model->addOperand(&type9);
+ auto scratch_buffer = model->addOperand(&type10);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type7);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/lstm3_state2.model.cpp b/nn/runtime/test/generated/models/lstm3_state2.model.cpp
new file mode 100644
index 000000000..ae6ba8db3
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm3_state2.model.cpp
@@ -0,0 +1,54 @@
+// Generated file (from: lstm3_state2.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0});
+ OperandType type4(Type::TENSOR_FLOAT32, {16,20});
+ OperandType type9(Type::TENSOR_FLOAT32, {1});
+ OperandType type6(Type::TENSOR_FLOAT32, {2, 16});
+ OperandType type7(Type::TENSOR_FLOAT32, {2, 20});
+ OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
+ OperandType type10(Type::TENSOR_FLOAT32, {2, 80});
+ OperandType type2(Type::TENSOR_FLOAT32, {20, 16});
+ OperandType type1(Type::TENSOR_FLOAT32, {20, 5});
+ OperandType type3(Type::TENSOR_FLOAT32, {20});
+ OperandType type8(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type3);
+ auto cell_to_output_weights = model->addOperand(&type3);
+ auto input_gate_bias = model->addOperand(&type3);
+ auto forget_gate_bias = model->addOperand(&type3);
+ auto cell_gate_bias = model->addOperand(&type3);
+ auto output_gate_bias = model->addOperand(&type3);
+ auto projection_weights = model->addOperand(&type4);
+ auto projection_bias = model->addOperand(&type5);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type7);
+ auto activation_param = model->addOperand(&type8);
+ auto cell_clip_param = model->addOperand(&type9);
+ auto proj_clip_param = model->addOperand(&type9);
+ auto scratch_buffer = model->addOperand(&type10);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type7);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/lstm3_state3.model.cpp b/nn/runtime/test/generated/models/lstm3_state3.model.cpp
new file mode 100644
index 000000000..65ab3c18f
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm3_state3.model.cpp
@@ -0,0 +1,54 @@
+// Generated file (from: lstm3_state3.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0});
+ OperandType type4(Type::TENSOR_FLOAT32, {16,20});
+ OperandType type9(Type::TENSOR_FLOAT32, {1});
+ OperandType type6(Type::TENSOR_FLOAT32, {2, 16});
+ OperandType type7(Type::TENSOR_FLOAT32, {2, 20});
+ OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
+ OperandType type10(Type::TENSOR_FLOAT32, {2, 80});
+ OperandType type2(Type::TENSOR_FLOAT32, {20, 16});
+ OperandType type1(Type::TENSOR_FLOAT32, {20, 5});
+ OperandType type3(Type::TENSOR_FLOAT32, {20});
+ OperandType type8(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type3);
+ auto cell_to_output_weights = model->addOperand(&type3);
+ auto input_gate_bias = model->addOperand(&type3);
+ auto forget_gate_bias = model->addOperand(&type3);
+ auto cell_gate_bias = model->addOperand(&type3);
+ auto output_gate_bias = model->addOperand(&type3);
+ auto projection_weights = model->addOperand(&type4);
+ auto projection_bias = model->addOperand(&type5);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type7);
+ auto activation_param = model->addOperand(&type8);
+ auto cell_clip_param = model->addOperand(&type9);
+ auto proj_clip_param = model->addOperand(&type9);
+ auto scratch_buffer = model->addOperand(&type10);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type7);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {1, 2, 0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/lstm_state.model.cpp b/nn/runtime/test/generated/models/lstm_state.model.cpp
new file mode 100644
index 000000000..cf7ce867b
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm_state.model.cpp
@@ -0,0 +1,53 @@
+// Generated file (from: lstm_state.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0,0});
+ OperandType type3(Type::TENSOR_FLOAT32, {0});
+ OperandType type9(Type::TENSOR_FLOAT32, {1, 16});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
+ OperandType type6(Type::TENSOR_FLOAT32, {1, 4});
+ OperandType type8(Type::TENSOR_FLOAT32, {1});
+ OperandType type1(Type::TENSOR_FLOAT32, {4, 2});
+ OperandType type2(Type::TENSOR_FLOAT32, {4, 4});
+ OperandType type4(Type::TENSOR_FLOAT32, {4});
+ OperandType type7(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type3);
+ auto cell_to_output_weights = model->addOperand(&type3);
+ auto input_gate_bias = model->addOperand(&type4);
+ auto forget_gate_bias = model->addOperand(&type4);
+ auto cell_gate_bias = model->addOperand(&type4);
+ auto output_gate_bias = model->addOperand(&type4);
+ auto projection_weights = model->addOperand(&type5);
+ auto projection_bias = model->addOperand(&type3);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type6);
+ auto activation_param = model->addOperand(&type7);
+ auto cell_clip_param = model->addOperand(&type8);
+ auto proj_clip_param = model->addOperand(&type8);
+ auto scratch_buffer = model->addOperand(&type9);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type6);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/lstm_state2.model.cpp b/nn/runtime/test/generated/models/lstm_state2.model.cpp
new file mode 100644
index 000000000..1cdf66622
--- /dev/null
+++ b/nn/runtime/test/generated/models/lstm_state2.model.cpp
@@ -0,0 +1,53 @@
+// Generated file (from: lstm_state2.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0,0});
+ OperandType type3(Type::TENSOR_FLOAT32, {0});
+ OperandType type9(Type::TENSOR_FLOAT32, {1, 16});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
+ OperandType type6(Type::TENSOR_FLOAT32, {1, 4});
+ OperandType type8(Type::TENSOR_FLOAT32, {1});
+ OperandType type1(Type::TENSOR_FLOAT32, {4, 2});
+ OperandType type2(Type::TENSOR_FLOAT32, {4, 4});
+ OperandType type4(Type::TENSOR_FLOAT32, {4});
+ OperandType type7(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type3);
+ auto cell_to_output_weights = model->addOperand(&type3);
+ auto input_gate_bias = model->addOperand(&type4);
+ auto forget_gate_bias = model->addOperand(&type4);
+ auto cell_gate_bias = model->addOperand(&type4);
+ auto output_gate_bias = model->addOperand(&type4);
+ auto projection_weights = model->addOperand(&type5);
+ auto projection_bias = model->addOperand(&type3);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type6);
+ auto activation_param = model->addOperand(&type7);
+ auto cell_clip_param = model->addOperand(&type8);
+ auto proj_clip_param = model->addOperand(&type8);
+ auto scratch_buffer = model->addOperand(&type9);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type6);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {1, 2, 0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/rnn_state.model.cpp b/nn/runtime/test/generated/models/rnn_state.model.cpp
new file mode 100644
index 000000000..489575937
--- /dev/null
+++ b/nn/runtime/test/generated/models/rnn_state.model.cpp
@@ -0,0 +1,30 @@
+// Generated file (from: rnn_state.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
+ OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
+ OperandType type3(Type::TENSOR_FLOAT32, {16});
+ OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
+ OperandType type0(Type::TENSOR_FLOAT32, {2, 8});
+ OperandType type5(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto weights = model->addOperand(&type1);
+ auto recurrent_weights = model->addOperand(&type2);
+ auto bias = model->addOperand(&type3);
+ auto hidden_state_in = model->addOperand(&type4);
+ auto activation_param = model->addOperand(&type5);
+ auto hidden_state_out = model->addOperand(&type4);
+ auto output = model->addOperand(&type4);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_RNN, {input, weights, recurrent_weights, bias, hidden_state_in, activation_param}, {hidden_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, weights, recurrent_weights, bias, hidden_state_in, activation_param},
+ {hidden_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {0};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/space_to_depth_float_1.model.cpp b/nn/runtime/test/generated/models/space_to_depth_float_1.model.cpp
index 95e6df946..764318627 100644
--- a/nn/runtime/test/generated/models/space_to_depth_float_1.model.cpp
+++ b/nn/runtime/test/generated/models/space_to_depth_float_1.model.cpp
@@ -5,12 +5,12 @@ void CreateModel(Model *model) {
OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 2});
// Phase 1, operands
auto input = model->addOperand(&type0);
- auto radius = model->addOperand(&type1);
+ auto block_size = model->addOperand(&type1);
auto output = model->addOperand(&type2);
// Phase 2, operations
- static int32_t radius_init[] = {2};
- model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_SPACE_TO_DEPTH, {input, radius}, {output});
+ static int32_t block_size_init[] = {2};
+ model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_SPACE_TO_DEPTH, {input, block_size}, {output});
// Phase 3, inputs and outputs
model->identifyInputsAndOutputs(
{input},
diff --git a/nn/runtime/test/generated/models/space_to_depth_float_2.model.cpp b/nn/runtime/test/generated/models/space_to_depth_float_2.model.cpp
index 811efe783..8fdd5357e 100644
--- a/nn/runtime/test/generated/models/space_to_depth_float_2.model.cpp
+++ b/nn/runtime/test/generated/models/space_to_depth_float_2.model.cpp
@@ -5,12 +5,12 @@ void CreateModel(Model *model) {
OperandType type0(Type::TENSOR_FLOAT32, {1, 4, 4, 1});
// Phase 1, operands
auto input = model->addOperand(&type0);
- auto radius = model->addOperand(&type1);
+ auto block_size = model->addOperand(&type1);
auto output = model->addOperand(&type2);
// Phase 2, operations
- static int32_t radius_init[] = {2};
- model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
- model->addOperation(ANEURALNETWORKS_SPACE_TO_DEPTH, {input, radius}, {output});
+ static int32_t block_size_init[] = {2};
+ model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_SPACE_TO_DEPTH, {input, block_size}, {output});
// Phase 3, inputs and outputs
model->identifyInputsAndOutputs(
{input},
diff --git a/nn/runtime/test/generated/models/space_to_depth_float_3.model.cpp b/nn/runtime/test/generated/models/space_to_depth_float_3.model.cpp
new file mode 100644
index 000000000..176546497
--- /dev/null
+++ b/nn/runtime/test/generated/models/space_to_depth_float_3.model.cpp
@@ -0,0 +1,24 @@
+// Generated file (from: space_to_depth_float_3.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::INT32, {});
+ OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 8});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 4, 4, 2});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto block_size = model->addOperand(&type1);
+ auto output = model->addOperand(&type2);
+ // Phase 2, operations
+ static int32_t block_size_init[] = {2};
+ model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_SPACE_TO_DEPTH, {input, block_size}, {output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input},
+ {output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/models/svdf_state.model.cpp b/nn/runtime/test/generated/models/svdf_state.model.cpp
new file mode 100644
index 000000000..f63662d3b
--- /dev/null
+++ b/nn/runtime/test/generated/models/svdf_state.model.cpp
@@ -0,0 +1,32 @@
+// Generated file (from: svdf_state.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type0(Type::TENSOR_FLOAT32, {2, 3});
+ OperandType type4(Type::TENSOR_FLOAT32, {2, 40});
+ OperandType type6(Type::TENSOR_FLOAT32, {2, 4});
+ OperandType type2(Type::TENSOR_FLOAT32, {4, 10});
+ OperandType type1(Type::TENSOR_FLOAT32, {4, 3});
+ OperandType type3(Type::TENSOR_FLOAT32, {4});
+ OperandType type5(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto weights_feature = model->addOperand(&type1);
+ auto weights_time = model->addOperand(&type2);
+ auto bias = model->addOperand(&type3);
+ auto state_in = model->addOperand(&type4);
+ auto rank_param = model->addOperand(&type5);
+ auto activation_param = model->addOperand(&type5);
+ auto state_out = model->addOperand(&type4);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_SVDF, {input, weights_feature, weights_time, bias, state_in, rank_param, activation_param}, {state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, weights_feature, weights_time, bias, state_in, rank_param, activation_param},
+ {state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_float_1.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_float_1.model.cpp
index e8c77d626..3ff21f431 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_float_1.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_float_1.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_float_2.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_float_2.model.cpp
index 24c05c6c1..031d343f6 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_float_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_float_2.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_float_3.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_float_3.model.cpp
index a6b92236d..60f74aede 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_float_3.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_float_3.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_float_4.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_float_4.model.cpp
index 0222ae928..ffce9f21a 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_float_4.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_float_4.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_quant8_1.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_quant8_1.model.cpp
index 81fc2fab3..491532c18 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_quant8_1.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_quant8_1.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_quant8_2.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_quant8_2.model.cpp
index 827280a8a..5f61cefa2 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_quant8_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_quant8_2.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_quant8_3.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_quant8_3.model.cpp
index 68ed17931..56258841d 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_quant8_3.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_quant8_3.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/avg_pool_quant8_4.model.cpp b/nn/runtime/test/generated/vts_models/avg_pool_quant8_4.model.cpp
index 4ad90772a..d48694a96 100644
--- a/nn/runtime/test/generated/vts_models/avg_pool_quant8_4.model.cpp
+++ b/nn/runtime/test/generated/vts_models/avg_pool_quant8_4.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_float.model.cpp b/nn/runtime/test/generated/vts_models/conv_float.model.cpp
index be37301ea..75e51661f 100644
--- a/nn/runtime/test/generated/vts_models/conv_float.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_float.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_float_channels.model.cpp b/nn/runtime/test/generated/vts_models/conv_float_channels.model.cpp
index 34953553a..d6b2a0a2d 100644
--- a/nn/runtime/test/generated/vts_models/conv_float_channels.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_float_channels.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_float_channels_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_float_channels_weights_as_inputs.model.cpp
index 0a2cac0af..8983b1f79 100644
--- a/nn/runtime/test/generated/vts_models/conv_float_channels_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_float_channels_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_float_large.model.cpp b/nn/runtime/test/generated/vts_models/conv_float_large.model.cpp
index e01baf50f..e0890edf0 100644
--- a/nn/runtime/test/generated/vts_models/conv_float_large.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_float_large.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_float_large_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_float_large_weights_as_inputs.model.cpp
index 9e4803fce..15bea354c 100644
--- a/nn/runtime/test/generated/vts_models/conv_float_large_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_float_large_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_float_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_float_weights_as_inputs.model.cpp
index e23133a66..7d273c5b9 100644
--- a/nn/runtime/test/generated/vts_models/conv_float_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_float_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8.model.cpp
index 7741db99e..f7b251f82 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_channels.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_channels.model.cpp
index 9b7783824..24a4be704 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_channels.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_channels.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_channels_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_channels_weights_as_inputs.model.cpp
index cdb903d7d..7e16a39b4 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_channels_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_channels_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_large.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_large.model.cpp
index 261c759ba..5a13361a4 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_large.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_large.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_large_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_large_weights_as_inputs.model.cpp
index 25896a612..d68352358 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_large_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_large_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_overflow.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_overflow.model.cpp
index fdd3978bc..939065ac8 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_overflow.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_overflow.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_overflow_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_overflow_weights_as_inputs.model.cpp
index 25896a612..d68352358 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_overflow_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_overflow_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/conv_quant8_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/conv_quant8_weights_as_inputs.model.cpp
index 8480ba810..90e8170b1 100644
--- a/nn/runtime/test/generated/vts_models/conv_quant8_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/conv_quant8_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depth_to_space_float_3.model.cpp b/nn/runtime/test/generated/vts_models/depth_to_space_float_3.model.cpp
new file mode 100644
index 000000000..974982a8f
--- /dev/null
+++ b/nn/runtime/test/generated/vts_models/depth_to_space_float_3.model.cpp
@@ -0,0 +1,62 @@
+// Generated code. Do not edit
+// Create the model
+Model createTestModel() {
+ const std::vector<Operand> operands = {
+ {
+ .type = OperandType::TENSOR_FLOAT32,
+ .dimensions = {1, 2, 2, 8},
+ .numberOfConsumers = 1,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .lifetime = OperandLifeTime::MODEL_INPUT,
+ .location = {.poolIndex = 0, .offset = 0, .length = 0},
+ },
+ {
+ .type = OperandType::INT32,
+ .dimensions = {},
+ .numberOfConsumers = 1,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .lifetime = OperandLifeTime::CONSTANT_COPY,
+ .location = {.poolIndex = 0, .offset = 0, .length = 4},
+ },
+ {
+ .type = OperandType::TENSOR_FLOAT32,
+ .dimensions = {1, 4, 4, 2},
+ .numberOfConsumers = 0,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .lifetime = OperandLifeTime::MODEL_OUTPUT,
+ .location = {.poolIndex = 0, .offset = 0, .length = 0},
+ }
+ };
+
+ const std::vector<Operation> operations = {
+ {
+ .type = OperationType::DEPTH_TO_SPACE,
+ .inputs = {0, 1},
+ .outputs = {2},
+ }
+ };
+
+ const std::vector<uint32_t> inputIndexes = {0};
+ const std::vector<uint32_t> outputIndexes = {2};
+ std::vector<uint8_t> operandValues = {
+ 2, 0, 0, 0
+ };
+ const std::vector<hidl_memory> pools = {};
+
+ return {
+ .operands = operands,
+ .operations = operations,
+ .inputIndexes = inputIndexes,
+ .outputIndexes = outputIndexes,
+ .operandValues = operandValues,
+ .pools = pools,
+ };
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float.model.cpp
index 22ffa9f15..8e89fe1d8 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large.model.cpp
index 50c6a10cb..dd817e5e0 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2.model.cpp
index ef5906b2f..c949f8cd5 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2_weights_as_inputs.model.cpp
index a2adfba4f..11e0b9dac 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_2_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp
index aa34efcbd..4343e2bd7 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_large_weights_as_inputs.model.cpp
@@ -4,7 +4,7 @@ Model createTestModel() {
const std::vector<Operand> operands = {
{
.type = OperandType::TENSOR_FLOAT32,
- .dimensions = {1, 2, 2, 3},
+ .dimensions = {1, 2, 2, 2},
.numberOfConsumers = 1,
.scale = 0.0f,
.zeroPoint = 0,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_weights_as_inputs.model.cpp
index 50877dcd1..49d6e99e5 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_float_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8.model.cpp
index 7396b997e..f016869e4 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large.model.cpp
index 4c1a86dbd..a623164d4 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large_weights_as_inputs.model.cpp
index be0b691c8..236b3987b 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_large_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_weights_as_inputs.model.cpp b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_weights_as_inputs.model.cpp
index d232eb9a1..0e040cfbe 100644
--- a/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_weights_as_inputs.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depthwise_conv2d_quant8_weights_as_inputs.model.cpp
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/embedding_lookup.model.cpp b/nn/runtime/test/generated/vts_models/embedding_lookup.model.cpp
index 71d7aecf5..ce2b4b35f 100644
--- a/nn/runtime/test/generated/vts_models/embedding_lookup.model.cpp
+++ b/nn/runtime/test/generated/vts_models/embedding_lookup.model.cpp
@@ -3,8 +3,8 @@
Model createTestModel() {
const std::vector<Operand> operands = {
{
- .type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3, 2, 4},
+ .type = OperandType::TENSOR_INT32,
+ .dimensions = {3},
.numberOfConsumers = 1,
.scale = 0.0f,
.zeroPoint = 0,
@@ -13,7 +13,7 @@ Model createTestModel() {
},
{
.type = OperandType::TENSOR_FLOAT32,
- .dimensions = {3},
+ .dimensions = {3, 2, 4},
.numberOfConsumers = 1,
.scale = 0.0f,
.zeroPoint = 0,
diff --git a/nn/runtime/test/generated/vts_models/l2_pool_float.model.cpp b/nn/runtime/test/generated/vts_models/l2_pool_float.model.cpp
index 25b08e704..585b22fc5 100644
--- a/nn/runtime/test/generated/vts_models/l2_pool_float.model.cpp
+++ b/nn/runtime/test/generated/vts_models/l2_pool_float.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/l2_pool_float_large.model.cpp b/nn/runtime/test/generated/vts_models/l2_pool_float_large.model.cpp
index 8789aadf3..4242b8483 100644
--- a/nn/runtime/test/generated/vts_models/l2_pool_float_large.model.cpp
+++ b/nn/runtime/test/generated/vts_models/l2_pool_float_large.model.cpp
@@ -50,7 +50,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/max_pool_float_1.model.cpp b/nn/runtime/test/generated/vts_models/max_pool_float_1.model.cpp
index 5e6f72067..0b1121f49 100644
--- a/nn/runtime/test/generated/vts_models/max_pool_float_1.model.cpp
+++ b/nn/runtime/test/generated/vts_models/max_pool_float_1.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/max_pool_float_2.model.cpp b/nn/runtime/test/generated/vts_models/max_pool_float_2.model.cpp
index 37caf576e..3cbd6fd90 100644
--- a/nn/runtime/test/generated/vts_models/max_pool_float_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/max_pool_float_2.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/max_pool_float_3.model.cpp b/nn/runtime/test/generated/vts_models/max_pool_float_3.model.cpp
index e806d4021..f8abbe8e1 100644
--- a/nn/runtime/test/generated/vts_models/max_pool_float_3.model.cpp
+++ b/nn/runtime/test/generated/vts_models/max_pool_float_3.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/max_pool_quant8_1.model.cpp b/nn/runtime/test/generated/vts_models/max_pool_quant8_1.model.cpp
index c1f08daf7..56c23885c 100644
--- a/nn/runtime/test/generated/vts_models/max_pool_quant8_1.model.cpp
+++ b/nn/runtime/test/generated/vts_models/max_pool_quant8_1.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/max_pool_quant8_2.model.cpp b/nn/runtime/test/generated/vts_models/max_pool_quant8_2.model.cpp
index fc102ea09..f277b3431 100644
--- a/nn/runtime/test/generated/vts_models/max_pool_quant8_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/max_pool_quant8_2.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/max_pool_quant8_3.model.cpp b/nn/runtime/test/generated/vts_models/max_pool_quant8_3.model.cpp
index 77aacf943..e72b6729c 100644
--- a/nn/runtime/test/generated/vts_models/max_pool_quant8_3.model.cpp
+++ b/nn/runtime/test/generated/vts_models/max_pool_quant8_3.model.cpp
@@ -14,7 +14,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -23,7 +23,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 2,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
@@ -32,7 +32,7 @@ Model createTestModel() {
{
.type = OperandType::INT32,
.dimensions = {},
- .numberOfConsumers = 1,
+ .numberOfConsumers = 4,
.scale = 0.0f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::CONSTANT_COPY,
diff --git a/nn/runtime/test/generated/vts_models/space_to_depth_float_3.model.cpp b/nn/runtime/test/generated/vts_models/space_to_depth_float_3.model.cpp
new file mode 100644
index 000000000..9f3a83e0a
--- /dev/null
+++ b/nn/runtime/test/generated/vts_models/space_to_depth_float_3.model.cpp
@@ -0,0 +1,62 @@
+// Generated code. Do not edit
+// Create the model
+Model createTestModel() {
+ const std::vector<Operand> operands = {
+ {
+ .type = OperandType::TENSOR_FLOAT32,
+ .dimensions = {1, 4, 4, 2},
+ .numberOfConsumers = 1,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .lifetime = OperandLifeTime::MODEL_INPUT,
+ .location = {.poolIndex = 0, .offset = 0, .length = 0},
+ },
+ {
+ .type = OperandType::INT32,
+ .dimensions = {},
+ .numberOfConsumers = 1,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .lifetime = OperandLifeTime::CONSTANT_COPY,
+ .location = {.poolIndex = 0, .offset = 0, .length = 4},
+ },
+ {
+ .type = OperandType::TENSOR_FLOAT32,
+ .dimensions = {1, 2, 2, 8},
+ .numberOfConsumers = 0,
+ .scale = 0.0f,
+ .zeroPoint = 0,
+ .lifetime = OperandLifeTime::MODEL_OUTPUT,
+ .location = {.poolIndex = 0, .offset = 0, .length = 0},
+ }
+ };
+
+ const std::vector<Operation> operations = {
+ {
+ .type = OperationType::SPACE_TO_DEPTH,
+ .inputs = {0, 1},
+ .outputs = {2},
+ }
+ };
+
+ const std::vector<uint32_t> inputIndexes = {0};
+ const std::vector<uint32_t> outputIndexes = {2};
+ std::vector<uint8_t> operandValues = {
+ 2, 0, 0, 0
+ };
+ const std::vector<hidl_memory> pools = {};
+
+ return {
+ .operands = operands,
+ .operations = operations,
+ .inputIndexes = inputIndexes,
+ .outputIndexes = outputIndexes,
+ .operandValues = operandValues,
+ .pools = pools,
+ };
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
diff --git a/nn/runtime/test/specs/depth_to_space_float_1.mod.py b/nn/runtime/test/specs/depth_to_space_float_1.mod.py
index ab79a6cf2..d11e9ee4d 100644
--- a/nn/runtime/test/specs/depth_to_space_float_1.mod.py
+++ b/nn/runtime/test/specs/depth_to_space_float_1.mod.py
@@ -1,6 +1,6 @@
model = Model()
i1 = Input("input", "TENSOR_FLOAT32", "{1, 1, 1, 8}")
-block = Int32Scalar("radius", 2)
+block = Int32Scalar("block_size", 2)
output = Output("output", "TENSOR_FLOAT32", "{1, 2, 2, 2}")
model = model.Operation("DEPTH_TO_SPACE", i1, block).To(output)
diff --git a/nn/runtime/test/specs/depth_to_space_float_2.mod.py b/nn/runtime/test/specs/depth_to_space_float_2.mod.py
index 972373738..ee1efe15e 100644
--- a/nn/runtime/test/specs/depth_to_space_float_2.mod.py
+++ b/nn/runtime/test/specs/depth_to_space_float_2.mod.py
@@ -1,6 +1,6 @@
model = Model()
i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 4}")
-block = Int32Scalar("radius", 2)
+block = Int32Scalar("block_size", 2)
output = Output("output", "TENSOR_FLOAT32", "{1, 4, 4, 1}")
model = model.Operation("DEPTH_TO_SPACE", i1, block).To(output)
diff --git a/nn/runtime/test/specs/depth_to_space_float_3.mod.py b/nn/runtime/test/specs/depth_to_space_float_3.mod.py
new file mode 100644
index 000000000..a9edcf716
--- /dev/null
+++ b/nn/runtime/test/specs/depth_to_space_float_3.mod.py
@@ -0,0 +1,22 @@
+model = Model()
+i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 8}")
+block = Int32Scalar("block_size", 2)
+output = Output("output", "TENSOR_FLOAT32", "{1, 4, 4, 2}")
+
+model = model.Operation("DEPTH_TO_SPACE", i1, block).To(output)
+
+# Example 1. Input in operand 0,
+
+input0 = {i1: # input 0
+ [10, 20, 11, 21, 14, 24, 15, 25,
+ 12, 22, 13, 23, 16, 26, 17, 27,
+ 18, 28, 19, 29, 112, 212, 113, 213,
+ 110, 210, 111, 211, 114, 214, 115, 215]}
+
+output0 = {output: # output 0
+ [10, 20, 11, 21, 12, 22, 13, 23,
+ 14, 24, 15, 25, 16, 26, 17, 27,
+ 18, 28, 19, 29, 110, 210, 111, 211,
+ 112, 212, 113, 213, 114, 214, 115, 215]}
+# Instantiate an example
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/depthwise_conv2d_float_large_weights_as_inputs.mod.py b/nn/runtime/test/specs/depthwise_conv2d_float_large_weights_as_inputs.mod.py
index ee7ae942d..5174402e2 100644
--- a/nn/runtime/test/specs/depthwise_conv2d_float_large_weights_as_inputs.mod.py
+++ b/nn/runtime/test/specs/depthwise_conv2d_float_large_weights_as_inputs.mod.py
@@ -15,7 +15,7 @@
#
model = Model()
-i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 3}") # depth_in = 3
+i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 2}") # depth_in = 2
f1 = Input("op2", "TENSOR_FLOAT32", "{1, 2, 2, 2}") # depth_out = 2
b1 = Input("op3", "TENSOR_FLOAT32", "{2}") # depth_out = 2
pad0 = Int32Scalar("pad0", 0)
@@ -33,8 +33,8 @@ model = model.Operation("DEPTHWISE_CONV_2D",
# Example 1. Input in operand 0,
input0 = {
i1: [ # input 0
- 10, 21, 100, 10, 22, 200,
- 10, 23, 300, 10, 24, 400],
+ 10, 21, 10, 22,
+ 10, 23, 10, 24],
f1: [
.25, 0, .25, 1,
.25, 0, .25, 1],
diff --git a/nn/runtime/test/specs/embedding_lookup.mod.py b/nn/runtime/test/specs/embedding_lookup.mod.py
index 862357b93..a012c7fbf 100644
--- a/nn/runtime/test/specs/embedding_lookup.mod.py
+++ b/nn/runtime/test/specs/embedding_lookup.mod.py
@@ -26,12 +26,12 @@ for i in range(rows):
actual_values[(i * columns + j) * features + k] = i + j / 10. + k / 100.
model = Model()
+index = Input("index", "TENSOR_INT32", "{%d}"%lookups)
value = Input("value", "TENSOR_FLOAT32", "{%d, %d, %d}" % (rows, columns, features))
-index = Input("index", "TENSOR_FLOAT32", "{%d}"%lookups)
output = Output("output", "TENSOR_FLOAT32", "{%d, %d, %d}" % (lookups, columns, features))
-model = model.Operation("EMBEDDING_LOOKUP", value, index).To(output)
+model = model.Operation("EMBEDDING_LOOKUP", index, value).To(output)
-input0 = {index: [1., 0., 2.], # TODO: these should be integers
+input0 = {index: [1, 0, 2],
value: actual_values}
output0 = {output:
diff --git a/nn/runtime/test/specs/generate_test.sh b/nn/runtime/test/specs/generate_test.sh
index 0eccfeb0b..1f3407b9c 100755
--- a/nn/runtime/test/specs/generate_test.sh
+++ b/nn/runtime/test/specs/generate_test.sh
@@ -16,9 +16,16 @@
function generate_one_testcase {
# Generate one testcase
BASENAME=`basename -s .mod.py $1`
+ EXAMPLE="-e ../generated/examples/$BASENAME.example.cpp"
+ # Mobilenet quantized has its example file generated elsewhere, so we
+ # need make sure it does not get overwritten.
+ if [ $1 = "mobilenet_quantized.mod.py" ]; then
+ (>&2 echo "Skipping mobilenet quantized example generation")
+ EXAMPLE=
+ fi
+
../../../tools/test_generator/test_generator.py ./`basename $1`\
- -m ../generated/models/$BASENAME.model.cpp \
- -e ../generated/examples/$BASENAME.example.cpp
+ -m ../generated/models/$BASENAME.model.cpp $EXAMPLE
# Paste these lines into TestGenerated.cpp
echo
echo namespace $BASENAME {
diff --git a/nn/runtime/test/specs/generate_vts_test.sh b/nn/runtime/test/specs/generate_vts_test.sh
index 76aa32bc2..ccbc3eb25 100755
--- a/nn/runtime/test/specs/generate_vts_test.sh
+++ b/nn/runtime/test/specs/generate_vts_test.sh
@@ -47,6 +47,10 @@ echo "// DO NOT EDIT;" > $OUTFILE
echo "// Generated by ml/nn/runtime/test/specs/generate_vts_test.sh" >> $OUTFILE
for f in *.mod.py;
do
+ if [ $f = "mobilenet_quantized.mod.py" ]; then
+ echo "Skipping mobilenet quantized"
+ continue
+ fi
echo "Processing $f"
generate_one_testcase $f >> $OUTFILE
done
diff --git a/nn/runtime/test/specs/lstm.mod.py b/nn/runtime/test/specs/lstm.mod.py
index cb1bf6010..e670d2758 100644
--- a/nn/runtime/test/specs/lstm.mod.py
+++ b/nn/runtime/test/specs/lstm.mod.py
@@ -56,8 +56,8 @@ cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
-output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
-cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
model = model.Operation("LSTM",
@@ -136,26 +136,17 @@ input0 = {input_to_input_weights: [-0.45018822, -0.02338299, -0.0870589, -0.345
proj_clip_param: [0.],
}
-# Instantiate examples
-# TODO: Add more examples after fixing the reference issue
-test_inputs = [
- [2., 3.],
-# [3., 4.],[1., 1.]
-]
-golden_outputs = [
- [-0.02973187, 0.1229473, 0.20885126, -0.15358765,],
-# [-0.03716109, 0.12507336, 0.41193449, -0.20860538],
-# [-0.15053082, 0.09120187, 0.24278517, -0.12222792]
-]
-
-for (input_tensor, output_tensor) in zip(test_inputs, golden_outputs):
- output0 = {
- scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
- cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
- output_state_out: [ 0 for x in range(n_batch * n_output) ],
- output: output_tensor
- }
- input0[input] = input_tensor
- input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
- input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
- Example((input0, output0))
+test_input = [2., 3.]
+output_state = [0, 0, 0, 0]
+cell_state = [0, 0, 0, 0]
+golden_output = [-0.02973187, 0.1229473, 0.20885126, -0.15358765,]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ -0.145439, 0.157475, 0.293663, -0.277353 ],
+ output_state_out: [ -0.0297319, 0.122947, 0.208851, -0.153588 ],
+ output: golden_output
+}
+input0[input] = test_input
+input0[output_state_in] = output_state
+input0[cell_state_in] = cell_state
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm2.mod.py b/nn/runtime/test/specs/lstm2.mod.py
index d5afb0cd9..580464f4f 100644
--- a/nn/runtime/test/specs/lstm2.mod.py
+++ b/nn/runtime/test/specs/lstm2.mod.py
@@ -56,8 +56,8 @@ cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell * 3))
-output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
-cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
model = model.Operation("LSTM",
@@ -134,25 +134,13 @@ input0 = {input_to_input_weights:[],
output0 = {
scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
- cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
- output_state_out: [ 0 for x in range(n_batch * n_output) ],
+ cell_state_out: [ -0.760444, -0.0180416, 0.182264, -0.0649371 ],
+ output_state_out: [ -0.364445, -0.00352185, 0.128866, -0.0516365 ],
}
-# Instantiate examples
-# TODO: Add more examples after fixing the reference issue
-test_inputs = [
- [2., 3.],
-# [3., 4.],[1., 1.]
-]
-golden_outputs = [
- [-0.36444446, -0.00352185, 0.12886585, -0.05163646],
-# [-0.42312205, -0.01218222, 0.24201041, -0.08124574],
-# [-0.358325, -0.04621704, 0.21641694, -0.06471302]
-]
-
-for (input_tensor, output_tensor) in zip(test_inputs, golden_outputs):
- input0[input] = input_tensor
- input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
- input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
- output0[output] = output_tensor
- Example((input0, output0))
+input0[input] = [2., 3.]
+input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
+input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
+output0[output] = [-0.36444446, -0.00352185, 0.12886585, -0.05163646]
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm2_state.mod.py b/nn/runtime/test/specs/lstm2_state.mod.py
new file mode 100644
index 000000000..a89f265b8
--- /dev/null
+++ b/nn/runtime/test/specs/lstm2_state.mod.py
@@ -0,0 +1,145 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test, With Cifg, With Peephole, No Projection, No Clipping.
+
+model = Model()
+
+n_batch = 1
+n_input = 2
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 4
+n_output = 4
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{0,0}")
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}");
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell * 3))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+input0 = {input_to_input_weights:[],
+ input_to_cell_weights: [-0.49770179, -0.27711356, -0.09624726, 0.05100781, 0.04717243, 0.48944736, -0.38535351, -0.17212132],
+ input_to_forget_weights: [-0.55291498, -0.42866567, 0.13056988, -0.3633365, -0.22755712, 0.28253698, 0.24407166, 0.33826375],
+ input_to_output_weights: [0.10725588, -0.02335852, -0.55932593, -0.09426838, -0.44257352, 0.54939759, 0.01533556, 0.42751634],
+
+ input_gate_bias: [],
+ forget_gate_bias: [1.,1.,1.,1.],
+ cell_gate_bias: [0.,0.,0.,0.],
+ output_gate_bias: [0.,0.,0.,0.],
+
+ recurrent_to_input_weights: [],
+ recurrent_to_cell_weights: [
+ 0.54066205, -0.32668582, -0.43562764, -0.56094903, 0.42957711,
+ 0.01841056, -0.32764608, -0.33027974, -0.10826075, 0.20675004,
+ 0.19069612, -0.03026325, -0.54532051, 0.33003211, 0.44901288,
+ 0.21193194],
+
+ recurrent_to_forget_weights: [
+ -0.13832897, -0.0515101, -0.2359007, -0.16661474, -0.14340827,
+ 0.36986142, 0.23414481, 0.55899, 0.10798943, -0.41174671, 0.17751795,
+ -0.34484994, -0.35874045, -0.11352962, 0.27268326, 0.54058349],
+
+ recurrent_to_output_weights: [
+ 0.41613156, 0.42610586, -0.16495961, -0.5663873, 0.30579174, -0.05115908,
+ -0.33941799, 0.23364776, 0.11178309, 0.09481031, -0.26424935, 0.46261835,
+ 0.50248802, 0.26114327, -0.43736315, 0.33149987],
+
+ cell_to_input_weights: [],
+ cell_to_forget_weights: [0.47485286, -0.51955009, -0.24458408, 0.31544167],
+ cell_to_output_weights: [-0.17135078, 0.82760304, 0.85573703, -0.77109635],
+
+ projection_weights: [],
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ -0.978419, -0.139203, 0.338163, -0.0983904 ],
+ output_state_out: [ -0.423122, -0.0121822, 0.24201, -0.0812458 ],
+}
+
+input0[input] = [3., 4.]
+input0[output_state_in] = [-0.364445, -0.00352185, 0.128866, -0.0516365]
+input0[cell_state_in] = [-0.760444, -0.0180416, 0.182264, -0.0649371]
+output0[output] = [-0.42312205, -0.01218222, 0.24201041, -0.08124574]
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm2_state2.mod.py b/nn/runtime/test/specs/lstm2_state2.mod.py
new file mode 100644
index 000000000..3e84440df
--- /dev/null
+++ b/nn/runtime/test/specs/lstm2_state2.mod.py
@@ -0,0 +1,146 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test, With Cifg, With Peephole, No Projection, No Clipping.
+
+model = Model()
+
+n_batch = 1
+n_input = 2
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 4
+n_output = 4
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{0,0}")
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}");
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell * 3))
+output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+input0 = {input_to_input_weights:[],
+ input_to_cell_weights: [-0.49770179, -0.27711356, -0.09624726, 0.05100781, 0.04717243, 0.48944736, -0.38535351, -0.17212132],
+ input_to_forget_weights: [-0.55291498, -0.42866567, 0.13056988, -0.3633365, -0.22755712, 0.28253698, 0.24407166, 0.33826375],
+ input_to_output_weights: [0.10725588, -0.02335852, -0.55932593, -0.09426838, -0.44257352, 0.54939759, 0.01533556, 0.42751634],
+
+ input_gate_bias: [],
+ forget_gate_bias: [1.,1.,1.,1.],
+ cell_gate_bias: [0.,0.,0.,0.],
+ output_gate_bias: [0.,0.,0.,0.],
+
+ recurrent_to_input_weights: [],
+ recurrent_to_cell_weights: [
+ 0.54066205, -0.32668582, -0.43562764, -0.56094903, 0.42957711,
+ 0.01841056, -0.32764608, -0.33027974, -0.10826075, 0.20675004,
+ 0.19069612, -0.03026325, -0.54532051, 0.33003211, 0.44901288,
+ 0.21193194],
+
+ recurrent_to_forget_weights: [
+ -0.13832897, -0.0515101, -0.2359007, -0.16661474, -0.14340827,
+ 0.36986142, 0.23414481, 0.55899, 0.10798943, -0.41174671, 0.17751795,
+ -0.34484994, -0.35874045, -0.11352962, 0.27268326, 0.54058349],
+
+ recurrent_to_output_weights: [
+ 0.41613156, 0.42610586, -0.16495961, -0.5663873, 0.30579174, -0.05115908,
+ -0.33941799, 0.23364776, 0.11178309, 0.09481031, -0.26424935, 0.46261835,
+ 0.50248802, 0.26114327, -0.43736315, 0.33149987],
+
+ cell_to_input_weights: [],
+ cell_to_forget_weights: [0.47485286, -0.51955009, -0.24458408, 0.31544167],
+ cell_to_output_weights: [-0.17135078, 0.82760304, 0.85573703, -0.77109635],
+
+ projection_weights: [],
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
+ output_state_out: [ 0 for x in range(n_batch * n_output) ],
+}
+
+input0[input] = [1., 1.]
+input0[output_state_in] = [-0.423122, -0.0121822, 0.24201, -0.0812458]
+input0[cell_state_in] = [-0.978419, -0.139203, 0.338163, -0.0983904]
+output0[output] = [-0.358325, -0.04621704, 0.21641694, -0.06471302]
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm3.mod.py b/nn/runtime/test/specs/lstm3.mod.py
index 23e2b2e28..acfaa4cc5 100644
--- a/nn/runtime/test/specs/lstm3.mod.py
+++ b/nn/runtime/test/specs/lstm3.mod.py
@@ -56,8 +56,8 @@ cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
-output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
-cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
# TODO: need support for more than one output
@@ -616,74 +616,51 @@ input0 = {input_to_input_weights: [
proj_clip_param: [0.],
}
-# Instantiate examples
-# TODO: Add more examples after fixing the reference issue
-test_inputs_batch0 = [
- # Batch0: 4 (input_sequence_size) * 5 (n_input)
- [0.787926, 0.151646, 0.071352, 0.118426, 0.458058],
-# [0.596268, 0.998386, 0.568695, 0.864524, 0.571277],
-# [0.073204, 0.296072, 0.743333, 0.069199, 0.045348],
-# [0.867394, 0.291279, 0.013714, 0.482521, 0.626339]
- ]
-
-test_inputs_batch1 = [
- # Batch1: 4 (input_sequence_size) * 5 (n_input)
- [0.295743, 0.544053, 0.690064, 0.858138, 0.497181],
-# [0.642421, 0.524260, 0.134799, 0.003639, 0.162482],
-# [0.640394, 0.930399, 0.050782, 0.432485, 0.988078],
-# [0.082922, 0.563329, 0.865614, 0.333232, 0.259916]
-]
-
-golden_outputs_batch0 = [
- # Batch0: 4 (input_sequence_size) * 16 (n_output)
- [-0.00396806, 0.029352, -0.00279226, 0.0159977, -0.00835576,
- -0.0211779, 0.0283512, -0.0114597, 0.00907307, -0.0244004,
- -0.0152191, -0.0259063, 0.00914318, 0.00415118, 0.017147,
- 0.0134203],
-# [-0.0166936, 0.0381209, 0.000889694, 0.0143363,
-# -0.0328911, -0.0234288, 0.0333051, -0.012229, 0.0110322,
-# -0.0457725, -0.000832209, -0.0202817, 0.0327257, 0.0121308,
-# 0.0155969, 0.0312091],
-# [-0.0213783, 0.0350169, 0.000324794,
-# 0.0276012, -0.0263374, -0.0371449, 0.0446149, -0.0205474,
-# 0.0103729, -0.0576349, -0.0150052, -0.0292043, 0.0376827,
-# 0.0136115, 0.0243435, 0.0354492],
-# [-0.0189322, 0.0464512,
-# -0.00251373, 0.0225745, -0.0308346, -0.0317124, 0.0460407,
-# -0.0189395, 0.0149363, -0.0530162, -0.0150767, -0.0340193,
-# 0.0286833, 0.00824207, 0.0264887, 0.0305169]
-]
-
-golden_outputs_batch1 = [
- # Batch1: 4 (input_sequence_size) * 16 (n_output)
+# Batch0: 4 (input_sequence_size) * 5 (n_input)
+input0[input] = [0.787926, 0.151646, 0.071352, 0.118426, 0.458058]
+# Batch1: 4 (input_sequence_size) * 5 (n_input)
+input0[input].extend(
+ [0.295743, 0.544053, 0.690064, 0.858138, 0.497181],
+)
+input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
+input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [
+ -0.0531632, -0.0118138, 0.0870833, 0.0347929,
+ -0.076144, -0.0659219, -0.0463811, 0.0141307,
+ -0.0127706, -0.03782, -0.00402401, -0.00571876,
+ -0.187957, -0.0247127, 0.0711425, 0.008244,
+ 0.0492649, 0.126972, 0.0933097, 0.29848,
+ -0.0966178, -0.114417, 0.0387229, 0.0453255,
+ -0.181286, -0.0651251, -0.0996879, -0.00276995,
+ 0.0617558, -0.0100728, 0.056304, -0.077416,
+ -0.162858, -0.0541251, 0.0571202, -0.0525331,
+ 0.0724297, 0.171029, 0.141738, 0.295483,
+ ],
+ output_state_out: [
+ -0.00396806, 0.029352, -0.00279226, 0.0159977,
+ -0.00835577, -0.0211779, 0.0283512, -0.0114597,
+ 0.00907307, -0.0244004, -0.0152191, -0.0259063,
+ 0.00914318, 0.00415119, 0.017147, 0.0134203,
+ -0.013869, 0.0287268, -0.00334694, 0.00733397,
+ -0.0287926, -0.0186926, 0.0193662, -0.0115437,
+ 0.00422612, -0.0345232, 0.00223253, -0.00957321,
+ 0.0210624, 0.013331, 0.0150954, 0.0216801
+ ],
+}
+# Batch0: 4 (input_sequence_size) * 16 (n_output)
+output0[output] = [
+ -0.00396806, 0.029352, -0.00279226, 0.0159977, -0.00835576,
+ -0.0211779, 0.0283512, -0.0114597, 0.00907307, -0.0244004,
+ -0.0152191, -0.0259063, 0.00914318, 0.00415118, 0.017147,
+ 0.0134203]
+# Batch1: 4 (input_sequence_size) * 16 (n_output)
+output0[output].extend(
[-0.013869, 0.0287268, -0.00334693, 0.00733398, -0.0287926,
-0.0186926, 0.0193662, -0.0115437, 0.00422612, -0.0345232,
0.00223253, -0.00957321, 0.0210624, 0.013331, 0.0150954,
0.02168],
-# [-0.0141913, 0.0322082, 0.00227024, 0.0260507,
-# -0.0188721, -0.0296489, 0.0399134, -0.0160509, 0.0116039,
-# -0.0447318, -0.0150515, -0.0277406, 0.0316596, 0.0118233,
-# 0.0214762, 0.0293641],
-# [-0.0204549, 0.0450315, -0.00117378,
-# 0.0167673, -0.0375007, -0.0238314, 0.038784, -0.0174034,
-# 0.0131743, -0.0506589, -0.0048447, -0.0240239, 0.0325789,
-# 0.00790065, 0.0220157, 0.0333314],
-# [-0.0264787, 0.0387855,
-# -0.000764675, 0.0217599, -0.037537, -0.0335206, 0.0431679,
-# -0.0211424, 0.010203, -0.062785, -0.00832363, -0.025181,
-# 0.0412031, 0.0118723, 0.0239643, 0.0394009]
-]
-
-for (input_tensor0, input_tensor1, output_tensor0, output_tensor1) in zip(test_inputs_batch0, test_inputs_batch1, golden_outputs_batch0, golden_outputs_batch1):
- input_tensor0.extend(input_tensor1)
- input0[input] = input_tensor0
- input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
- input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
- output_tensor0.extend(output_tensor1)
- output0 = {
- scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
- cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
- output_state_out: [ 0 for x in range(n_batch * n_output) ],
- output: output_tensor0
- }
- Example((input0, output0))
+ )
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm3_state.mod.py b/nn/runtime/test/specs/lstm3_state.mod.py
new file mode 100644
index 000000000..46a1f8166
--- /dev/null
+++ b/nn/runtime/test/specs/lstm3_state.mod.py
@@ -0,0 +1,687 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test, With Peephole, With Projection, No Clipping
+
+model = Model()
+
+n_batch = 2
+n_input = 5
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 20
+n_output = 16
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{%d}" %(n_cell))
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{%d,%d}" % (n_output, n_cell))
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}");
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+# TODO: need support for more than one output
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+input0 = {input_to_input_weights: [
+ 0.021393683, 0.06124551, 0.046905167, -0.014657677, -0.03149463,
+ 0.09171803, 0.14647801, 0.10797193, -0.0057968358, 0.0019193048,
+ -0.2726754, 0.10154029, -0.018539885, 0.080349885, -0.10262385,
+ -0.022599787, -0.09121155, -0.008675967, -0.045206103, -0.0821282,
+ -0.008045952, 0.015478081, 0.055217247, 0.038719587, 0.044153627,
+ -0.06453243, 0.05031825, -0.046935108, -0.008164439, 0.014574226,
+ -0.1671009, -0.15519552, -0.16819797, -0.13971269, -0.11953059,
+ 0.25005487, -0.22790983, 0.009855087, -0.028140958, -0.11200698,
+ 0.11295408, -0.0035217577, 0.054485075, 0.05184695, 0.064711206,
+ 0.10989193, 0.11674786, 0.03490607, 0.07727357, 0.11390585,
+ -0.1863375, -0.1034451, -0.13945189, -0.049401227, -0.18767063,
+ 0.042483903, 0.14233552, 0.13832581, 0.18350165, 0.14545603,
+ -0.028545704, 0.024939531, 0.050929718, 0.0076203286, -0.0029723682,
+ -0.042484224, -0.11827596, -0.09171104, -0.10808628, -0.16327988,
+ -0.2273378, -0.0993647, -0.017155107, 0.0023917493, 0.049272764,
+ 0.0038534778, 0.054764505, 0.089753784, 0.06947234, 0.08014476,
+ -0.04544234, -0.0497073, -0.07135631, -0.048929106, -0.004042012,
+ -0.009284026, 0.018042054, 0.0036860977, -0.07427302, -0.11434604,
+ -0.018995456, 0.031487543, 0.012834908, 0.019977754, 0.044256654,
+ -0.39292613, -0.18519334, -0.11651281, -0.06809892, 0.011373677],
+
+ input_to_forget_weights: [
+ -0.0018401089, -0.004852237, 0.03698424, 0.014181704, 0.028273236,
+ -0.016726194, -0.05249759, -0.10204261, 0.00861066, -0.040979505,
+ -0.009899187, 0.01923892, -0.028177269, -0.08535103, -0.14585495,
+ 0.10662567, -0.01909731, -0.017883534, -0.0047269356, -0.045103323,
+ 0.0030784295, 0.076784775, 0.07463696, 0.094531395, 0.0814421,
+ -0.12257899, -0.033945758, -0.031303465, 0.045630626, 0.06843887,
+ -0.13492945, -0.012480007, -0.0811829, -0.07224499, -0.09628791,
+ 0.045100946, 0.0012300825, 0.013964662, 0.099372394, 0.02543059,
+ 0.06958324, 0.034257296, 0.0482646, 0.06267997, 0.052625068,
+ 0.12784666, 0.07077897, 0.025725935, 0.04165009, 0.07241905,
+ 0.018668644, -0.037377294, -0.06277783, -0.08833636, -0.040120605,
+ -0.011405586, -0.007808335, -0.010301386, -0.005102167, 0.027717464,
+ 0.05483423, 0.11449111, 0.11289652, 0.10939839, 0.13396506,
+ -0.08402166, -0.01901462, -0.044678304, -0.07720565, 0.014350063,
+ -0.11757958, -0.0652038, -0.08185733, -0.076754324, -0.092614375,
+ 0.10405491, 0.052960336, 0.035755895, 0.035839386, -0.012540553,
+ 0.036881298, 0.02913376, 0.03420159, 0.05448447, -0.054523353,
+ 0.02582715, 0.02327355, -0.011857179, -0.0011980024, -0.034641717,
+ -0.026125094, -0.17582615, -0.15923657, -0.27486774, -0.0006143371,
+ 0.0001771948, -8.470171e-05, 0.02651807, 0.045790765, 0.06956496],
+
+ input_to_cell_weights: [
+ -0.04580283, -0.09549462, -0.032418985, -0.06454633,
+ -0.043528453, 0.043018587, -0.049152344, -0.12418144,
+ -0.078985475, -0.07596889, 0.019484362, -0.11434962,
+ -0.0074034138, -0.06314844, -0.092981495, 0.0062155537,
+ -0.025034338, -0.0028890965, 0.048929527, 0.06235075,
+ 0.10665918, -0.032036792, -0.08505916, -0.10843358,
+ -0.13002433, -0.036816437, -0.02130134, -0.016518239,
+ 0.0047691227, -0.0025825808, 0.066017866, 0.029991534,
+ -0.10652836, -0.1037554, -0.13056071, -0.03266643,
+ -0.033702414, -0.006473424, -0.04611692, 0.014419339,
+ -0.025174323, 0.0396852, 0.081777506, 0.06157468,
+ 0.10210095, -0.009658194, 0.046511717, 0.03603906,
+ 0.0069369148, 0.015960095, -0.06507666, 0.09551598,
+ 0.053568836, 0.06408714, 0.12835667, -0.008714329,
+ -0.20211966, -0.12093674, 0.029450472, 0.2849013,
+ -0.029227901, 0.1164364, -0.08560263, 0.09941786,
+ -0.036999565, -0.028842626, -0.0033637602, -0.017012902,
+ -0.09720865, -0.11193351, -0.029155117, -0.017936034,
+ -0.009768936, -0.04223324, -0.036159635, 0.06505112,
+ -0.021742892, -0.023377212, -0.07221364, -0.06430552,
+ 0.05453865, 0.091149814, 0.06387331, 0.007518393,
+ 0.055960953, 0.069779344, 0.046411168, 0.10509911,
+ 0.07463894, 0.0075130584, 0.012850982, 0.04555431,
+ 0.056955688, 0.06555285, 0.050801456, -0.009862683,
+ 0.00826772, -0.026555609, -0.0073611983, -0.0014897042],
+
+ input_to_output_weights: [
+ -0.0998932, -0.07201956, -0.052803773, -0.15629593, -0.15001918,
+ -0.07650751, 0.02359855, -0.075155355, -0.08037709, -0.15093534,
+ 0.029517552, -0.04751393, 0.010350531, -0.02664851, -0.016839722,
+ -0.023121163, 0.0077019283, 0.012851257, -0.05040649, -0.0129761,
+ -0.021737747, -0.038305793, -0.06870586, -0.01481247, -0.001285394,
+ 0.10124236, 0.083122835, 0.053313006, -0.062235646, -0.075637154,
+ -0.027833903, 0.029774971, 0.1130802, 0.09218906, 0.09506135,
+ -0.086665764, -0.037162706, -0.038880914, -0.035832845, -0.014481564,
+ -0.09825003, -0.12048569, -0.097665586, -0.05287633, -0.0964047,
+ -0.11366429, 0.035777505, 0.13568819, 0.052451383, 0.050649304,
+ 0.05798951, -0.021852335, -0.099848844, 0.014740475, -0.078897946,
+ 0.04974699, 0.014160473, 0.06973932, 0.04964942, 0.033364646,
+ 0.08190124, 0.025535367, 0.050893165, 0.048514254, 0.06945813,
+ -0.078907564, -0.06707616, -0.11844508, -0.09986688, -0.07509403,
+ 0.06263226, 0.14925587, 0.20188436, 0.12098451, 0.14639415,
+ 0.0015017595, -0.014267382, -0.03417257, 0.012711468, 0.0028300495,
+ -0.024758482, -0.05098548, -0.0821182, 0.014225672, 0.021544158,
+ 0.08949725, 0.07505268, -0.0020780868, 0.04908258, 0.06476295,
+ -0.022907063, 0.027562456, 0.040185735, 0.019567577, -0.015598739,
+ -0.049097303, -0.017121866, -0.083368234, -0.02332002, -0.0840956],
+
+ input_gate_bias: [
+ 0.02234832, 0.14757581, 0.18176508, 0.10380666, 0.053110216,
+ -0.06928846, -0.13942584, -0.11816189, 0.19483899, 0.03652339,
+ -0.10250295, 0.036714908, -0.18426876, 0.036065217, 0.21810818,
+ 0.02383196, -0.043370757, 0.08690144, -0.04444982, 0.00030581196],
+
+ forget_gate_bias: [
+ 0.035185695, -0.042891346, -0.03032477, 0.23027696,
+ 0.11098921, 0.15378423, 0.09263801, 0.09790885,
+ 0.09508917, 0.061199076, 0.07665568, -0.015443159,
+ -0.03499149, 0.046190713, 0.08895977, 0.10899629,
+ 0.40694186, 0.06030037, 0.012413437, -0.06108739],
+
+ cell_gate_bias: [
+ -0.024379363, 0.0055531194, 0.23377132, 0.033463873,
+ -0.1483596, -0.10639995, -0.091433935, 0.058573797,
+ -0.06809782, -0.07889636, -0.043246906, -0.09829136,
+ -0.4279842, 0.034901652, 0.18797937, 0.0075234566,
+ 0.016178843, 0.1749513, 0.13975595, 0.92058027],
+
+ output_gate_bias: [
+ 0.046159424, -0.0012809046, 0.03563469, 0.12648113, 0.027195795,
+ 0.35373217, -0.018957434, 0.008907322, -0.0762701, 0.12018895,
+ 0.04216877, 0.0022856654, 0.040952638, 0.3147856, 0.08225149,
+ -0.057416286, -0.14995944, -0.008040261, 0.13208859, 0.029760877],
+
+ recurrent_to_input_weights: [
+ -0.001374326, -0.078856036, 0.10672688, 0.029162422,
+ -0.11585556, 0.02557986, -0.13446963, -0.035785314,
+ -0.01244275, 0.025961924, -0.02337298, -0.044228926,
+ -0.055839065, -0.046598054, -0.010546039, -0.06900766,
+ 0.027239809, 0.022582639, -0.013296484, -0.05459212,
+ 0.08981, -0.045407712, 0.08682226, -0.06867011,
+ -0.14390695, -0.02916037, 0.000996957, 0.091420636,
+ 0.14283475, -0.07390571, -0.06402044, 0.062524505,
+ -0.093129106, 0.04860203, -0.08364217, -0.08119002,
+ 0.009352075, 0.22920375, 0.0016303885, 0.11583097,
+ -0.13732095, 0.012405723, -0.07551853, 0.06343048,
+ 0.12162708, -0.031923793, -0.014335606, 0.01790974,
+ -0.10650317, -0.0724401, 0.08554849, -0.05727212,
+ 0.06556731, -0.042729504, -0.043227166, 0.011683251,
+ -0.013082158, -0.029302018, -0.010899579, -0.062036745,
+ -0.022509435, -0.00964907, -0.01567329, 0.04260106,
+ -0.07787477, -0.11576462, 0.017356863, 0.048673786,
+ -0.017577527, -0.05527947, -0.082487635, -0.040137455,
+ -0.10820036, -0.04666372, 0.022746278, -0.07851417,
+ 0.01068115, 0.032956902, 0.022433773, 0.0026891115,
+ 0.08944216, -0.0685835, 0.010513544, 0.07228705,
+ 0.02032331, -0.059686817, -0.0005566496, -0.086984694,
+ 0.040414046, -0.1380399, 0.094208956, -0.05722982,
+ 0.012092817, -0.04989123, -0.086576, -0.003399834,
+ -0.04696032, -0.045747425, 0.10091314, 0.048676282,
+ -0.029037097, 0.031399418, -0.0040285117, 0.047237843,
+ 0.09504992, 0.041799378, -0.049185462, -0.031518843,
+ -0.10516937, 0.026374253, 0.10058866, -0.0033195973,
+ -0.041975245, 0.0073591834, 0.0033782164, -0.004325073,
+ -0.10167381, 0.042500053, -0.01447153, 0.06464186,
+ -0.017142897, 0.03312627, 0.009205989, 0.024138335,
+ -0.011337001, 0.035530265, -0.010912711, 0.0706555,
+ -0.005894094, 0.051841937, -0.1401738, -0.02351249,
+ 0.0365468, 0.07590991, 0.08838724, 0.021681072,
+ -0.10086113, 0.019608743, -0.06195883, 0.077335775,
+ 0.023646897, -0.095322326, 0.02233014, 0.09756986,
+ -0.048691444, -0.009579111, 0.07595467, 0.11480546,
+ -0.09801813, 0.019894179, 0.08502348, 0.004032281,
+ 0.037211012, 0.068537936, -0.048005626, -0.091520436,
+ -0.028379958, -0.01556313, 0.06554592, -0.045599163,
+ -0.01672207, -0.020169014, -0.011877351, -0.20212261,
+ 0.010889619, 0.0047078193, 0.038385306, 0.08540671,
+ -0.017140968, -0.0035865551, 0.016678626, 0.005633034,
+ 0.015963363, 0.00871737, 0.060130805, 0.028611384,
+ 0.10109069, -0.015060172, -0.07894427, 0.06401885,
+ 0.011584063, -0.024466386, 0.0047652307, -0.09041358,
+ 0.030737216, -0.0046374933, 0.14215417, -0.11823516,
+ 0.019899689, 0.006106124, -0.027092824, 0.0786356,
+ 0.05052217, -0.058925, -0.011402121, -0.024987547,
+ -0.0013661642, -0.06832946, -0.015667673, -0.1083353,
+ -0.00096863037, -0.06988685, -0.053350925, -0.027275559,
+ -0.033664223, -0.07978348, -0.025200296, -0.017207067,
+ -0.058403496, -0.055697463, 0.005798788, 0.12965427,
+ -0.062582195, 0.0013350133, -0.10482091, 0.0379771,
+ 0.072521195, -0.0029455067, -0.13797039, -0.03628521,
+ 0.013806405, -0.017858358, -0.01008298, -0.07700066,
+ -0.017081132, 0.019358726, 0.0027079724, 0.004635139,
+ 0.062634714, -0.02338735, -0.039547626, -0.02050681,
+ 0.03385117, -0.083611414, 0.002862572, -0.09421313,
+ 0.058618143, -0.08598433, 0.00972939, 0.023867095,
+ -0.053934585, -0.023203006, 0.07452513, -0.048767887,
+ -0.07314807, -0.056307215, -0.10433547, -0.06440842,
+ 0.04328182, 0.04389765, -0.020006588, -0.09076438,
+ -0.11652589, -0.021705797, 0.03345259, -0.010329105,
+ -0.025767034, 0.013057034, -0.07316461, -0.10145612,
+ 0.06358255, 0.18531723, 0.07759293, 0.12006465,
+ 0.1305557, 0.058638252, -0.03393652, 0.09622831,
+ -0.16253184, -2.4580743e-06, 0.079869635, -0.070196845,
+ -0.005644518, 0.06857898, -0.12598175, -0.035084512,
+ 0.03156317, -0.12794146, -0.031963028, 0.04692781,
+ 0.030070418, 0.0071660685, -0.095516115, -0.004643372,
+ 0.040170413, -0.062104587, -0.0037324072, 0.0554317,
+ 0.08184801, -0.019164372, 0.06791302, 0.034257166,
+ -0.10307039, 0.021943003, 0.046745934, 0.0790918,
+ -0.0265588, -0.007824208, 0.042546265, -0.00977924,
+ -0.0002440307, -0.017384544, -0.017990116, 0.12252321,
+ -0.014512694, -0.08251313, 0.08861942, 0.13589665,
+ 0.026351685, 0.012641483, 0.07466548, 0.044301085,
+ -0.045414884, -0.051112458, 0.03444247, -0.08502782,
+ -0.04106223, -0.028126027, 0.028473156, 0.10467447],
+
+ recurrent_to_forget_weights: [
+ -0.057784554, -0.026057621, -0.068447545, -0.022581743,
+ 0.14811787, 0.10826372, 0.09471067, 0.03987225,
+ -0.0039523416, 0.00030638507, 0.053185795, 0.10572994,
+ 0.08414449, -0.022036452, -0.00066928595, -0.09203576,
+ 0.032950465, -0.10985798, -0.023809856, 0.0021431844,
+ -0.02196096, -0.00326074, 0.00058621005, -0.074678116,
+ -0.06193199, 0.055729095, 0.03736828, 0.020123724,
+ 0.061878487, -0.04729229, 0.034919553, -0.07585433,
+ -0.04421272, -0.044019096, 0.085488975, 0.04058006,
+ -0.06890133, -0.030951202, -0.024628663, -0.07672815,
+ 0.034293607, 0.08556707, -0.05293577, -0.033561368,
+ -0.04899627, 0.0241671, 0.015736353, -0.095442444,
+ -0.029564252, 0.016493602, -0.035026584, 0.022337519,
+ -0.026871363, 0.004780428, 0.0077918363, -0.03601621,
+ 0.016435321, -0.03263031, -0.09543275, -0.047392778,
+ 0.013454138, 0.028934088, 0.01685226, -0.086110644,
+ -0.046250615, -0.01847454, 0.047608484, 0.07339695,
+ 0.034546845, -0.04881143, 0.009128804, -0.08802852,
+ 0.03761666, 0.008096139, -0.014454086, 0.014361001,
+ -0.023502491, -0.0011840804, -0.07607001, 0.001856849,
+ -0.06509276, -0.006021153, -0.08570962, -0.1451793,
+ 0.060212336, 0.055259194, 0.06974018, 0.049454916,
+ -0.027794661, -0.08077226, -0.016179763, 0.1169753,
+ 0.17213494, -0.0056326236, -0.053934924, -0.0124349,
+ -0.11520337, 0.05409887, 0.088759385, 0.0019655675,
+ 0.0042065294, 0.03881498, 0.019844765, 0.041858196,
+ -0.05695512, 0.047233116, 0.038937137, -0.06542224,
+ 0.014429736, -0.09719407, 0.13908425, -0.05379757,
+ 0.012321099, 0.082840554, -0.029899208, 0.044217527,
+ 0.059855383, 0.07711018, -0.045319796, 0.0948846,
+ -0.011724666, -0.0033288454, -0.033542685, -0.04764985,
+ -0.13873616, 0.040668588, 0.034832682, -0.015319203,
+ -0.018715994, 0.046002675, 0.0599172, -0.043107376,
+ 0.0294216, -0.002314414, -0.022424703, 0.0030315618,
+ 0.0014641669, 0.0029166266, -0.11878115, 0.013738511,
+ 0.12375372, -0.0006038222, 0.029104086, 0.087442465,
+ 0.052958444, 0.07558703, 0.04817258, 0.044462286,
+ -0.015213451, -0.08783778, -0.0561384, -0.003008196,
+ 0.047060397, -0.002058388, 0.03429439, -0.018839769,
+ 0.024734668, 0.024614193, -0.042046934, 0.09597743,
+ -0.0043254104, 0.04320769, 0.0064070094, -0.0019131786,
+ -0.02558259, -0.022822596, -0.023273505, -0.02464396,
+ -0.10991725, -0.006240552, 0.0074488563, 0.024044557,
+ 0.04383914, -0.046476185, 0.028658995, 0.060410924,
+ 0.050786525, 0.009452605, -0.0073054377, -0.024810238,
+ 0.0052906186, 0.0066939713, -0.0020913032, 0.014515517,
+ 0.015898481, 0.021362653, -0.030262267, 0.016587038,
+ -0.011442813, 0.041154444, -0.007631438, -0.03423484,
+ -0.010977775, 0.036152758, 0.0066366293, 0.11915515,
+ 0.02318443, -0.041350313, 0.021485701, -0.10906167,
+ -0.028218046, -0.00954771, 0.020531068, -0.11995105,
+ -0.03672871, 0.024019798, 0.014255957, -0.05221243,
+ -0.00661567, -0.04630967, 0.033188973, 0.10107534,
+ -0.014027541, 0.030796422, -0.10270911, -0.035999842,
+ 0.15443139, 0.07684145, 0.036571592, -0.035900835,
+ -0.0034699554, 0.06209149, 0.015920248, -0.031122351,
+ -0.03858649, 0.01849943, 0.13872518, 0.01503974,
+ 0.069941424, -0.06948533, -0.0088794185, 0.061282158,
+ -0.047401894, 0.03100163, -0.041533746, -0.10430945,
+ 0.044574402, -0.01425562, -0.024290353, 0.034563623,
+ 0.05866852, 0.023947537, -0.09445152, 0.035450947,
+ 0.02247216, -0.0042998926, 0.061146557, -0.10250651,
+ 0.020881841, -0.06747029, 0.10062043, -0.0023941975,
+ 0.03532124, -0.016341697, 0.09685456, -0.016764693,
+ 0.051808182, 0.05875331, -0.04536488, 0.001626336,
+ -0.028892258, -0.01048663, -0.009793449, -0.017093895,
+ 0.010987891, 0.02357273, -0.00010856845, 0.0099760275,
+ -0.001845119, -0.03551521, 0.0018358806, 0.05763657,
+ -0.01769146, 0.040995963, 0.02235177, -0.060430344,
+ 0.11475477, -0.023854522, 0.10071741, 0.0686208,
+ -0.014250481, 0.034261297, 0.047418304, 0.08562733,
+ -0.030519066, 0.0060542435, 0.014653856, -0.038836084,
+ 0.04096551, 0.032249358, -0.08355519, -0.026823482,
+ 0.056386515, -0.010401743, -0.028396193, 0.08507674,
+ 0.014410365, 0.020995233, 0.17040324, 0.11511526,
+ 0.02459721, 0.0066619175, 0.025853224, -0.023133837,
+ -0.081302024, 0.017264642, -0.009585969, 0.09491168,
+ -0.051313367, 0.054532815, -0.014298593, 0.10657464,
+ 0.007076659, 0.10964551, 0.0409152, 0.008275321,
+ -0.07283536, 0.07937492, 0.04192024, -0.1075027],
+
+ recurrent_to_cell_weights: [
+ -0.037322544, 0.018592842, 0.0056175636, -0.06253426,
+ 0.055647098, -0.05713207, -0.05626563, 0.005559383,
+ 0.03375411, -0.025757805, -0.088049285, 0.06017052,
+ -0.06570978, 0.007384076, 0.035123326, -0.07920549,
+ 0.053676967, 0.044480428, -0.07663568, 0.0071805613,
+ 0.08089997, 0.05143358, 0.038261272, 0.03339287,
+ -0.027673481, 0.044746667, 0.028349208, 0.020090483,
+ -0.019443132, -0.030755889, -0.0040000007, 0.04465846,
+ -0.021585021, 0.0031670958, 0.0053199246, -0.056117613,
+ -0.10893326, 0.076739706, -0.08509834, -0.027997585,
+ 0.037871376, 0.01449768, -0.09002357, -0.06111149,
+ -0.046195522, 0.0422062, -0.005683705, -0.1253618,
+ -0.012925729, -0.04890792, 0.06985068, 0.037654128,
+ 0.03398274, -0.004781977, 0.007032333, -0.031787455,
+ 0.010868644, -0.031489216, 0.09525667, 0.013939797,
+ 0.0058680447, 0.0167067, 0.02668468, -0.04797466,
+ -0.048885044, -0.12722108, 0.035304096, 0.06554885,
+ 0.00972396, -0.039238118, -0.05159735, -0.11329045,
+ 0.1613692, -0.03750952, 0.06529313, -0.071974665,
+ -0.11769596, 0.015524369, -0.0013754242, -0.12446318,
+ 0.02786344, -0.014179351, 0.005264273, 0.14376344,
+ 0.015983658, 0.03406988, -0.06939408, 0.040699873,
+ 0.02111075, 0.09669095, 0.041345075, -0.08316494,
+ -0.07684199, -0.045768797, 0.032298047, -0.041805092,
+ 0.0119405, 0.0061010392, 0.12652606, 0.0064572375,
+ -0.024950314, 0.11574242, 0.04508852, -0.04335324,
+ 0.06760663, -0.027437469, 0.07216407, 0.06977076,
+ -0.05438599, 0.034033038, -0.028602652, 0.05346137,
+ 0.043184172, -0.037189785, 0.10420091, 0.00882477,
+ -0.054019816, -0.074273005, -0.030617684, -0.0028467078,
+ 0.024302477, -0.0038869337, 0.005332455, 0.0013399826,
+ 0.04361412, -0.007001822, 0.09631092, -0.06702025,
+ -0.042049985, -0.035070654, -0.04103342, -0.10273396,
+ 0.0544271, 0.037184782, -0.13150354, -0.0058036847,
+ -0.008264958, 0.042035464, 0.05891794, 0.029673764,
+ 0.0063542654, 0.044788733, 0.054816857, 0.062257513,
+ -0.00093483756, 0.048938446, -0.004952862, -0.007730018,
+ -0.04043371, -0.017094059, 0.07229206, -0.023670016,
+ -0.052195564, -0.025616996, -0.01520939, 0.045104615,
+ -0.007376126, 0.003533447, 0.006570588, 0.056037236,
+ 0.12436656, 0.051817212, 0.028532185, -0.08686856,
+ 0.11868599, 0.07663395, -0.07323171, 0.03463402,
+ -0.050708205, -0.04458982, -0.11590894, 0.021273347,
+ 0.1251325, -0.15313013, -0.12224372, 0.17228661,
+ 0.023029093, 0.086124025, 0.006445803, -0.03496501,
+ 0.028332196, 0.04449512, -0.042436164, -0.026587414,
+ -0.006041347, -0.09292539, -0.05678812, 0.03897832,
+ 0.09465633, 0.008115513, -0.02171956, 0.08304309,
+ 0.071401566, 0.019622514, 0.032163795, -0.004167056,
+ 0.02295182, 0.030739572, 0.056506045, 0.004612461,
+ 0.06524936, 0.059999723, 0.046395954, -0.0045512207,
+ -0.1335546, -0.030136576, 0.11584653, -0.014678886,
+ 0.0020118146, -0.09688814, -0.0790206, 0.039770417,
+ -0.0329582, 0.07922767, 0.029322514, 0.026405897,
+ 0.04207835, -0.07073373, 0.063781224, 0.0859677,
+ -0.10925287, -0.07011058, 0.048005477, 0.03438226,
+ -0.09606514, -0.006669445, -0.043381985, 0.04240257,
+ -0.06955775, -0.06769346, 0.043903265, -0.026784198,
+ -0.017840602, 0.024307009, -0.040079936, -0.019946516,
+ 0.045318738, -0.12233574, 0.026170589, 0.0074471775,
+ 0.15978073, 0.10185836, 0.10298046, -0.015476589,
+ -0.039390966, -0.072174534, 0.0739445, -0.1211869,
+ -0.0347889, -0.07943156, 0.014809798, -0.12412325,
+ -0.0030663363, 0.039695457, 0.0647603, -0.08291318,
+ -0.018529687, -0.004423833, 0.0037507233, 0.084633216,
+ -0.01514876, -0.056505352, -0.012800942, -0.06994386,
+ 0.012962922, -0.031234352, 0.07029052, 0.016418684,
+ 0.03618972, 0.055686004, -0.08663945, -0.017404709,
+ -0.054761406, 0.029065743, 0.052404847, 0.020238016,
+ 0.0048197987, -0.0214882, 0.07078733, 0.013016777,
+ 0.06262858, 0.009184685, 0.020785125, -0.043904778,
+ -0.0270329, -0.03299152, -0.060088247, -0.015162964,
+ -0.001828936, 0.12642565, -0.056757294, 0.013586685,
+ 0.09232601, -0.035886683, 0.06000002, 0.05229691,
+ -0.052580316, -0.082029596, -0.010794592, 0.012947712,
+ -0.036429964, -0.085508935, -0.13127148, -0.017744139,
+ 0.031502828, 0.036232427, -0.031581745, 0.023051167,
+ -0.05325106, -0.03421577, 0.028793324, -0.034633752,
+ -0.009881397, -0.043551125, -0.018609839, 0.0019097115,
+ -0.008799762, 0.056595087, 0.0022273948, 0.055752404],
+
+ recurrent_to_output_weights: [
+ 0.025825322, -0.05813119, 0.09495884, -0.045984812, -0.01255415,
+ -0.0026479573, -0.08196161, -0.054914974, -0.0046604523, -0.029587349,
+ -0.044576716, -0.07480124, -0.082868785, 0.023254942, 0.027502948,
+ -0.0039728214, -0.08683098, -0.08116779, -0.014675607, -0.037924774,
+ -0.023314456, -0.007401714, -0.09255757, 0.029460307, -0.08829125,
+ -0.005139627, -0.08989442, -0.0555066, 0.13596267, -0.025062224,
+ -0.048351806, -0.03850004, 0.07266485, -0.022414139, 0.05940088,
+ 0.075114764, 0.09597592, -0.010211725, -0.0049794707, -0.011523867,
+ -0.025980417, 0.072999895, 0.11091378, -0.081685916, 0.014416728,
+ 0.043229222, 0.034178585, -0.07530371, 0.035837382, -0.085607,
+ -0.007721233, -0.03287832, -0.043848954, -0.06404588, -0.06632928,
+ -0.073643476, 0.008214239, -0.045984086, 0.039764922, 0.03474462,
+ 0.060612556, -0.080590084, 0.049127717, 0.04151091, -0.030063879,
+ 0.008801774, -0.023021035, -0.019558564, 0.05158114, -0.010947698,
+ -0.011825728, 0.0075720972, 0.0699727, -0.0039981045, 0.069350146,
+ 0.08799282, 0.016156472, 0.035502106, 0.11695009, 0.006217345,
+ 0.13392477, -0.037875112, 0.025745004, 0.08940699, -0.00924166,
+ 0.0046702605, -0.036598757, -0.08811812, 0.10522024, -0.032441203,
+ 0.008176899, -0.04454919, 0.07058152, 0.0067963637, 0.039206743,
+ 0.03259838, 0.03725492, -0.09515802, 0.013326398, -0.052055415,
+ -0.025676316, 0.03198509, -0.015951829, -0.058556724, 0.036879618,
+ 0.043357447, 0.028362012, -0.05908629, 0.0059240665, -0.04995891,
+ -0.019187413, 0.0276265, -0.01628143, 0.0025863599, 0.08800015,
+ 0.035250366, -0.022165963, -0.07328642, -0.009415526, -0.07455109,
+ 0.11690406, 0.0363299, 0.07411125, 0.042103454, -0.009660886,
+ 0.019076364, 0.018299393, -0.046004917, 0.08891175, 0.0431396,
+ -0.026327137, -0.051502608, 0.08979574, -0.051670972, 0.04940282,
+ -0.07491107, -0.021240504, 0.022596184, -0.034280192, 0.060163025,
+ -0.058211457, -0.051837247, -0.01349775, -0.04639988, -0.035936575,
+ -0.011681591, 0.064818054, 0.0073146066, -0.021745546, -0.043124277,
+ -0.06471268, -0.07053354, -0.029321948, -0.05330136, 0.016933719,
+ -0.053782392, 0.13747959, -0.1361751, -0.11569455, 0.0033329215,
+ 0.05693899, -0.053219706, 0.063698, 0.07977434, -0.07924483,
+ 0.06936997, 0.0034815092, -0.007305279, -0.037325785, -0.07251102,
+ -0.033633437, -0.08677009, 0.091591336, -0.14165086, 0.021752775,
+ 0.019683983, 0.0011612234, -0.058154266, 0.049996935, 0.0288841,
+ -0.0024567875, -0.14345716, 0.010955264, -0.10234828, 0.1183656,
+ -0.0010731248, -0.023590032, -0.072285876, -0.0724771, -0.026382286,
+ -0.0014920527, 0.042667855, 0.0018776858, 0.02986552, 0.009814309,
+ 0.0733756, 0.12289186, 0.018043943, -0.0458958, 0.049412545,
+ 0.033632483, 0.05495232, 0.036686596, -0.013781798, -0.010036754,
+ 0.02576849, -0.08307328, 0.010112348, 0.042521734, -0.05869831,
+ -0.071689695, 0.03876447, -0.13275425, -0.0352966, -0.023077697,
+ 0.10285965, 0.084736146, 0.15568255, -0.00040734606, 0.027835453,
+ -0.10292561, -0.032401145, 0.10053256, -0.026142767, -0.08271222,
+ -0.0030240538, -0.016368777, 0.1070414, 0.042672627, 0.013456989,
+ -0.0437609, -0.022309763, 0.11576483, 0.04108048, 0.061026827,
+ -0.0190714, -0.0869359, 0.037901703, 0.0610107, 0.07202949,
+ 0.01675338, 0.086139716, -0.08795751, -0.014898893, -0.023771819,
+ -0.01965048, 0.007955471, -0.043740474, 0.03346837, -0.10549954,
+ 0.090567775, 0.042013682, -0.03176985, 0.12569028, -0.02421228,
+ -0.029526481, 0.023851605, 0.031539805, 0.05292009, -0.02344001,
+ -0.07811758, -0.08834428, 0.10094801, 0.16594367, -0.06861939,
+ -0.021256343, -0.041093912, -0.06669611, 0.035498552, 0.021757556,
+ -0.09302526, -0.015403468, -0.06614931, -0.051798206, -0.013874718,
+ 0.03630673, 0.010412845, -0.08077351, 0.046185967, 0.0035662893,
+ 0.03541868, -0.094149634, -0.034814864, 0.003128424, -0.020674974,
+ -0.03944324, -0.008110165, -0.11113267, 0.08484226, 0.043586485,
+ 0.040582247, 0.0968012, -0.065249965, -0.028036479, 0.0050708856,
+ 0.0017462453, 0.0326779, 0.041296225, 0.09164146, -0.047743853,
+ -0.015952192, -0.034451712, 0.084197424, -0.05347844, -0.11768019,
+ 0.085926116, -0.08251791, -0.045081906, 0.0948852, 0.068401024,
+ 0.024856757, 0.06978981, -0.057309967, -0.012775832, -0.0032452994,
+ 0.01977615, -0.041040014, -0.024264973, 0.063464895, 0.05431621],
+
+ cell_to_input_weights: [
+ 0.040369894, 0.030746894, 0.24704495, 0.018586371, -0.037586458,
+ -0.15312155, -0.11812848, -0.11465643, 0.20259799, 0.11418174,
+ -0.10116027, -0.011334949, 0.12411352, -0.076769054, -0.052169047,
+ 0.21198851, -0.38871562, -0.09061183, -0.09683246, -0.21929175],
+
+ cell_to_forget_weights: [
+ -0.01998659, -0.15568835, -0.24248174, -0.012770197, 0.041331276,
+ -0.072311886, -0.052123554, -0.0066330447, -0.043891653, 0.036225766,
+ -0.047248036, 0.021479502, 0.033189066, 0.11952997, -0.020432774,
+ 0.64658105, -0.06650122, -0.03467612, 0.095340036, 0.23647355],
+
+ cell_to_output_weights: [
+ 0.08286371, -0.08261836, -0.51210177, 0.002913762, 0.17764764,
+ -0.5495371, -0.08460716, -0.24552552, 0.030037103, 0.04123544,
+ -0.11940523, 0.007358328, 0.1890978, 0.4833202, -0.34441817,
+ 0.36312827, -0.26375428, 0.1457655, -0.19724406, 0.15548733],
+
+ projection_weights: [
+ -0.009802181, 0.09401916, 0.0717386, -0.13895074, 0.09641832,
+ 0.060420845, 0.08539281, 0.054285463, 0.061395317, 0.034448683,
+ -0.042991187, 0.019801661, -0.16840284, -0.015726732, -0.23041931,
+ -0.024478018, -0.10959692, -0.013875541, 0.18600968, -0.061274476,
+ 0.0138165, -0.08160894, -0.07661644, 0.032372914, 0.16169067,
+ 0.22465782, -0.03993472, -0.004017731, 0.08633481, -0.28869787,
+ 0.08682067, 0.17240396, 0.014975425, 0.056431185, 0.031037588,
+ 0.16702051, 0.0077946745, 0.15140012, 0.29405436, 0.120285,
+ -0.188994, -0.027265169, 0.043389652, -0.022061434, 0.014777949,
+ -0.20203483, 0.094781205, 0.19100232, 0.13987629, -0.036132768,
+ -0.06426278, -0.05108664, 0.13221376, 0.009441198, -0.16715929,
+ 0.15859416, -0.040437475, 0.050779544, -0.022187516, 0.012166504,
+ 0.027685808, -0.07675938, -0.0055694645, -0.09444123, 0.0046453946,
+ 0.050794356, 0.10770313, -0.20790008, -0.07149004, -0.11425117,
+ 0.008225835, -0.035802525, 0.14374903, 0.15262283, 0.048710253,
+ 0.1847461, -0.007487823, 0.11000021, -0.09542012, 0.22619456,
+ -0.029149994, 0.08527916, 0.009043713, 0.0042746216, 0.016261552,
+ 0.022461696, 0.12689082, -0.043589946, -0.12035478, -0.08361797,
+ -0.050666027, -0.1248618, -0.1275799, -0.071875185, 0.07377272,
+ 0.09944291, -0.18897448, -0.1593054, -0.06526116, -0.040107165,
+ -0.004618631, -0.067624845, -0.007576253, 0.10727444, 0.041546922,
+ -0.20424393, 0.06907816, 0.050412357, 0.00724631, 0.039827548,
+ 0.12449835, 0.10747581, 0.13708383, 0.09134148, -0.12617786,
+ -0.06428341, 0.09956831, 0.1208086, -0.14676677, -0.0727722,
+ 0.1126304, 0.010139365, 0.015571211, -0.038128063, 0.022913318,
+ -0.042050496, 0.16842307, -0.060597885, 0.10531834, -0.06411776,
+ -0.07451711, -0.03410368, -0.13393489, 0.06534304, 0.003620307,
+ 0.04490757, 0.05970546, 0.05197996, 0.02839995, 0.10434969,
+ -0.013699693, -0.028353551, -0.07260381, 0.047201227, -0.024575593,
+ -0.036445823, 0.07155557, 0.009672501, -0.02328883, 0.009533515,
+ -0.03606021, -0.07421458, -0.028082801, -0.2678904, -0.13221288,
+ 0.18419984, -0.13012612, -0.014588381, -0.035059117, -0.04824723,
+ 0.07830115, -0.056184657, 0.03277091, 0.025466874, 0.14494097,
+ -0.12522776, -0.098633975, -0.10766018, -0.08317623, 0.08594209,
+ 0.07749552, 0.039474737, 0.1776665, -0.07409566, -0.0477268,
+ 0.29323658, 0.10801441, 0.1154011, 0.013952499, 0.10739139,
+ 0.10708251, -0.051456142, 0.0074137426, -0.10430189, 0.10034707,
+ 0.045594677, 0.0635285, -0.0715442, -0.089667566, -0.10811871,
+ 0.00026344223, 0.08298446, -0.009525053, 0.006585689, -0.24567553,
+ -0.09450807, 0.09648481, 0.026996298, -0.06419476, -0.04752702,
+ -0.11063944, -0.23441927, -0.17608605, -0.052156363, 0.067035615,
+ 0.19271925, -0.0032889997, -0.043264326, 0.09663576, -0.057112187,
+ -0.10100678, 0.0628376, 0.04447668, 0.017961001, -0.10094388,
+ -0.10190601, 0.18335468, 0.10494553, -0.052095775, -0.0026118709,
+ 0.10539724, -0.04383912, -0.042349473, 0.08438151, -0.1947263,
+ 0.02251204, 0.11216432, -0.10307853, 0.17351969, -0.039091777,
+ 0.08066188, -0.00561982, 0.12633002, 0.11335965, -0.0088127935,
+ -0.019777594, 0.06864014, -0.059751723, 0.016233567, -0.06894641,
+ -0.28651384, -0.004228674, 0.019708522, -0.16305895, -0.07468996,
+ -0.0855457, 0.099339016, -0.07580735, -0.13775392, 0.08434318,
+ 0.08330512, -0.12131499, 0.031935584, 0.09180414, -0.08876437,
+ -0.08049874, 0.008753825, 0.03498998, 0.030215185, 0.03907079,
+ 0.089751154, 0.029194152, -0.03337423, -0.019092513, 0.04331237,
+ 0.04299654, -0.036394123, -0.12915532, 0.09793732, 0.07512415,
+ -0.11319543, -0.032502122, 0.15661901, 0.07671967, -0.005491124,
+ -0.19379048, -0.218606, 0.21448623, 0.017840758, 0.1416943,
+ -0.07051762, 0.19488361, 0.02664691, -0.18104725, -0.09334311,
+ 0.15026465, -0.15493552, -0.057762887, -0.11604192, -0.262013,
+ -0.01391798, 0.012185008, 0.11156489, -0.07483202, 0.06693364,
+ -0.26151478, 0.046425626, 0.036540434, -0.16435726, 0.17338543,
+ -0.21401681, -0.11385144, -0.08283257, -0.069031075, 0.030635102,
+ 0.010969227, 0.11109743, 0.010919218, 0.027526086, 0.13519906,
+ 0.01891392, -0.046839405, -0.040167913, 0.017953383, -0.09700955,
+ 0.0061885654, -0.07000971, 0.026893595, -0.038844477, 0.14543656],
+
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+# Batch0: 4 (input_sequence_size) * 5 (n_input)
+input0[input] = [0.596268, 0.998386, 0.568695, 0.864524, 0.571277]
+# Batch1: 4 (input_sequence_size) * 5 (n_input)
+input0[input].extend(
+ [0.642421, 0.524260, 0.134799, 0.003639, 0.162482]
+)
+input0[output_state_in] = [
+ -0.00396806, 0.029352, -0.00279226, 0.0159977,
+ -0.00835577, -0.0211779, 0.0283512, -0.0114597,
+ 0.00907307, -0.0244004, -0.0152191, -0.0259063,
+ 0.00914318, 0.00415119, 0.017147, 0.0134203,
+ -0.013869, 0.0287268, -0.00334694, 0.00733397,
+ -0.0287926, -0.0186926, 0.0193662, -0.0115437,
+ 0.00422612, -0.0345232, 0.00223253, -0.00957321,
+ 0.0210624, 0.013331, 0.0150954, 0.0216801,
+]
+input0[cell_state_in] = [
+ -0.0531632, -0.0118138, 0.0870833, 0.0347929,
+ -0.076144, -0.0659219, -0.0463811, 0.0141307,
+ -0.0127706, -0.03782, -0.00402401, -0.00571876,
+ -0.187957, -0.0247127, 0.0711425, 0.008244,
+ 0.0492649, 0.126972, 0.0933097, 0.29848,
+ -0.0966178, -0.114417, 0.0387229, 0.0453255,
+ -0.181286, -0.0651251, -0.0996879, -0.00276995,
+ 0.0617558, -0.0100728, 0.056304, -0.077416,
+ -0.162858, -0.0541251, 0.0571202, -0.0525331,
+ 0.0724297, 0.171029, 0.141738, 0.295483,
+]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [
+ -0.154022, -0.124934, 0.0478463, 0.0607819,
+ -0.218727, -0.111053, -0.103885, -0.00447221,
+ 0.0554757, -0.0207068, 0.0595767, -0.116297,
+ -0.249466, -0.0723206, 0.0794942, -0.0377107,
+ 0.124532, 0.249952, 0.188641, 0.411865,
+ -0.11012, -0.0694494, 0.103501, 0.0428427,
+ -0.167345, -0.106061, -0.0775679, 0.00936161,
+ 0.0105526, -0.0314523, 0.0243475, -0.132179,
+ -0.258763, -0.0307266, 0.107047, -0.0115197,
+ 0.0995485, 0.220027, 0.158355, 0.436369,
+ ],
+ output_state_out: [
+ -0.0166936, 0.0381209, 0.000889684, 0.0143363,
+ -0.0328911, -0.0234288, 0.0333051, -0.012229,
+ 0.0110322, -0.0457725, -0.000832209, -0.0202817,
+ 0.0327257, 0.0121309, 0.0155969, 0.0312091,
+ -0.0141913, 0.0322082, 0.00227024, 0.0260507,
+ -0.0188721, -0.0296489, 0.0399134, -0.0160509,
+ 0.011604, -0.0447318, -0.0150515, -0.0277406,
+ 0.0316596, 0.0118233, 0.0214762, 0.0293641
+ ],
+}
+
+# Batch0: 4 (input_sequence_size) * 16 (n_output)
+output0[output] = [
+ -0.0166936, 0.0381209, 0.000889694, 0.0143363,
+ -0.0328911, -0.0234288, 0.0333051, -0.012229, 0.0110322,
+ -0.0457725, -0.000832209, -0.0202817, 0.0327257, 0.0121308,
+ 0.0155969, 0.0312091]
+# Batch1: 4 (input_sequence_size) * 16 (n_output)
+output0[output].extend(
+ [-0.0141913, 0.0322082, 0.00227024, 0.0260507,
+ -0.0188721, -0.0296489, 0.0399134, -0.0160509, 0.0116039,
+ -0.0447318, -0.0150515, -0.0277406, 0.0316596, 0.0118233,
+ 0.0214762, 0.0293641]
+ )
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm3_state2.mod.py b/nn/runtime/test/specs/lstm3_state2.mod.py
new file mode 100644
index 000000000..da6004f7c
--- /dev/null
+++ b/nn/runtime/test/specs/lstm3_state2.mod.py
@@ -0,0 +1,687 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test, With Peephole, With Projection, No Clipping
+
+model = Model()
+
+n_batch = 2
+n_input = 5
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 20
+n_output = 16
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{%d}" %(n_cell))
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{%d,%d}" % (n_output, n_cell))
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}");
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+# TODO: need support for more than one output
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+input0 = {input_to_input_weights: [
+ 0.021393683, 0.06124551, 0.046905167, -0.014657677, -0.03149463,
+ 0.09171803, 0.14647801, 0.10797193, -0.0057968358, 0.0019193048,
+ -0.2726754, 0.10154029, -0.018539885, 0.080349885, -0.10262385,
+ -0.022599787, -0.09121155, -0.008675967, -0.045206103, -0.0821282,
+ -0.008045952, 0.015478081, 0.055217247, 0.038719587, 0.044153627,
+ -0.06453243, 0.05031825, -0.046935108, -0.008164439, 0.014574226,
+ -0.1671009, -0.15519552, -0.16819797, -0.13971269, -0.11953059,
+ 0.25005487, -0.22790983, 0.009855087, -0.028140958, -0.11200698,
+ 0.11295408, -0.0035217577, 0.054485075, 0.05184695, 0.064711206,
+ 0.10989193, 0.11674786, 0.03490607, 0.07727357, 0.11390585,
+ -0.1863375, -0.1034451, -0.13945189, -0.049401227, -0.18767063,
+ 0.042483903, 0.14233552, 0.13832581, 0.18350165, 0.14545603,
+ -0.028545704, 0.024939531, 0.050929718, 0.0076203286, -0.0029723682,
+ -0.042484224, -0.11827596, -0.09171104, -0.10808628, -0.16327988,
+ -0.2273378, -0.0993647, -0.017155107, 0.0023917493, 0.049272764,
+ 0.0038534778, 0.054764505, 0.089753784, 0.06947234, 0.08014476,
+ -0.04544234, -0.0497073, -0.07135631, -0.048929106, -0.004042012,
+ -0.009284026, 0.018042054, 0.0036860977, -0.07427302, -0.11434604,
+ -0.018995456, 0.031487543, 0.012834908, 0.019977754, 0.044256654,
+ -0.39292613, -0.18519334, -0.11651281, -0.06809892, 0.011373677],
+
+ input_to_forget_weights: [
+ -0.0018401089, -0.004852237, 0.03698424, 0.014181704, 0.028273236,
+ -0.016726194, -0.05249759, -0.10204261, 0.00861066, -0.040979505,
+ -0.009899187, 0.01923892, -0.028177269, -0.08535103, -0.14585495,
+ 0.10662567, -0.01909731, -0.017883534, -0.0047269356, -0.045103323,
+ 0.0030784295, 0.076784775, 0.07463696, 0.094531395, 0.0814421,
+ -0.12257899, -0.033945758, -0.031303465, 0.045630626, 0.06843887,
+ -0.13492945, -0.012480007, -0.0811829, -0.07224499, -0.09628791,
+ 0.045100946, 0.0012300825, 0.013964662, 0.099372394, 0.02543059,
+ 0.06958324, 0.034257296, 0.0482646, 0.06267997, 0.052625068,
+ 0.12784666, 0.07077897, 0.025725935, 0.04165009, 0.07241905,
+ 0.018668644, -0.037377294, -0.06277783, -0.08833636, -0.040120605,
+ -0.011405586, -0.007808335, -0.010301386, -0.005102167, 0.027717464,
+ 0.05483423, 0.11449111, 0.11289652, 0.10939839, 0.13396506,
+ -0.08402166, -0.01901462, -0.044678304, -0.07720565, 0.014350063,
+ -0.11757958, -0.0652038, -0.08185733, -0.076754324, -0.092614375,
+ 0.10405491, 0.052960336, 0.035755895, 0.035839386, -0.012540553,
+ 0.036881298, 0.02913376, 0.03420159, 0.05448447, -0.054523353,
+ 0.02582715, 0.02327355, -0.011857179, -0.0011980024, -0.034641717,
+ -0.026125094, -0.17582615, -0.15923657, -0.27486774, -0.0006143371,
+ 0.0001771948, -8.470171e-05, 0.02651807, 0.045790765, 0.06956496],
+
+ input_to_cell_weights: [
+ -0.04580283, -0.09549462, -0.032418985, -0.06454633,
+ -0.043528453, 0.043018587, -0.049152344, -0.12418144,
+ -0.078985475, -0.07596889, 0.019484362, -0.11434962,
+ -0.0074034138, -0.06314844, -0.092981495, 0.0062155537,
+ -0.025034338, -0.0028890965, 0.048929527, 0.06235075,
+ 0.10665918, -0.032036792, -0.08505916, -0.10843358,
+ -0.13002433, -0.036816437, -0.02130134, -0.016518239,
+ 0.0047691227, -0.0025825808, 0.066017866, 0.029991534,
+ -0.10652836, -0.1037554, -0.13056071, -0.03266643,
+ -0.033702414, -0.006473424, -0.04611692, 0.014419339,
+ -0.025174323, 0.0396852, 0.081777506, 0.06157468,
+ 0.10210095, -0.009658194, 0.046511717, 0.03603906,
+ 0.0069369148, 0.015960095, -0.06507666, 0.09551598,
+ 0.053568836, 0.06408714, 0.12835667, -0.008714329,
+ -0.20211966, -0.12093674, 0.029450472, 0.2849013,
+ -0.029227901, 0.1164364, -0.08560263, 0.09941786,
+ -0.036999565, -0.028842626, -0.0033637602, -0.017012902,
+ -0.09720865, -0.11193351, -0.029155117, -0.017936034,
+ -0.009768936, -0.04223324, -0.036159635, 0.06505112,
+ -0.021742892, -0.023377212, -0.07221364, -0.06430552,
+ 0.05453865, 0.091149814, 0.06387331, 0.007518393,
+ 0.055960953, 0.069779344, 0.046411168, 0.10509911,
+ 0.07463894, 0.0075130584, 0.012850982, 0.04555431,
+ 0.056955688, 0.06555285, 0.050801456, -0.009862683,
+ 0.00826772, -0.026555609, -0.0073611983, -0.0014897042],
+
+ input_to_output_weights: [
+ -0.0998932, -0.07201956, -0.052803773, -0.15629593, -0.15001918,
+ -0.07650751, 0.02359855, -0.075155355, -0.08037709, -0.15093534,
+ 0.029517552, -0.04751393, 0.010350531, -0.02664851, -0.016839722,
+ -0.023121163, 0.0077019283, 0.012851257, -0.05040649, -0.0129761,
+ -0.021737747, -0.038305793, -0.06870586, -0.01481247, -0.001285394,
+ 0.10124236, 0.083122835, 0.053313006, -0.062235646, -0.075637154,
+ -0.027833903, 0.029774971, 0.1130802, 0.09218906, 0.09506135,
+ -0.086665764, -0.037162706, -0.038880914, -0.035832845, -0.014481564,
+ -0.09825003, -0.12048569, -0.097665586, -0.05287633, -0.0964047,
+ -0.11366429, 0.035777505, 0.13568819, 0.052451383, 0.050649304,
+ 0.05798951, -0.021852335, -0.099848844, 0.014740475, -0.078897946,
+ 0.04974699, 0.014160473, 0.06973932, 0.04964942, 0.033364646,
+ 0.08190124, 0.025535367, 0.050893165, 0.048514254, 0.06945813,
+ -0.078907564, -0.06707616, -0.11844508, -0.09986688, -0.07509403,
+ 0.06263226, 0.14925587, 0.20188436, 0.12098451, 0.14639415,
+ 0.0015017595, -0.014267382, -0.03417257, 0.012711468, 0.0028300495,
+ -0.024758482, -0.05098548, -0.0821182, 0.014225672, 0.021544158,
+ 0.08949725, 0.07505268, -0.0020780868, 0.04908258, 0.06476295,
+ -0.022907063, 0.027562456, 0.040185735, 0.019567577, -0.015598739,
+ -0.049097303, -0.017121866, -0.083368234, -0.02332002, -0.0840956],
+
+ input_gate_bias: [
+ 0.02234832, 0.14757581, 0.18176508, 0.10380666, 0.053110216,
+ -0.06928846, -0.13942584, -0.11816189, 0.19483899, 0.03652339,
+ -0.10250295, 0.036714908, -0.18426876, 0.036065217, 0.21810818,
+ 0.02383196, -0.043370757, 0.08690144, -0.04444982, 0.00030581196],
+
+ forget_gate_bias: [
+ 0.035185695, -0.042891346, -0.03032477, 0.23027696,
+ 0.11098921, 0.15378423, 0.09263801, 0.09790885,
+ 0.09508917, 0.061199076, 0.07665568, -0.015443159,
+ -0.03499149, 0.046190713, 0.08895977, 0.10899629,
+ 0.40694186, 0.06030037, 0.012413437, -0.06108739],
+
+ cell_gate_bias: [
+ -0.024379363, 0.0055531194, 0.23377132, 0.033463873,
+ -0.1483596, -0.10639995, -0.091433935, 0.058573797,
+ -0.06809782, -0.07889636, -0.043246906, -0.09829136,
+ -0.4279842, 0.034901652, 0.18797937, 0.0075234566,
+ 0.016178843, 0.1749513, 0.13975595, 0.92058027],
+
+ output_gate_bias: [
+ 0.046159424, -0.0012809046, 0.03563469, 0.12648113, 0.027195795,
+ 0.35373217, -0.018957434, 0.008907322, -0.0762701, 0.12018895,
+ 0.04216877, 0.0022856654, 0.040952638, 0.3147856, 0.08225149,
+ -0.057416286, -0.14995944, -0.008040261, 0.13208859, 0.029760877],
+
+ recurrent_to_input_weights: [
+ -0.001374326, -0.078856036, 0.10672688, 0.029162422,
+ -0.11585556, 0.02557986, -0.13446963, -0.035785314,
+ -0.01244275, 0.025961924, -0.02337298, -0.044228926,
+ -0.055839065, -0.046598054, -0.010546039, -0.06900766,
+ 0.027239809, 0.022582639, -0.013296484, -0.05459212,
+ 0.08981, -0.045407712, 0.08682226, -0.06867011,
+ -0.14390695, -0.02916037, 0.000996957, 0.091420636,
+ 0.14283475, -0.07390571, -0.06402044, 0.062524505,
+ -0.093129106, 0.04860203, -0.08364217, -0.08119002,
+ 0.009352075, 0.22920375, 0.0016303885, 0.11583097,
+ -0.13732095, 0.012405723, -0.07551853, 0.06343048,
+ 0.12162708, -0.031923793, -0.014335606, 0.01790974,
+ -0.10650317, -0.0724401, 0.08554849, -0.05727212,
+ 0.06556731, -0.042729504, -0.043227166, 0.011683251,
+ -0.013082158, -0.029302018, -0.010899579, -0.062036745,
+ -0.022509435, -0.00964907, -0.01567329, 0.04260106,
+ -0.07787477, -0.11576462, 0.017356863, 0.048673786,
+ -0.017577527, -0.05527947, -0.082487635, -0.040137455,
+ -0.10820036, -0.04666372, 0.022746278, -0.07851417,
+ 0.01068115, 0.032956902, 0.022433773, 0.0026891115,
+ 0.08944216, -0.0685835, 0.010513544, 0.07228705,
+ 0.02032331, -0.059686817, -0.0005566496, -0.086984694,
+ 0.040414046, -0.1380399, 0.094208956, -0.05722982,
+ 0.012092817, -0.04989123, -0.086576, -0.003399834,
+ -0.04696032, -0.045747425, 0.10091314, 0.048676282,
+ -0.029037097, 0.031399418, -0.0040285117, 0.047237843,
+ 0.09504992, 0.041799378, -0.049185462, -0.031518843,
+ -0.10516937, 0.026374253, 0.10058866, -0.0033195973,
+ -0.041975245, 0.0073591834, 0.0033782164, -0.004325073,
+ -0.10167381, 0.042500053, -0.01447153, 0.06464186,
+ -0.017142897, 0.03312627, 0.009205989, 0.024138335,
+ -0.011337001, 0.035530265, -0.010912711, 0.0706555,
+ -0.005894094, 0.051841937, -0.1401738, -0.02351249,
+ 0.0365468, 0.07590991, 0.08838724, 0.021681072,
+ -0.10086113, 0.019608743, -0.06195883, 0.077335775,
+ 0.023646897, -0.095322326, 0.02233014, 0.09756986,
+ -0.048691444, -0.009579111, 0.07595467, 0.11480546,
+ -0.09801813, 0.019894179, 0.08502348, 0.004032281,
+ 0.037211012, 0.068537936, -0.048005626, -0.091520436,
+ -0.028379958, -0.01556313, 0.06554592, -0.045599163,
+ -0.01672207, -0.020169014, -0.011877351, -0.20212261,
+ 0.010889619, 0.0047078193, 0.038385306, 0.08540671,
+ -0.017140968, -0.0035865551, 0.016678626, 0.005633034,
+ 0.015963363, 0.00871737, 0.060130805, 0.028611384,
+ 0.10109069, -0.015060172, -0.07894427, 0.06401885,
+ 0.011584063, -0.024466386, 0.0047652307, -0.09041358,
+ 0.030737216, -0.0046374933, 0.14215417, -0.11823516,
+ 0.019899689, 0.006106124, -0.027092824, 0.0786356,
+ 0.05052217, -0.058925, -0.011402121, -0.024987547,
+ -0.0013661642, -0.06832946, -0.015667673, -0.1083353,
+ -0.00096863037, -0.06988685, -0.053350925, -0.027275559,
+ -0.033664223, -0.07978348, -0.025200296, -0.017207067,
+ -0.058403496, -0.055697463, 0.005798788, 0.12965427,
+ -0.062582195, 0.0013350133, -0.10482091, 0.0379771,
+ 0.072521195, -0.0029455067, -0.13797039, -0.03628521,
+ 0.013806405, -0.017858358, -0.01008298, -0.07700066,
+ -0.017081132, 0.019358726, 0.0027079724, 0.004635139,
+ 0.062634714, -0.02338735, -0.039547626, -0.02050681,
+ 0.03385117, -0.083611414, 0.002862572, -0.09421313,
+ 0.058618143, -0.08598433, 0.00972939, 0.023867095,
+ -0.053934585, -0.023203006, 0.07452513, -0.048767887,
+ -0.07314807, -0.056307215, -0.10433547, -0.06440842,
+ 0.04328182, 0.04389765, -0.020006588, -0.09076438,
+ -0.11652589, -0.021705797, 0.03345259, -0.010329105,
+ -0.025767034, 0.013057034, -0.07316461, -0.10145612,
+ 0.06358255, 0.18531723, 0.07759293, 0.12006465,
+ 0.1305557, 0.058638252, -0.03393652, 0.09622831,
+ -0.16253184, -2.4580743e-06, 0.079869635, -0.070196845,
+ -0.005644518, 0.06857898, -0.12598175, -0.035084512,
+ 0.03156317, -0.12794146, -0.031963028, 0.04692781,
+ 0.030070418, 0.0071660685, -0.095516115, -0.004643372,
+ 0.040170413, -0.062104587, -0.0037324072, 0.0554317,
+ 0.08184801, -0.019164372, 0.06791302, 0.034257166,
+ -0.10307039, 0.021943003, 0.046745934, 0.0790918,
+ -0.0265588, -0.007824208, 0.042546265, -0.00977924,
+ -0.0002440307, -0.017384544, -0.017990116, 0.12252321,
+ -0.014512694, -0.08251313, 0.08861942, 0.13589665,
+ 0.026351685, 0.012641483, 0.07466548, 0.044301085,
+ -0.045414884, -0.051112458, 0.03444247, -0.08502782,
+ -0.04106223, -0.028126027, 0.028473156, 0.10467447],
+
+ recurrent_to_forget_weights: [
+ -0.057784554, -0.026057621, -0.068447545, -0.022581743,
+ 0.14811787, 0.10826372, 0.09471067, 0.03987225,
+ -0.0039523416, 0.00030638507, 0.053185795, 0.10572994,
+ 0.08414449, -0.022036452, -0.00066928595, -0.09203576,
+ 0.032950465, -0.10985798, -0.023809856, 0.0021431844,
+ -0.02196096, -0.00326074, 0.00058621005, -0.074678116,
+ -0.06193199, 0.055729095, 0.03736828, 0.020123724,
+ 0.061878487, -0.04729229, 0.034919553, -0.07585433,
+ -0.04421272, -0.044019096, 0.085488975, 0.04058006,
+ -0.06890133, -0.030951202, -0.024628663, -0.07672815,
+ 0.034293607, 0.08556707, -0.05293577, -0.033561368,
+ -0.04899627, 0.0241671, 0.015736353, -0.095442444,
+ -0.029564252, 0.016493602, -0.035026584, 0.022337519,
+ -0.026871363, 0.004780428, 0.0077918363, -0.03601621,
+ 0.016435321, -0.03263031, -0.09543275, -0.047392778,
+ 0.013454138, 0.028934088, 0.01685226, -0.086110644,
+ -0.046250615, -0.01847454, 0.047608484, 0.07339695,
+ 0.034546845, -0.04881143, 0.009128804, -0.08802852,
+ 0.03761666, 0.008096139, -0.014454086, 0.014361001,
+ -0.023502491, -0.0011840804, -0.07607001, 0.001856849,
+ -0.06509276, -0.006021153, -0.08570962, -0.1451793,
+ 0.060212336, 0.055259194, 0.06974018, 0.049454916,
+ -0.027794661, -0.08077226, -0.016179763, 0.1169753,
+ 0.17213494, -0.0056326236, -0.053934924, -0.0124349,
+ -0.11520337, 0.05409887, 0.088759385, 0.0019655675,
+ 0.0042065294, 0.03881498, 0.019844765, 0.041858196,
+ -0.05695512, 0.047233116, 0.038937137, -0.06542224,
+ 0.014429736, -0.09719407, 0.13908425, -0.05379757,
+ 0.012321099, 0.082840554, -0.029899208, 0.044217527,
+ 0.059855383, 0.07711018, -0.045319796, 0.0948846,
+ -0.011724666, -0.0033288454, -0.033542685, -0.04764985,
+ -0.13873616, 0.040668588, 0.034832682, -0.015319203,
+ -0.018715994, 0.046002675, 0.0599172, -0.043107376,
+ 0.0294216, -0.002314414, -0.022424703, 0.0030315618,
+ 0.0014641669, 0.0029166266, -0.11878115, 0.013738511,
+ 0.12375372, -0.0006038222, 0.029104086, 0.087442465,
+ 0.052958444, 0.07558703, 0.04817258, 0.044462286,
+ -0.015213451, -0.08783778, -0.0561384, -0.003008196,
+ 0.047060397, -0.002058388, 0.03429439, -0.018839769,
+ 0.024734668, 0.024614193, -0.042046934, 0.09597743,
+ -0.0043254104, 0.04320769, 0.0064070094, -0.0019131786,
+ -0.02558259, -0.022822596, -0.023273505, -0.02464396,
+ -0.10991725, -0.006240552, 0.0074488563, 0.024044557,
+ 0.04383914, -0.046476185, 0.028658995, 0.060410924,
+ 0.050786525, 0.009452605, -0.0073054377, -0.024810238,
+ 0.0052906186, 0.0066939713, -0.0020913032, 0.014515517,
+ 0.015898481, 0.021362653, -0.030262267, 0.016587038,
+ -0.011442813, 0.041154444, -0.007631438, -0.03423484,
+ -0.010977775, 0.036152758, 0.0066366293, 0.11915515,
+ 0.02318443, -0.041350313, 0.021485701, -0.10906167,
+ -0.028218046, -0.00954771, 0.020531068, -0.11995105,
+ -0.03672871, 0.024019798, 0.014255957, -0.05221243,
+ -0.00661567, -0.04630967, 0.033188973, 0.10107534,
+ -0.014027541, 0.030796422, -0.10270911, -0.035999842,
+ 0.15443139, 0.07684145, 0.036571592, -0.035900835,
+ -0.0034699554, 0.06209149, 0.015920248, -0.031122351,
+ -0.03858649, 0.01849943, 0.13872518, 0.01503974,
+ 0.069941424, -0.06948533, -0.0088794185, 0.061282158,
+ -0.047401894, 0.03100163, -0.041533746, -0.10430945,
+ 0.044574402, -0.01425562, -0.024290353, 0.034563623,
+ 0.05866852, 0.023947537, -0.09445152, 0.035450947,
+ 0.02247216, -0.0042998926, 0.061146557, -0.10250651,
+ 0.020881841, -0.06747029, 0.10062043, -0.0023941975,
+ 0.03532124, -0.016341697, 0.09685456, -0.016764693,
+ 0.051808182, 0.05875331, -0.04536488, 0.001626336,
+ -0.028892258, -0.01048663, -0.009793449, -0.017093895,
+ 0.010987891, 0.02357273, -0.00010856845, 0.0099760275,
+ -0.001845119, -0.03551521, 0.0018358806, 0.05763657,
+ -0.01769146, 0.040995963, 0.02235177, -0.060430344,
+ 0.11475477, -0.023854522, 0.10071741, 0.0686208,
+ -0.014250481, 0.034261297, 0.047418304, 0.08562733,
+ -0.030519066, 0.0060542435, 0.014653856, -0.038836084,
+ 0.04096551, 0.032249358, -0.08355519, -0.026823482,
+ 0.056386515, -0.010401743, -0.028396193, 0.08507674,
+ 0.014410365, 0.020995233, 0.17040324, 0.11511526,
+ 0.02459721, 0.0066619175, 0.025853224, -0.023133837,
+ -0.081302024, 0.017264642, -0.009585969, 0.09491168,
+ -0.051313367, 0.054532815, -0.014298593, 0.10657464,
+ 0.007076659, 0.10964551, 0.0409152, 0.008275321,
+ -0.07283536, 0.07937492, 0.04192024, -0.1075027],
+
+ recurrent_to_cell_weights: [
+ -0.037322544, 0.018592842, 0.0056175636, -0.06253426,
+ 0.055647098, -0.05713207, -0.05626563, 0.005559383,
+ 0.03375411, -0.025757805, -0.088049285, 0.06017052,
+ -0.06570978, 0.007384076, 0.035123326, -0.07920549,
+ 0.053676967, 0.044480428, -0.07663568, 0.0071805613,
+ 0.08089997, 0.05143358, 0.038261272, 0.03339287,
+ -0.027673481, 0.044746667, 0.028349208, 0.020090483,
+ -0.019443132, -0.030755889, -0.0040000007, 0.04465846,
+ -0.021585021, 0.0031670958, 0.0053199246, -0.056117613,
+ -0.10893326, 0.076739706, -0.08509834, -0.027997585,
+ 0.037871376, 0.01449768, -0.09002357, -0.06111149,
+ -0.046195522, 0.0422062, -0.005683705, -0.1253618,
+ -0.012925729, -0.04890792, 0.06985068, 0.037654128,
+ 0.03398274, -0.004781977, 0.007032333, -0.031787455,
+ 0.010868644, -0.031489216, 0.09525667, 0.013939797,
+ 0.0058680447, 0.0167067, 0.02668468, -0.04797466,
+ -0.048885044, -0.12722108, 0.035304096, 0.06554885,
+ 0.00972396, -0.039238118, -0.05159735, -0.11329045,
+ 0.1613692, -0.03750952, 0.06529313, -0.071974665,
+ -0.11769596, 0.015524369, -0.0013754242, -0.12446318,
+ 0.02786344, -0.014179351, 0.005264273, 0.14376344,
+ 0.015983658, 0.03406988, -0.06939408, 0.040699873,
+ 0.02111075, 0.09669095, 0.041345075, -0.08316494,
+ -0.07684199, -0.045768797, 0.032298047, -0.041805092,
+ 0.0119405, 0.0061010392, 0.12652606, 0.0064572375,
+ -0.024950314, 0.11574242, 0.04508852, -0.04335324,
+ 0.06760663, -0.027437469, 0.07216407, 0.06977076,
+ -0.05438599, 0.034033038, -0.028602652, 0.05346137,
+ 0.043184172, -0.037189785, 0.10420091, 0.00882477,
+ -0.054019816, -0.074273005, -0.030617684, -0.0028467078,
+ 0.024302477, -0.0038869337, 0.005332455, 0.0013399826,
+ 0.04361412, -0.007001822, 0.09631092, -0.06702025,
+ -0.042049985, -0.035070654, -0.04103342, -0.10273396,
+ 0.0544271, 0.037184782, -0.13150354, -0.0058036847,
+ -0.008264958, 0.042035464, 0.05891794, 0.029673764,
+ 0.0063542654, 0.044788733, 0.054816857, 0.062257513,
+ -0.00093483756, 0.048938446, -0.004952862, -0.007730018,
+ -0.04043371, -0.017094059, 0.07229206, -0.023670016,
+ -0.052195564, -0.025616996, -0.01520939, 0.045104615,
+ -0.007376126, 0.003533447, 0.006570588, 0.056037236,
+ 0.12436656, 0.051817212, 0.028532185, -0.08686856,
+ 0.11868599, 0.07663395, -0.07323171, 0.03463402,
+ -0.050708205, -0.04458982, -0.11590894, 0.021273347,
+ 0.1251325, -0.15313013, -0.12224372, 0.17228661,
+ 0.023029093, 0.086124025, 0.006445803, -0.03496501,
+ 0.028332196, 0.04449512, -0.042436164, -0.026587414,
+ -0.006041347, -0.09292539, -0.05678812, 0.03897832,
+ 0.09465633, 0.008115513, -0.02171956, 0.08304309,
+ 0.071401566, 0.019622514, 0.032163795, -0.004167056,
+ 0.02295182, 0.030739572, 0.056506045, 0.004612461,
+ 0.06524936, 0.059999723, 0.046395954, -0.0045512207,
+ -0.1335546, -0.030136576, 0.11584653, -0.014678886,
+ 0.0020118146, -0.09688814, -0.0790206, 0.039770417,
+ -0.0329582, 0.07922767, 0.029322514, 0.026405897,
+ 0.04207835, -0.07073373, 0.063781224, 0.0859677,
+ -0.10925287, -0.07011058, 0.048005477, 0.03438226,
+ -0.09606514, -0.006669445, -0.043381985, 0.04240257,
+ -0.06955775, -0.06769346, 0.043903265, -0.026784198,
+ -0.017840602, 0.024307009, -0.040079936, -0.019946516,
+ 0.045318738, -0.12233574, 0.026170589, 0.0074471775,
+ 0.15978073, 0.10185836, 0.10298046, -0.015476589,
+ -0.039390966, -0.072174534, 0.0739445, -0.1211869,
+ -0.0347889, -0.07943156, 0.014809798, -0.12412325,
+ -0.0030663363, 0.039695457, 0.0647603, -0.08291318,
+ -0.018529687, -0.004423833, 0.0037507233, 0.084633216,
+ -0.01514876, -0.056505352, -0.012800942, -0.06994386,
+ 0.012962922, -0.031234352, 0.07029052, 0.016418684,
+ 0.03618972, 0.055686004, -0.08663945, -0.017404709,
+ -0.054761406, 0.029065743, 0.052404847, 0.020238016,
+ 0.0048197987, -0.0214882, 0.07078733, 0.013016777,
+ 0.06262858, 0.009184685, 0.020785125, -0.043904778,
+ -0.0270329, -0.03299152, -0.060088247, -0.015162964,
+ -0.001828936, 0.12642565, -0.056757294, 0.013586685,
+ 0.09232601, -0.035886683, 0.06000002, 0.05229691,
+ -0.052580316, -0.082029596, -0.010794592, 0.012947712,
+ -0.036429964, -0.085508935, -0.13127148, -0.017744139,
+ 0.031502828, 0.036232427, -0.031581745, 0.023051167,
+ -0.05325106, -0.03421577, 0.028793324, -0.034633752,
+ -0.009881397, -0.043551125, -0.018609839, 0.0019097115,
+ -0.008799762, 0.056595087, 0.0022273948, 0.055752404],
+
+ recurrent_to_output_weights: [
+ 0.025825322, -0.05813119, 0.09495884, -0.045984812, -0.01255415,
+ -0.0026479573, -0.08196161, -0.054914974, -0.0046604523, -0.029587349,
+ -0.044576716, -0.07480124, -0.082868785, 0.023254942, 0.027502948,
+ -0.0039728214, -0.08683098, -0.08116779, -0.014675607, -0.037924774,
+ -0.023314456, -0.007401714, -0.09255757, 0.029460307, -0.08829125,
+ -0.005139627, -0.08989442, -0.0555066, 0.13596267, -0.025062224,
+ -0.048351806, -0.03850004, 0.07266485, -0.022414139, 0.05940088,
+ 0.075114764, 0.09597592, -0.010211725, -0.0049794707, -0.011523867,
+ -0.025980417, 0.072999895, 0.11091378, -0.081685916, 0.014416728,
+ 0.043229222, 0.034178585, -0.07530371, 0.035837382, -0.085607,
+ -0.007721233, -0.03287832, -0.043848954, -0.06404588, -0.06632928,
+ -0.073643476, 0.008214239, -0.045984086, 0.039764922, 0.03474462,
+ 0.060612556, -0.080590084, 0.049127717, 0.04151091, -0.030063879,
+ 0.008801774, -0.023021035, -0.019558564, 0.05158114, -0.010947698,
+ -0.011825728, 0.0075720972, 0.0699727, -0.0039981045, 0.069350146,
+ 0.08799282, 0.016156472, 0.035502106, 0.11695009, 0.006217345,
+ 0.13392477, -0.037875112, 0.025745004, 0.08940699, -0.00924166,
+ 0.0046702605, -0.036598757, -0.08811812, 0.10522024, -0.032441203,
+ 0.008176899, -0.04454919, 0.07058152, 0.0067963637, 0.039206743,
+ 0.03259838, 0.03725492, -0.09515802, 0.013326398, -0.052055415,
+ -0.025676316, 0.03198509, -0.015951829, -0.058556724, 0.036879618,
+ 0.043357447, 0.028362012, -0.05908629, 0.0059240665, -0.04995891,
+ -0.019187413, 0.0276265, -0.01628143, 0.0025863599, 0.08800015,
+ 0.035250366, -0.022165963, -0.07328642, -0.009415526, -0.07455109,
+ 0.11690406, 0.0363299, 0.07411125, 0.042103454, -0.009660886,
+ 0.019076364, 0.018299393, -0.046004917, 0.08891175, 0.0431396,
+ -0.026327137, -0.051502608, 0.08979574, -0.051670972, 0.04940282,
+ -0.07491107, -0.021240504, 0.022596184, -0.034280192, 0.060163025,
+ -0.058211457, -0.051837247, -0.01349775, -0.04639988, -0.035936575,
+ -0.011681591, 0.064818054, 0.0073146066, -0.021745546, -0.043124277,
+ -0.06471268, -0.07053354, -0.029321948, -0.05330136, 0.016933719,
+ -0.053782392, 0.13747959, -0.1361751, -0.11569455, 0.0033329215,
+ 0.05693899, -0.053219706, 0.063698, 0.07977434, -0.07924483,
+ 0.06936997, 0.0034815092, -0.007305279, -0.037325785, -0.07251102,
+ -0.033633437, -0.08677009, 0.091591336, -0.14165086, 0.021752775,
+ 0.019683983, 0.0011612234, -0.058154266, 0.049996935, 0.0288841,
+ -0.0024567875, -0.14345716, 0.010955264, -0.10234828, 0.1183656,
+ -0.0010731248, -0.023590032, -0.072285876, -0.0724771, -0.026382286,
+ -0.0014920527, 0.042667855, 0.0018776858, 0.02986552, 0.009814309,
+ 0.0733756, 0.12289186, 0.018043943, -0.0458958, 0.049412545,
+ 0.033632483, 0.05495232, 0.036686596, -0.013781798, -0.010036754,
+ 0.02576849, -0.08307328, 0.010112348, 0.042521734, -0.05869831,
+ -0.071689695, 0.03876447, -0.13275425, -0.0352966, -0.023077697,
+ 0.10285965, 0.084736146, 0.15568255, -0.00040734606, 0.027835453,
+ -0.10292561, -0.032401145, 0.10053256, -0.026142767, -0.08271222,
+ -0.0030240538, -0.016368777, 0.1070414, 0.042672627, 0.013456989,
+ -0.0437609, -0.022309763, 0.11576483, 0.04108048, 0.061026827,
+ -0.0190714, -0.0869359, 0.037901703, 0.0610107, 0.07202949,
+ 0.01675338, 0.086139716, -0.08795751, -0.014898893, -0.023771819,
+ -0.01965048, 0.007955471, -0.043740474, 0.03346837, -0.10549954,
+ 0.090567775, 0.042013682, -0.03176985, 0.12569028, -0.02421228,
+ -0.029526481, 0.023851605, 0.031539805, 0.05292009, -0.02344001,
+ -0.07811758, -0.08834428, 0.10094801, 0.16594367, -0.06861939,
+ -0.021256343, -0.041093912, -0.06669611, 0.035498552, 0.021757556,
+ -0.09302526, -0.015403468, -0.06614931, -0.051798206, -0.013874718,
+ 0.03630673, 0.010412845, -0.08077351, 0.046185967, 0.0035662893,
+ 0.03541868, -0.094149634, -0.034814864, 0.003128424, -0.020674974,
+ -0.03944324, -0.008110165, -0.11113267, 0.08484226, 0.043586485,
+ 0.040582247, 0.0968012, -0.065249965, -0.028036479, 0.0050708856,
+ 0.0017462453, 0.0326779, 0.041296225, 0.09164146, -0.047743853,
+ -0.015952192, -0.034451712, 0.084197424, -0.05347844, -0.11768019,
+ 0.085926116, -0.08251791, -0.045081906, 0.0948852, 0.068401024,
+ 0.024856757, 0.06978981, -0.057309967, -0.012775832, -0.0032452994,
+ 0.01977615, -0.041040014, -0.024264973, 0.063464895, 0.05431621],
+
+ cell_to_input_weights: [
+ 0.040369894, 0.030746894, 0.24704495, 0.018586371, -0.037586458,
+ -0.15312155, -0.11812848, -0.11465643, 0.20259799, 0.11418174,
+ -0.10116027, -0.011334949, 0.12411352, -0.076769054, -0.052169047,
+ 0.21198851, -0.38871562, -0.09061183, -0.09683246, -0.21929175],
+
+ cell_to_forget_weights: [
+ -0.01998659, -0.15568835, -0.24248174, -0.012770197, 0.041331276,
+ -0.072311886, -0.052123554, -0.0066330447, -0.043891653, 0.036225766,
+ -0.047248036, 0.021479502, 0.033189066, 0.11952997, -0.020432774,
+ 0.64658105, -0.06650122, -0.03467612, 0.095340036, 0.23647355],
+
+ cell_to_output_weights: [
+ 0.08286371, -0.08261836, -0.51210177, 0.002913762, 0.17764764,
+ -0.5495371, -0.08460716, -0.24552552, 0.030037103, 0.04123544,
+ -0.11940523, 0.007358328, 0.1890978, 0.4833202, -0.34441817,
+ 0.36312827, -0.26375428, 0.1457655, -0.19724406, 0.15548733],
+
+ projection_weights: [
+ -0.009802181, 0.09401916, 0.0717386, -0.13895074, 0.09641832,
+ 0.060420845, 0.08539281, 0.054285463, 0.061395317, 0.034448683,
+ -0.042991187, 0.019801661, -0.16840284, -0.015726732, -0.23041931,
+ -0.024478018, -0.10959692, -0.013875541, 0.18600968, -0.061274476,
+ 0.0138165, -0.08160894, -0.07661644, 0.032372914, 0.16169067,
+ 0.22465782, -0.03993472, -0.004017731, 0.08633481, -0.28869787,
+ 0.08682067, 0.17240396, 0.014975425, 0.056431185, 0.031037588,
+ 0.16702051, 0.0077946745, 0.15140012, 0.29405436, 0.120285,
+ -0.188994, -0.027265169, 0.043389652, -0.022061434, 0.014777949,
+ -0.20203483, 0.094781205, 0.19100232, 0.13987629, -0.036132768,
+ -0.06426278, -0.05108664, 0.13221376, 0.009441198, -0.16715929,
+ 0.15859416, -0.040437475, 0.050779544, -0.022187516, 0.012166504,
+ 0.027685808, -0.07675938, -0.0055694645, -0.09444123, 0.0046453946,
+ 0.050794356, 0.10770313, -0.20790008, -0.07149004, -0.11425117,
+ 0.008225835, -0.035802525, 0.14374903, 0.15262283, 0.048710253,
+ 0.1847461, -0.007487823, 0.11000021, -0.09542012, 0.22619456,
+ -0.029149994, 0.08527916, 0.009043713, 0.0042746216, 0.016261552,
+ 0.022461696, 0.12689082, -0.043589946, -0.12035478, -0.08361797,
+ -0.050666027, -0.1248618, -0.1275799, -0.071875185, 0.07377272,
+ 0.09944291, -0.18897448, -0.1593054, -0.06526116, -0.040107165,
+ -0.004618631, -0.067624845, -0.007576253, 0.10727444, 0.041546922,
+ -0.20424393, 0.06907816, 0.050412357, 0.00724631, 0.039827548,
+ 0.12449835, 0.10747581, 0.13708383, 0.09134148, -0.12617786,
+ -0.06428341, 0.09956831, 0.1208086, -0.14676677, -0.0727722,
+ 0.1126304, 0.010139365, 0.015571211, -0.038128063, 0.022913318,
+ -0.042050496, 0.16842307, -0.060597885, 0.10531834, -0.06411776,
+ -0.07451711, -0.03410368, -0.13393489, 0.06534304, 0.003620307,
+ 0.04490757, 0.05970546, 0.05197996, 0.02839995, 0.10434969,
+ -0.013699693, -0.028353551, -0.07260381, 0.047201227, -0.024575593,
+ -0.036445823, 0.07155557, 0.009672501, -0.02328883, 0.009533515,
+ -0.03606021, -0.07421458, -0.028082801, -0.2678904, -0.13221288,
+ 0.18419984, -0.13012612, -0.014588381, -0.035059117, -0.04824723,
+ 0.07830115, -0.056184657, 0.03277091, 0.025466874, 0.14494097,
+ -0.12522776, -0.098633975, -0.10766018, -0.08317623, 0.08594209,
+ 0.07749552, 0.039474737, 0.1776665, -0.07409566, -0.0477268,
+ 0.29323658, 0.10801441, 0.1154011, 0.013952499, 0.10739139,
+ 0.10708251, -0.051456142, 0.0074137426, -0.10430189, 0.10034707,
+ 0.045594677, 0.0635285, -0.0715442, -0.089667566, -0.10811871,
+ 0.00026344223, 0.08298446, -0.009525053, 0.006585689, -0.24567553,
+ -0.09450807, 0.09648481, 0.026996298, -0.06419476, -0.04752702,
+ -0.11063944, -0.23441927, -0.17608605, -0.052156363, 0.067035615,
+ 0.19271925, -0.0032889997, -0.043264326, 0.09663576, -0.057112187,
+ -0.10100678, 0.0628376, 0.04447668, 0.017961001, -0.10094388,
+ -0.10190601, 0.18335468, 0.10494553, -0.052095775, -0.0026118709,
+ 0.10539724, -0.04383912, -0.042349473, 0.08438151, -0.1947263,
+ 0.02251204, 0.11216432, -0.10307853, 0.17351969, -0.039091777,
+ 0.08066188, -0.00561982, 0.12633002, 0.11335965, -0.0088127935,
+ -0.019777594, 0.06864014, -0.059751723, 0.016233567, -0.06894641,
+ -0.28651384, -0.004228674, 0.019708522, -0.16305895, -0.07468996,
+ -0.0855457, 0.099339016, -0.07580735, -0.13775392, 0.08434318,
+ 0.08330512, -0.12131499, 0.031935584, 0.09180414, -0.08876437,
+ -0.08049874, 0.008753825, 0.03498998, 0.030215185, 0.03907079,
+ 0.089751154, 0.029194152, -0.03337423, -0.019092513, 0.04331237,
+ 0.04299654, -0.036394123, -0.12915532, 0.09793732, 0.07512415,
+ -0.11319543, -0.032502122, 0.15661901, 0.07671967, -0.005491124,
+ -0.19379048, -0.218606, 0.21448623, 0.017840758, 0.1416943,
+ -0.07051762, 0.19488361, 0.02664691, -0.18104725, -0.09334311,
+ 0.15026465, -0.15493552, -0.057762887, -0.11604192, -0.262013,
+ -0.01391798, 0.012185008, 0.11156489, -0.07483202, 0.06693364,
+ -0.26151478, 0.046425626, 0.036540434, -0.16435726, 0.17338543,
+ -0.21401681, -0.11385144, -0.08283257, -0.069031075, 0.030635102,
+ 0.010969227, 0.11109743, 0.010919218, 0.027526086, 0.13519906,
+ 0.01891392, -0.046839405, -0.040167913, 0.017953383, -0.09700955,
+ 0.0061885654, -0.07000971, 0.026893595, -0.038844477, 0.14543656],
+
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+# Batch0: 4 (input_sequence_size) * 5 (n_input)
+input0[input] = [0.073204, 0.296072, 0.743333, 0.069199, 0.045348]
+# Batch1: 4 (input_sequence_size) * 5 (n_input)
+input0[input].extend(
+ [0.640394, 0.930399, 0.050782, 0.432485, 0.988078]
+)
+input0[output_state_in] = [
+ -0.0166936, 0.0381209, 0.000889684, 0.0143363,
+ -0.0328911, -0.0234288, 0.0333051, -0.012229,
+ 0.0110322, -0.0457725, -0.000832209, -0.0202817,
+ 0.0327257, 0.0121309, 0.0155969, 0.0312091,
+ -0.0141913, 0.0322082, 0.00227024, 0.0260507,
+ -0.0188721, -0.0296489, 0.0399134, -0.0160509,
+ 0.011604, -0.0447318, -0.0150515, -0.0277406,
+ 0.0316596, 0.0118233, 0.0214762, 0.0293641,
+]
+input0[cell_state_in] = [
+ -0.154022, -0.124934, 0.0478463, 0.0607819,
+ -0.218727, -0.111053, -0.103885, -0.00447221,
+ 0.0554757, -0.0207068, 0.0595767, -0.116297,
+ -0.249466, -0.0723206, 0.0794942, -0.0377107,
+ 0.124532, 0.249952, 0.188641, 0.411865,
+ -0.11012, -0.0694494, 0.103501, 0.0428427,
+ -0.167345, -0.106061, -0.0775679, 0.00936161,
+ 0.0105526, -0.0314523, 0.0243475, -0.132179,
+ -0.258763, -0.0307266, 0.107047, -0.0115197,
+ 0.0995485, 0.220027, 0.158355, 0.436369,
+]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [
+ -0.126572, -0.121882, 0.121569, 0.0489971,
+ -0.240177, -0.124685, -0.122565, 0.0162748,
+ 0.0317536, -0.0270355, 0.0418199, -0.179755,
+ -0.327279, -0.0342741, 0.133831, -0.0238279,
+ 0.122148, 0.269115, 0.185989, 0.525976,
+ -0.167208, -0.109612, 0.0531226, 0.0695387,
+ -0.248335, -0.134123, -0.108246, 0.00628498,
+ 0.0492984, -0.0264919, 0.0698144, -0.0635602,
+ -0.295363, -0.0760078, 0.102725, -0.0351708,
+ 0.149804, 0.259131, 0.202573, 0.500664,
+ ],
+ output_state_out: [
+ -0.0213783, 0.0350169, 0.000324787, 0.0276012,
+ -0.0263374, -0.0371449, 0.0446149, -0.0205474,
+ 0.0103729, -0.0576349, -0.0150052, -0.0292043,
+ 0.0376827, 0.0136115, 0.0243435, 0.0354492,
+ -0.0204549, 0.0450315, -0.00117379, 0.0167673,
+ -0.0375007, -0.0238314, 0.038784, -0.0174034,
+ 0.0131743, -0.0506589, -0.00484469, -0.0240239,
+ 0.0325789, 0.00790064, 0.0220157, 0.0333314,
+ ],
+}
+
+# Batch0: 4 (input_sequence_size) * 16 (n_output)
+output0[output] = [
+ -0.0213783, 0.0350169, 0.000324794,
+ 0.0276012, -0.0263374, -0.0371449, 0.0446149, -0.0205474,
+ 0.0103729, -0.0576349, -0.0150052, -0.0292043, 0.0376827,
+ 0.0136115, 0.0243435, 0.0354492]
+# Batch1: 4 (input_sequence_size) * 16 (n_output)
+output0[output].extend(
+ [-0.0204549, 0.0450315, -0.00117378,
+ 0.0167673, -0.0375007, -0.0238314, 0.038784, -0.0174034,
+ 0.0131743, -0.0506589, -0.0048447, -0.0240239, 0.0325789,
+ 0.00790065, 0.0220157, 0.0333314],
+ )
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm3_state3.mod.py b/nn/runtime/test/specs/lstm3_state3.mod.py
new file mode 100644
index 000000000..b55511471
--- /dev/null
+++ b/nn/runtime/test/specs/lstm3_state3.mod.py
@@ -0,0 +1,667 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test, With Peephole, With Projection, No Clipping
+
+model = Model()
+
+n_batch = 2
+n_input = 5
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 20
+n_output = 16
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{%d}" %(n_cell))
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{%d}" % (n_cell))
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{%d,%d}" % (n_output, n_cell))
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}");
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
+output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+# TODO: need support for more than one output
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+input0 = {input_to_input_weights: [
+ 0.021393683, 0.06124551, 0.046905167, -0.014657677, -0.03149463,
+ 0.09171803, 0.14647801, 0.10797193, -0.0057968358, 0.0019193048,
+ -0.2726754, 0.10154029, -0.018539885, 0.080349885, -0.10262385,
+ -0.022599787, -0.09121155, -0.008675967, -0.045206103, -0.0821282,
+ -0.008045952, 0.015478081, 0.055217247, 0.038719587, 0.044153627,
+ -0.06453243, 0.05031825, -0.046935108, -0.008164439, 0.014574226,
+ -0.1671009, -0.15519552, -0.16819797, -0.13971269, -0.11953059,
+ 0.25005487, -0.22790983, 0.009855087, -0.028140958, -0.11200698,
+ 0.11295408, -0.0035217577, 0.054485075, 0.05184695, 0.064711206,
+ 0.10989193, 0.11674786, 0.03490607, 0.07727357, 0.11390585,
+ -0.1863375, -0.1034451, -0.13945189, -0.049401227, -0.18767063,
+ 0.042483903, 0.14233552, 0.13832581, 0.18350165, 0.14545603,
+ -0.028545704, 0.024939531, 0.050929718, 0.0076203286, -0.0029723682,
+ -0.042484224, -0.11827596, -0.09171104, -0.10808628, -0.16327988,
+ -0.2273378, -0.0993647, -0.017155107, 0.0023917493, 0.049272764,
+ 0.0038534778, 0.054764505, 0.089753784, 0.06947234, 0.08014476,
+ -0.04544234, -0.0497073, -0.07135631, -0.048929106, -0.004042012,
+ -0.009284026, 0.018042054, 0.0036860977, -0.07427302, -0.11434604,
+ -0.018995456, 0.031487543, 0.012834908, 0.019977754, 0.044256654,
+ -0.39292613, -0.18519334, -0.11651281, -0.06809892, 0.011373677],
+
+ input_to_forget_weights: [
+ -0.0018401089, -0.004852237, 0.03698424, 0.014181704, 0.028273236,
+ -0.016726194, -0.05249759, -0.10204261, 0.00861066, -0.040979505,
+ -0.009899187, 0.01923892, -0.028177269, -0.08535103, -0.14585495,
+ 0.10662567, -0.01909731, -0.017883534, -0.0047269356, -0.045103323,
+ 0.0030784295, 0.076784775, 0.07463696, 0.094531395, 0.0814421,
+ -0.12257899, -0.033945758, -0.031303465, 0.045630626, 0.06843887,
+ -0.13492945, -0.012480007, -0.0811829, -0.07224499, -0.09628791,
+ 0.045100946, 0.0012300825, 0.013964662, 0.099372394, 0.02543059,
+ 0.06958324, 0.034257296, 0.0482646, 0.06267997, 0.052625068,
+ 0.12784666, 0.07077897, 0.025725935, 0.04165009, 0.07241905,
+ 0.018668644, -0.037377294, -0.06277783, -0.08833636, -0.040120605,
+ -0.011405586, -0.007808335, -0.010301386, -0.005102167, 0.027717464,
+ 0.05483423, 0.11449111, 0.11289652, 0.10939839, 0.13396506,
+ -0.08402166, -0.01901462, -0.044678304, -0.07720565, 0.014350063,
+ -0.11757958, -0.0652038, -0.08185733, -0.076754324, -0.092614375,
+ 0.10405491, 0.052960336, 0.035755895, 0.035839386, -0.012540553,
+ 0.036881298, 0.02913376, 0.03420159, 0.05448447, -0.054523353,
+ 0.02582715, 0.02327355, -0.011857179, -0.0011980024, -0.034641717,
+ -0.026125094, -0.17582615, -0.15923657, -0.27486774, -0.0006143371,
+ 0.0001771948, -8.470171e-05, 0.02651807, 0.045790765, 0.06956496],
+
+ input_to_cell_weights: [
+ -0.04580283, -0.09549462, -0.032418985, -0.06454633,
+ -0.043528453, 0.043018587, -0.049152344, -0.12418144,
+ -0.078985475, -0.07596889, 0.019484362, -0.11434962,
+ -0.0074034138, -0.06314844, -0.092981495, 0.0062155537,
+ -0.025034338, -0.0028890965, 0.048929527, 0.06235075,
+ 0.10665918, -0.032036792, -0.08505916, -0.10843358,
+ -0.13002433, -0.036816437, -0.02130134, -0.016518239,
+ 0.0047691227, -0.0025825808, 0.066017866, 0.029991534,
+ -0.10652836, -0.1037554, -0.13056071, -0.03266643,
+ -0.033702414, -0.006473424, -0.04611692, 0.014419339,
+ -0.025174323, 0.0396852, 0.081777506, 0.06157468,
+ 0.10210095, -0.009658194, 0.046511717, 0.03603906,
+ 0.0069369148, 0.015960095, -0.06507666, 0.09551598,
+ 0.053568836, 0.06408714, 0.12835667, -0.008714329,
+ -0.20211966, -0.12093674, 0.029450472, 0.2849013,
+ -0.029227901, 0.1164364, -0.08560263, 0.09941786,
+ -0.036999565, -0.028842626, -0.0033637602, -0.017012902,
+ -0.09720865, -0.11193351, -0.029155117, -0.017936034,
+ -0.009768936, -0.04223324, -0.036159635, 0.06505112,
+ -0.021742892, -0.023377212, -0.07221364, -0.06430552,
+ 0.05453865, 0.091149814, 0.06387331, 0.007518393,
+ 0.055960953, 0.069779344, 0.046411168, 0.10509911,
+ 0.07463894, 0.0075130584, 0.012850982, 0.04555431,
+ 0.056955688, 0.06555285, 0.050801456, -0.009862683,
+ 0.00826772, -0.026555609, -0.0073611983, -0.0014897042],
+
+ input_to_output_weights: [
+ -0.0998932, -0.07201956, -0.052803773, -0.15629593, -0.15001918,
+ -0.07650751, 0.02359855, -0.075155355, -0.08037709, -0.15093534,
+ 0.029517552, -0.04751393, 0.010350531, -0.02664851, -0.016839722,
+ -0.023121163, 0.0077019283, 0.012851257, -0.05040649, -0.0129761,
+ -0.021737747, -0.038305793, -0.06870586, -0.01481247, -0.001285394,
+ 0.10124236, 0.083122835, 0.053313006, -0.062235646, -0.075637154,
+ -0.027833903, 0.029774971, 0.1130802, 0.09218906, 0.09506135,
+ -0.086665764, -0.037162706, -0.038880914, -0.035832845, -0.014481564,
+ -0.09825003, -0.12048569, -0.097665586, -0.05287633, -0.0964047,
+ -0.11366429, 0.035777505, 0.13568819, 0.052451383, 0.050649304,
+ 0.05798951, -0.021852335, -0.099848844, 0.014740475, -0.078897946,
+ 0.04974699, 0.014160473, 0.06973932, 0.04964942, 0.033364646,
+ 0.08190124, 0.025535367, 0.050893165, 0.048514254, 0.06945813,
+ -0.078907564, -0.06707616, -0.11844508, -0.09986688, -0.07509403,
+ 0.06263226, 0.14925587, 0.20188436, 0.12098451, 0.14639415,
+ 0.0015017595, -0.014267382, -0.03417257, 0.012711468, 0.0028300495,
+ -0.024758482, -0.05098548, -0.0821182, 0.014225672, 0.021544158,
+ 0.08949725, 0.07505268, -0.0020780868, 0.04908258, 0.06476295,
+ -0.022907063, 0.027562456, 0.040185735, 0.019567577, -0.015598739,
+ -0.049097303, -0.017121866, -0.083368234, -0.02332002, -0.0840956],
+
+ input_gate_bias: [
+ 0.02234832, 0.14757581, 0.18176508, 0.10380666, 0.053110216,
+ -0.06928846, -0.13942584, -0.11816189, 0.19483899, 0.03652339,
+ -0.10250295, 0.036714908, -0.18426876, 0.036065217, 0.21810818,
+ 0.02383196, -0.043370757, 0.08690144, -0.04444982, 0.00030581196],
+
+ forget_gate_bias: [
+ 0.035185695, -0.042891346, -0.03032477, 0.23027696,
+ 0.11098921, 0.15378423, 0.09263801, 0.09790885,
+ 0.09508917, 0.061199076, 0.07665568, -0.015443159,
+ -0.03499149, 0.046190713, 0.08895977, 0.10899629,
+ 0.40694186, 0.06030037, 0.012413437, -0.06108739],
+
+ cell_gate_bias: [
+ -0.024379363, 0.0055531194, 0.23377132, 0.033463873,
+ -0.1483596, -0.10639995, -0.091433935, 0.058573797,
+ -0.06809782, -0.07889636, -0.043246906, -0.09829136,
+ -0.4279842, 0.034901652, 0.18797937, 0.0075234566,
+ 0.016178843, 0.1749513, 0.13975595, 0.92058027],
+
+ output_gate_bias: [
+ 0.046159424, -0.0012809046, 0.03563469, 0.12648113, 0.027195795,
+ 0.35373217, -0.018957434, 0.008907322, -0.0762701, 0.12018895,
+ 0.04216877, 0.0022856654, 0.040952638, 0.3147856, 0.08225149,
+ -0.057416286, -0.14995944, -0.008040261, 0.13208859, 0.029760877],
+
+ recurrent_to_input_weights: [
+ -0.001374326, -0.078856036, 0.10672688, 0.029162422,
+ -0.11585556, 0.02557986, -0.13446963, -0.035785314,
+ -0.01244275, 0.025961924, -0.02337298, -0.044228926,
+ -0.055839065, -0.046598054, -0.010546039, -0.06900766,
+ 0.027239809, 0.022582639, -0.013296484, -0.05459212,
+ 0.08981, -0.045407712, 0.08682226, -0.06867011,
+ -0.14390695, -0.02916037, 0.000996957, 0.091420636,
+ 0.14283475, -0.07390571, -0.06402044, 0.062524505,
+ -0.093129106, 0.04860203, -0.08364217, -0.08119002,
+ 0.009352075, 0.22920375, 0.0016303885, 0.11583097,
+ -0.13732095, 0.012405723, -0.07551853, 0.06343048,
+ 0.12162708, -0.031923793, -0.014335606, 0.01790974,
+ -0.10650317, -0.0724401, 0.08554849, -0.05727212,
+ 0.06556731, -0.042729504, -0.043227166, 0.011683251,
+ -0.013082158, -0.029302018, -0.010899579, -0.062036745,
+ -0.022509435, -0.00964907, -0.01567329, 0.04260106,
+ -0.07787477, -0.11576462, 0.017356863, 0.048673786,
+ -0.017577527, -0.05527947, -0.082487635, -0.040137455,
+ -0.10820036, -0.04666372, 0.022746278, -0.07851417,
+ 0.01068115, 0.032956902, 0.022433773, 0.0026891115,
+ 0.08944216, -0.0685835, 0.010513544, 0.07228705,
+ 0.02032331, -0.059686817, -0.0005566496, -0.086984694,
+ 0.040414046, -0.1380399, 0.094208956, -0.05722982,
+ 0.012092817, -0.04989123, -0.086576, -0.003399834,
+ -0.04696032, -0.045747425, 0.10091314, 0.048676282,
+ -0.029037097, 0.031399418, -0.0040285117, 0.047237843,
+ 0.09504992, 0.041799378, -0.049185462, -0.031518843,
+ -0.10516937, 0.026374253, 0.10058866, -0.0033195973,
+ -0.041975245, 0.0073591834, 0.0033782164, -0.004325073,
+ -0.10167381, 0.042500053, -0.01447153, 0.06464186,
+ -0.017142897, 0.03312627, 0.009205989, 0.024138335,
+ -0.011337001, 0.035530265, -0.010912711, 0.0706555,
+ -0.005894094, 0.051841937, -0.1401738, -0.02351249,
+ 0.0365468, 0.07590991, 0.08838724, 0.021681072,
+ -0.10086113, 0.019608743, -0.06195883, 0.077335775,
+ 0.023646897, -0.095322326, 0.02233014, 0.09756986,
+ -0.048691444, -0.009579111, 0.07595467, 0.11480546,
+ -0.09801813, 0.019894179, 0.08502348, 0.004032281,
+ 0.037211012, 0.068537936, -0.048005626, -0.091520436,
+ -0.028379958, -0.01556313, 0.06554592, -0.045599163,
+ -0.01672207, -0.020169014, -0.011877351, -0.20212261,
+ 0.010889619, 0.0047078193, 0.038385306, 0.08540671,
+ -0.017140968, -0.0035865551, 0.016678626, 0.005633034,
+ 0.015963363, 0.00871737, 0.060130805, 0.028611384,
+ 0.10109069, -0.015060172, -0.07894427, 0.06401885,
+ 0.011584063, -0.024466386, 0.0047652307, -0.09041358,
+ 0.030737216, -0.0046374933, 0.14215417, -0.11823516,
+ 0.019899689, 0.006106124, -0.027092824, 0.0786356,
+ 0.05052217, -0.058925, -0.011402121, -0.024987547,
+ -0.0013661642, -0.06832946, -0.015667673, -0.1083353,
+ -0.00096863037, -0.06988685, -0.053350925, -0.027275559,
+ -0.033664223, -0.07978348, -0.025200296, -0.017207067,
+ -0.058403496, -0.055697463, 0.005798788, 0.12965427,
+ -0.062582195, 0.0013350133, -0.10482091, 0.0379771,
+ 0.072521195, -0.0029455067, -0.13797039, -0.03628521,
+ 0.013806405, -0.017858358, -0.01008298, -0.07700066,
+ -0.017081132, 0.019358726, 0.0027079724, 0.004635139,
+ 0.062634714, -0.02338735, -0.039547626, -0.02050681,
+ 0.03385117, -0.083611414, 0.002862572, -0.09421313,
+ 0.058618143, -0.08598433, 0.00972939, 0.023867095,
+ -0.053934585, -0.023203006, 0.07452513, -0.048767887,
+ -0.07314807, -0.056307215, -0.10433547, -0.06440842,
+ 0.04328182, 0.04389765, -0.020006588, -0.09076438,
+ -0.11652589, -0.021705797, 0.03345259, -0.010329105,
+ -0.025767034, 0.013057034, -0.07316461, -0.10145612,
+ 0.06358255, 0.18531723, 0.07759293, 0.12006465,
+ 0.1305557, 0.058638252, -0.03393652, 0.09622831,
+ -0.16253184, -2.4580743e-06, 0.079869635, -0.070196845,
+ -0.005644518, 0.06857898, -0.12598175, -0.035084512,
+ 0.03156317, -0.12794146, -0.031963028, 0.04692781,
+ 0.030070418, 0.0071660685, -0.095516115, -0.004643372,
+ 0.040170413, -0.062104587, -0.0037324072, 0.0554317,
+ 0.08184801, -0.019164372, 0.06791302, 0.034257166,
+ -0.10307039, 0.021943003, 0.046745934, 0.0790918,
+ -0.0265588, -0.007824208, 0.042546265, -0.00977924,
+ -0.0002440307, -0.017384544, -0.017990116, 0.12252321,
+ -0.014512694, -0.08251313, 0.08861942, 0.13589665,
+ 0.026351685, 0.012641483, 0.07466548, 0.044301085,
+ -0.045414884, -0.051112458, 0.03444247, -0.08502782,
+ -0.04106223, -0.028126027, 0.028473156, 0.10467447],
+
+ recurrent_to_forget_weights: [
+ -0.057784554, -0.026057621, -0.068447545, -0.022581743,
+ 0.14811787, 0.10826372, 0.09471067, 0.03987225,
+ -0.0039523416, 0.00030638507, 0.053185795, 0.10572994,
+ 0.08414449, -0.022036452, -0.00066928595, -0.09203576,
+ 0.032950465, -0.10985798, -0.023809856, 0.0021431844,
+ -0.02196096, -0.00326074, 0.00058621005, -0.074678116,
+ -0.06193199, 0.055729095, 0.03736828, 0.020123724,
+ 0.061878487, -0.04729229, 0.034919553, -0.07585433,
+ -0.04421272, -0.044019096, 0.085488975, 0.04058006,
+ -0.06890133, -0.030951202, -0.024628663, -0.07672815,
+ 0.034293607, 0.08556707, -0.05293577, -0.033561368,
+ -0.04899627, 0.0241671, 0.015736353, -0.095442444,
+ -0.029564252, 0.016493602, -0.035026584, 0.022337519,
+ -0.026871363, 0.004780428, 0.0077918363, -0.03601621,
+ 0.016435321, -0.03263031, -0.09543275, -0.047392778,
+ 0.013454138, 0.028934088, 0.01685226, -0.086110644,
+ -0.046250615, -0.01847454, 0.047608484, 0.07339695,
+ 0.034546845, -0.04881143, 0.009128804, -0.08802852,
+ 0.03761666, 0.008096139, -0.014454086, 0.014361001,
+ -0.023502491, -0.0011840804, -0.07607001, 0.001856849,
+ -0.06509276, -0.006021153, -0.08570962, -0.1451793,
+ 0.060212336, 0.055259194, 0.06974018, 0.049454916,
+ -0.027794661, -0.08077226, -0.016179763, 0.1169753,
+ 0.17213494, -0.0056326236, -0.053934924, -0.0124349,
+ -0.11520337, 0.05409887, 0.088759385, 0.0019655675,
+ 0.0042065294, 0.03881498, 0.019844765, 0.041858196,
+ -0.05695512, 0.047233116, 0.038937137, -0.06542224,
+ 0.014429736, -0.09719407, 0.13908425, -0.05379757,
+ 0.012321099, 0.082840554, -0.029899208, 0.044217527,
+ 0.059855383, 0.07711018, -0.045319796, 0.0948846,
+ -0.011724666, -0.0033288454, -0.033542685, -0.04764985,
+ -0.13873616, 0.040668588, 0.034832682, -0.015319203,
+ -0.018715994, 0.046002675, 0.0599172, -0.043107376,
+ 0.0294216, -0.002314414, -0.022424703, 0.0030315618,
+ 0.0014641669, 0.0029166266, -0.11878115, 0.013738511,
+ 0.12375372, -0.0006038222, 0.029104086, 0.087442465,
+ 0.052958444, 0.07558703, 0.04817258, 0.044462286,
+ -0.015213451, -0.08783778, -0.0561384, -0.003008196,
+ 0.047060397, -0.002058388, 0.03429439, -0.018839769,
+ 0.024734668, 0.024614193, -0.042046934, 0.09597743,
+ -0.0043254104, 0.04320769, 0.0064070094, -0.0019131786,
+ -0.02558259, -0.022822596, -0.023273505, -0.02464396,
+ -0.10991725, -0.006240552, 0.0074488563, 0.024044557,
+ 0.04383914, -0.046476185, 0.028658995, 0.060410924,
+ 0.050786525, 0.009452605, -0.0073054377, -0.024810238,
+ 0.0052906186, 0.0066939713, -0.0020913032, 0.014515517,
+ 0.015898481, 0.021362653, -0.030262267, 0.016587038,
+ -0.011442813, 0.041154444, -0.007631438, -0.03423484,
+ -0.010977775, 0.036152758, 0.0066366293, 0.11915515,
+ 0.02318443, -0.041350313, 0.021485701, -0.10906167,
+ -0.028218046, -0.00954771, 0.020531068, -0.11995105,
+ -0.03672871, 0.024019798, 0.014255957, -0.05221243,
+ -0.00661567, -0.04630967, 0.033188973, 0.10107534,
+ -0.014027541, 0.030796422, -0.10270911, -0.035999842,
+ 0.15443139, 0.07684145, 0.036571592, -0.035900835,
+ -0.0034699554, 0.06209149, 0.015920248, -0.031122351,
+ -0.03858649, 0.01849943, 0.13872518, 0.01503974,
+ 0.069941424, -0.06948533, -0.0088794185, 0.061282158,
+ -0.047401894, 0.03100163, -0.041533746, -0.10430945,
+ 0.044574402, -0.01425562, -0.024290353, 0.034563623,
+ 0.05866852, 0.023947537, -0.09445152, 0.035450947,
+ 0.02247216, -0.0042998926, 0.061146557, -0.10250651,
+ 0.020881841, -0.06747029, 0.10062043, -0.0023941975,
+ 0.03532124, -0.016341697, 0.09685456, -0.016764693,
+ 0.051808182, 0.05875331, -0.04536488, 0.001626336,
+ -0.028892258, -0.01048663, -0.009793449, -0.017093895,
+ 0.010987891, 0.02357273, -0.00010856845, 0.0099760275,
+ -0.001845119, -0.03551521, 0.0018358806, 0.05763657,
+ -0.01769146, 0.040995963, 0.02235177, -0.060430344,
+ 0.11475477, -0.023854522, 0.10071741, 0.0686208,
+ -0.014250481, 0.034261297, 0.047418304, 0.08562733,
+ -0.030519066, 0.0060542435, 0.014653856, -0.038836084,
+ 0.04096551, 0.032249358, -0.08355519, -0.026823482,
+ 0.056386515, -0.010401743, -0.028396193, 0.08507674,
+ 0.014410365, 0.020995233, 0.17040324, 0.11511526,
+ 0.02459721, 0.0066619175, 0.025853224, -0.023133837,
+ -0.081302024, 0.017264642, -0.009585969, 0.09491168,
+ -0.051313367, 0.054532815, -0.014298593, 0.10657464,
+ 0.007076659, 0.10964551, 0.0409152, 0.008275321,
+ -0.07283536, 0.07937492, 0.04192024, -0.1075027],
+
+ recurrent_to_cell_weights: [
+ -0.037322544, 0.018592842, 0.0056175636, -0.06253426,
+ 0.055647098, -0.05713207, -0.05626563, 0.005559383,
+ 0.03375411, -0.025757805, -0.088049285, 0.06017052,
+ -0.06570978, 0.007384076, 0.035123326, -0.07920549,
+ 0.053676967, 0.044480428, -0.07663568, 0.0071805613,
+ 0.08089997, 0.05143358, 0.038261272, 0.03339287,
+ -0.027673481, 0.044746667, 0.028349208, 0.020090483,
+ -0.019443132, -0.030755889, -0.0040000007, 0.04465846,
+ -0.021585021, 0.0031670958, 0.0053199246, -0.056117613,
+ -0.10893326, 0.076739706, -0.08509834, -0.027997585,
+ 0.037871376, 0.01449768, -0.09002357, -0.06111149,
+ -0.046195522, 0.0422062, -0.005683705, -0.1253618,
+ -0.012925729, -0.04890792, 0.06985068, 0.037654128,
+ 0.03398274, -0.004781977, 0.007032333, -0.031787455,
+ 0.010868644, -0.031489216, 0.09525667, 0.013939797,
+ 0.0058680447, 0.0167067, 0.02668468, -0.04797466,
+ -0.048885044, -0.12722108, 0.035304096, 0.06554885,
+ 0.00972396, -0.039238118, -0.05159735, -0.11329045,
+ 0.1613692, -0.03750952, 0.06529313, -0.071974665,
+ -0.11769596, 0.015524369, -0.0013754242, -0.12446318,
+ 0.02786344, -0.014179351, 0.005264273, 0.14376344,
+ 0.015983658, 0.03406988, -0.06939408, 0.040699873,
+ 0.02111075, 0.09669095, 0.041345075, -0.08316494,
+ -0.07684199, -0.045768797, 0.032298047, -0.041805092,
+ 0.0119405, 0.0061010392, 0.12652606, 0.0064572375,
+ -0.024950314, 0.11574242, 0.04508852, -0.04335324,
+ 0.06760663, -0.027437469, 0.07216407, 0.06977076,
+ -0.05438599, 0.034033038, -0.028602652, 0.05346137,
+ 0.043184172, -0.037189785, 0.10420091, 0.00882477,
+ -0.054019816, -0.074273005, -0.030617684, -0.0028467078,
+ 0.024302477, -0.0038869337, 0.005332455, 0.0013399826,
+ 0.04361412, -0.007001822, 0.09631092, -0.06702025,
+ -0.042049985, -0.035070654, -0.04103342, -0.10273396,
+ 0.0544271, 0.037184782, -0.13150354, -0.0058036847,
+ -0.008264958, 0.042035464, 0.05891794, 0.029673764,
+ 0.0063542654, 0.044788733, 0.054816857, 0.062257513,
+ -0.00093483756, 0.048938446, -0.004952862, -0.007730018,
+ -0.04043371, -0.017094059, 0.07229206, -0.023670016,
+ -0.052195564, -0.025616996, -0.01520939, 0.045104615,
+ -0.007376126, 0.003533447, 0.006570588, 0.056037236,
+ 0.12436656, 0.051817212, 0.028532185, -0.08686856,
+ 0.11868599, 0.07663395, -0.07323171, 0.03463402,
+ -0.050708205, -0.04458982, -0.11590894, 0.021273347,
+ 0.1251325, -0.15313013, -0.12224372, 0.17228661,
+ 0.023029093, 0.086124025, 0.006445803, -0.03496501,
+ 0.028332196, 0.04449512, -0.042436164, -0.026587414,
+ -0.006041347, -0.09292539, -0.05678812, 0.03897832,
+ 0.09465633, 0.008115513, -0.02171956, 0.08304309,
+ 0.071401566, 0.019622514, 0.032163795, -0.004167056,
+ 0.02295182, 0.030739572, 0.056506045, 0.004612461,
+ 0.06524936, 0.059999723, 0.046395954, -0.0045512207,
+ -0.1335546, -0.030136576, 0.11584653, -0.014678886,
+ 0.0020118146, -0.09688814, -0.0790206, 0.039770417,
+ -0.0329582, 0.07922767, 0.029322514, 0.026405897,
+ 0.04207835, -0.07073373, 0.063781224, 0.0859677,
+ -0.10925287, -0.07011058, 0.048005477, 0.03438226,
+ -0.09606514, -0.006669445, -0.043381985, 0.04240257,
+ -0.06955775, -0.06769346, 0.043903265, -0.026784198,
+ -0.017840602, 0.024307009, -0.040079936, -0.019946516,
+ 0.045318738, -0.12233574, 0.026170589, 0.0074471775,
+ 0.15978073, 0.10185836, 0.10298046, -0.015476589,
+ -0.039390966, -0.072174534, 0.0739445, -0.1211869,
+ -0.0347889, -0.07943156, 0.014809798, -0.12412325,
+ -0.0030663363, 0.039695457, 0.0647603, -0.08291318,
+ -0.018529687, -0.004423833, 0.0037507233, 0.084633216,
+ -0.01514876, -0.056505352, -0.012800942, -0.06994386,
+ 0.012962922, -0.031234352, 0.07029052, 0.016418684,
+ 0.03618972, 0.055686004, -0.08663945, -0.017404709,
+ -0.054761406, 0.029065743, 0.052404847, 0.020238016,
+ 0.0048197987, -0.0214882, 0.07078733, 0.013016777,
+ 0.06262858, 0.009184685, 0.020785125, -0.043904778,
+ -0.0270329, -0.03299152, -0.060088247, -0.015162964,
+ -0.001828936, 0.12642565, -0.056757294, 0.013586685,
+ 0.09232601, -0.035886683, 0.06000002, 0.05229691,
+ -0.052580316, -0.082029596, -0.010794592, 0.012947712,
+ -0.036429964, -0.085508935, -0.13127148, -0.017744139,
+ 0.031502828, 0.036232427, -0.031581745, 0.023051167,
+ -0.05325106, -0.03421577, 0.028793324, -0.034633752,
+ -0.009881397, -0.043551125, -0.018609839, 0.0019097115,
+ -0.008799762, 0.056595087, 0.0022273948, 0.055752404],
+
+ recurrent_to_output_weights: [
+ 0.025825322, -0.05813119, 0.09495884, -0.045984812, -0.01255415,
+ -0.0026479573, -0.08196161, -0.054914974, -0.0046604523, -0.029587349,
+ -0.044576716, -0.07480124, -0.082868785, 0.023254942, 0.027502948,
+ -0.0039728214, -0.08683098, -0.08116779, -0.014675607, -0.037924774,
+ -0.023314456, -0.007401714, -0.09255757, 0.029460307, -0.08829125,
+ -0.005139627, -0.08989442, -0.0555066, 0.13596267, -0.025062224,
+ -0.048351806, -0.03850004, 0.07266485, -0.022414139, 0.05940088,
+ 0.075114764, 0.09597592, -0.010211725, -0.0049794707, -0.011523867,
+ -0.025980417, 0.072999895, 0.11091378, -0.081685916, 0.014416728,
+ 0.043229222, 0.034178585, -0.07530371, 0.035837382, -0.085607,
+ -0.007721233, -0.03287832, -0.043848954, -0.06404588, -0.06632928,
+ -0.073643476, 0.008214239, -0.045984086, 0.039764922, 0.03474462,
+ 0.060612556, -0.080590084, 0.049127717, 0.04151091, -0.030063879,
+ 0.008801774, -0.023021035, -0.019558564, 0.05158114, -0.010947698,
+ -0.011825728, 0.0075720972, 0.0699727, -0.0039981045, 0.069350146,
+ 0.08799282, 0.016156472, 0.035502106, 0.11695009, 0.006217345,
+ 0.13392477, -0.037875112, 0.025745004, 0.08940699, -0.00924166,
+ 0.0046702605, -0.036598757, -0.08811812, 0.10522024, -0.032441203,
+ 0.008176899, -0.04454919, 0.07058152, 0.0067963637, 0.039206743,
+ 0.03259838, 0.03725492, -0.09515802, 0.013326398, -0.052055415,
+ -0.025676316, 0.03198509, -0.015951829, -0.058556724, 0.036879618,
+ 0.043357447, 0.028362012, -0.05908629, 0.0059240665, -0.04995891,
+ -0.019187413, 0.0276265, -0.01628143, 0.0025863599, 0.08800015,
+ 0.035250366, -0.022165963, -0.07328642, -0.009415526, -0.07455109,
+ 0.11690406, 0.0363299, 0.07411125, 0.042103454, -0.009660886,
+ 0.019076364, 0.018299393, -0.046004917, 0.08891175, 0.0431396,
+ -0.026327137, -0.051502608, 0.08979574, -0.051670972, 0.04940282,
+ -0.07491107, -0.021240504, 0.022596184, -0.034280192, 0.060163025,
+ -0.058211457, -0.051837247, -0.01349775, -0.04639988, -0.035936575,
+ -0.011681591, 0.064818054, 0.0073146066, -0.021745546, -0.043124277,
+ -0.06471268, -0.07053354, -0.029321948, -0.05330136, 0.016933719,
+ -0.053782392, 0.13747959, -0.1361751, -0.11569455, 0.0033329215,
+ 0.05693899, -0.053219706, 0.063698, 0.07977434, -0.07924483,
+ 0.06936997, 0.0034815092, -0.007305279, -0.037325785, -0.07251102,
+ -0.033633437, -0.08677009, 0.091591336, -0.14165086, 0.021752775,
+ 0.019683983, 0.0011612234, -0.058154266, 0.049996935, 0.0288841,
+ -0.0024567875, -0.14345716, 0.010955264, -0.10234828, 0.1183656,
+ -0.0010731248, -0.023590032, -0.072285876, -0.0724771, -0.026382286,
+ -0.0014920527, 0.042667855, 0.0018776858, 0.02986552, 0.009814309,
+ 0.0733756, 0.12289186, 0.018043943, -0.0458958, 0.049412545,
+ 0.033632483, 0.05495232, 0.036686596, -0.013781798, -0.010036754,
+ 0.02576849, -0.08307328, 0.010112348, 0.042521734, -0.05869831,
+ -0.071689695, 0.03876447, -0.13275425, -0.0352966, -0.023077697,
+ 0.10285965, 0.084736146, 0.15568255, -0.00040734606, 0.027835453,
+ -0.10292561, -0.032401145, 0.10053256, -0.026142767, -0.08271222,
+ -0.0030240538, -0.016368777, 0.1070414, 0.042672627, 0.013456989,
+ -0.0437609, -0.022309763, 0.11576483, 0.04108048, 0.061026827,
+ -0.0190714, -0.0869359, 0.037901703, 0.0610107, 0.07202949,
+ 0.01675338, 0.086139716, -0.08795751, -0.014898893, -0.023771819,
+ -0.01965048, 0.007955471, -0.043740474, 0.03346837, -0.10549954,
+ 0.090567775, 0.042013682, -0.03176985, 0.12569028, -0.02421228,
+ -0.029526481, 0.023851605, 0.031539805, 0.05292009, -0.02344001,
+ -0.07811758, -0.08834428, 0.10094801, 0.16594367, -0.06861939,
+ -0.021256343, -0.041093912, -0.06669611, 0.035498552, 0.021757556,
+ -0.09302526, -0.015403468, -0.06614931, -0.051798206, -0.013874718,
+ 0.03630673, 0.010412845, -0.08077351, 0.046185967, 0.0035662893,
+ 0.03541868, -0.094149634, -0.034814864, 0.003128424, -0.020674974,
+ -0.03944324, -0.008110165, -0.11113267, 0.08484226, 0.043586485,
+ 0.040582247, 0.0968012, -0.065249965, -0.028036479, 0.0050708856,
+ 0.0017462453, 0.0326779, 0.041296225, 0.09164146, -0.047743853,
+ -0.015952192, -0.034451712, 0.084197424, -0.05347844, -0.11768019,
+ 0.085926116, -0.08251791, -0.045081906, 0.0948852, 0.068401024,
+ 0.024856757, 0.06978981, -0.057309967, -0.012775832, -0.0032452994,
+ 0.01977615, -0.041040014, -0.024264973, 0.063464895, 0.05431621],
+
+ cell_to_input_weights: [
+ 0.040369894, 0.030746894, 0.24704495, 0.018586371, -0.037586458,
+ -0.15312155, -0.11812848, -0.11465643, 0.20259799, 0.11418174,
+ -0.10116027, -0.011334949, 0.12411352, -0.076769054, -0.052169047,
+ 0.21198851, -0.38871562, -0.09061183, -0.09683246, -0.21929175],
+
+ cell_to_forget_weights: [
+ -0.01998659, -0.15568835, -0.24248174, -0.012770197, 0.041331276,
+ -0.072311886, -0.052123554, -0.0066330447, -0.043891653, 0.036225766,
+ -0.047248036, 0.021479502, 0.033189066, 0.11952997, -0.020432774,
+ 0.64658105, -0.06650122, -0.03467612, 0.095340036, 0.23647355],
+
+ cell_to_output_weights: [
+ 0.08286371, -0.08261836, -0.51210177, 0.002913762, 0.17764764,
+ -0.5495371, -0.08460716, -0.24552552, 0.030037103, 0.04123544,
+ -0.11940523, 0.007358328, 0.1890978, 0.4833202, -0.34441817,
+ 0.36312827, -0.26375428, 0.1457655, -0.19724406, 0.15548733],
+
+ projection_weights: [
+ -0.009802181, 0.09401916, 0.0717386, -0.13895074, 0.09641832,
+ 0.060420845, 0.08539281, 0.054285463, 0.061395317, 0.034448683,
+ -0.042991187, 0.019801661, -0.16840284, -0.015726732, -0.23041931,
+ -0.024478018, -0.10959692, -0.013875541, 0.18600968, -0.061274476,
+ 0.0138165, -0.08160894, -0.07661644, 0.032372914, 0.16169067,
+ 0.22465782, -0.03993472, -0.004017731, 0.08633481, -0.28869787,
+ 0.08682067, 0.17240396, 0.014975425, 0.056431185, 0.031037588,
+ 0.16702051, 0.0077946745, 0.15140012, 0.29405436, 0.120285,
+ -0.188994, -0.027265169, 0.043389652, -0.022061434, 0.014777949,
+ -0.20203483, 0.094781205, 0.19100232, 0.13987629, -0.036132768,
+ -0.06426278, -0.05108664, 0.13221376, 0.009441198, -0.16715929,
+ 0.15859416, -0.040437475, 0.050779544, -0.022187516, 0.012166504,
+ 0.027685808, -0.07675938, -0.0055694645, -0.09444123, 0.0046453946,
+ 0.050794356, 0.10770313, -0.20790008, -0.07149004, -0.11425117,
+ 0.008225835, -0.035802525, 0.14374903, 0.15262283, 0.048710253,
+ 0.1847461, -0.007487823, 0.11000021, -0.09542012, 0.22619456,
+ -0.029149994, 0.08527916, 0.009043713, 0.0042746216, 0.016261552,
+ 0.022461696, 0.12689082, -0.043589946, -0.12035478, -0.08361797,
+ -0.050666027, -0.1248618, -0.1275799, -0.071875185, 0.07377272,
+ 0.09944291, -0.18897448, -0.1593054, -0.06526116, -0.040107165,
+ -0.004618631, -0.067624845, -0.007576253, 0.10727444, 0.041546922,
+ -0.20424393, 0.06907816, 0.050412357, 0.00724631, 0.039827548,
+ 0.12449835, 0.10747581, 0.13708383, 0.09134148, -0.12617786,
+ -0.06428341, 0.09956831, 0.1208086, -0.14676677, -0.0727722,
+ 0.1126304, 0.010139365, 0.015571211, -0.038128063, 0.022913318,
+ -0.042050496, 0.16842307, -0.060597885, 0.10531834, -0.06411776,
+ -0.07451711, -0.03410368, -0.13393489, 0.06534304, 0.003620307,
+ 0.04490757, 0.05970546, 0.05197996, 0.02839995, 0.10434969,
+ -0.013699693, -0.028353551, -0.07260381, 0.047201227, -0.024575593,
+ -0.036445823, 0.07155557, 0.009672501, -0.02328883, 0.009533515,
+ -0.03606021, -0.07421458, -0.028082801, -0.2678904, -0.13221288,
+ 0.18419984, -0.13012612, -0.014588381, -0.035059117, -0.04824723,
+ 0.07830115, -0.056184657, 0.03277091, 0.025466874, 0.14494097,
+ -0.12522776, -0.098633975, -0.10766018, -0.08317623, 0.08594209,
+ 0.07749552, 0.039474737, 0.1776665, -0.07409566, -0.0477268,
+ 0.29323658, 0.10801441, 0.1154011, 0.013952499, 0.10739139,
+ 0.10708251, -0.051456142, 0.0074137426, -0.10430189, 0.10034707,
+ 0.045594677, 0.0635285, -0.0715442, -0.089667566, -0.10811871,
+ 0.00026344223, 0.08298446, -0.009525053, 0.006585689, -0.24567553,
+ -0.09450807, 0.09648481, 0.026996298, -0.06419476, -0.04752702,
+ -0.11063944, -0.23441927, -0.17608605, -0.052156363, 0.067035615,
+ 0.19271925, -0.0032889997, -0.043264326, 0.09663576, -0.057112187,
+ -0.10100678, 0.0628376, 0.04447668, 0.017961001, -0.10094388,
+ -0.10190601, 0.18335468, 0.10494553, -0.052095775, -0.0026118709,
+ 0.10539724, -0.04383912, -0.042349473, 0.08438151, -0.1947263,
+ 0.02251204, 0.11216432, -0.10307853, 0.17351969, -0.039091777,
+ 0.08066188, -0.00561982, 0.12633002, 0.11335965, -0.0088127935,
+ -0.019777594, 0.06864014, -0.059751723, 0.016233567, -0.06894641,
+ -0.28651384, -0.004228674, 0.019708522, -0.16305895, -0.07468996,
+ -0.0855457, 0.099339016, -0.07580735, -0.13775392, 0.08434318,
+ 0.08330512, -0.12131499, 0.031935584, 0.09180414, -0.08876437,
+ -0.08049874, 0.008753825, 0.03498998, 0.030215185, 0.03907079,
+ 0.089751154, 0.029194152, -0.03337423, -0.019092513, 0.04331237,
+ 0.04299654, -0.036394123, -0.12915532, 0.09793732, 0.07512415,
+ -0.11319543, -0.032502122, 0.15661901, 0.07671967, -0.005491124,
+ -0.19379048, -0.218606, 0.21448623, 0.017840758, 0.1416943,
+ -0.07051762, 0.19488361, 0.02664691, -0.18104725, -0.09334311,
+ 0.15026465, -0.15493552, -0.057762887, -0.11604192, -0.262013,
+ -0.01391798, 0.012185008, 0.11156489, -0.07483202, 0.06693364,
+ -0.26151478, 0.046425626, 0.036540434, -0.16435726, 0.17338543,
+ -0.21401681, -0.11385144, -0.08283257, -0.069031075, 0.030635102,
+ 0.010969227, 0.11109743, 0.010919218, 0.027526086, 0.13519906,
+ 0.01891392, -0.046839405, -0.040167913, 0.017953383, -0.09700955,
+ 0.0061885654, -0.07000971, 0.026893595, -0.038844477, 0.14543656],
+
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+# Batch0: 4 (input_sequence_size) * 5 (n_input)
+input0[input] = [0.867394, 0.291279, 0.013714, 0.482521, 0.626339]
+# Batch1: 4 (input_sequence_size) * 5 (n_input)
+input0[input].extend(
+ [0.082922, 0.563329, 0.865614, 0.333232, 0.259916]
+)
+input0[output_state_in] = [
+ -0.0213783, 0.0350169, 0.000324787, 0.0276012,
+ -0.0263374, -0.0371449, 0.0446149, -0.0205474,
+ 0.0103729, -0.0576349, -0.0150052, -0.0292043,
+ 0.0376827, 0.0136115, 0.0243435, 0.0354492,
+ -0.0204549, 0.0450315, -0.00117379, 0.0167673,
+ -0.0375007, -0.0238314, 0.038784, -0.0174034,
+ 0.0131743, -0.0506589, -0.00484469, -0.0240239,
+ 0.0325789, 0.00790064, 0.0220157, 0.0333314,
+]
+input0[cell_state_in] = [
+ -0.126572, -0.121882, 0.121569, 0.0489971,
+ -0.240177, -0.124685, -0.122565, 0.0162748,
+ 0.0317536, -0.0270355, 0.0418199, -0.179755,
+ -0.327279, -0.0342741, 0.133831, -0.0238279,
+ 0.122148, 0.269115, 0.185989, 0.525976,
+ -0.167208, -0.109612, 0.0531226, 0.0695387,
+ -0.248335, -0.134123, -0.108246, 0.00628498,
+ 0.0492984, -0.0264919, 0.0698144, -0.0635602,
+ -0.295363, -0.0760078, 0.102725, -0.0351708,
+ 0.149804, 0.259131, 0.202573, 0.500664,
+]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
+ output_state_out: [ 0 for x in range(n_batch * n_output) ],
+}
+
+# Batch0: 4 (input_sequence_size) * 16 (n_output)
+output0[output] = [
+ -0.0189322, 0.0464512, -0.00251373, 0.0225745,
+ -0.0308346, -0.0317124, 0.0460407, -0.0189395,
+ 0.0149363, -0.0530162, -0.0150767, -0.0340193,
+ 0.0286833, 0.00824207, 0.0264887, 0.0305169]
+# Batch1: 4 (input_sequence_size) * 16 (n_output)
+output0[output].extend(
+ [-0.0264787, 0.0387855, -0.000764675, 0.0217599,
+ -0.037537, -0.0335206, 0.0431679, -0.0211424,
+ 0.010203, -0.062785, -0.00832363, -0.025181,
+ 0.0412031, 0.0118723, 0.0239643, 0.0394009]
+ )
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm_state.mod.py b/nn/runtime/test/specs/lstm_state.mod.py
new file mode 100644
index 000000000..8862f1063
--- /dev/null
+++ b/nn/runtime/test/specs/lstm_state.mod.py
@@ -0,0 +1,152 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test: No Cifg, No Peephole, No Projection, and No Clipping.
+
+model = Model()
+
+n_batch = 1
+n_input = 2
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 4
+n_output = 4
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{0}")
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{0,0}")
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}")
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
+output_state_out = Output("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = Output("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+# Example 1. Input in operand 0,
+input0 = {input_to_input_weights: [-0.45018822, -0.02338299, -0.0870589, -0.34550029, 0.04266912, -0.15680569, -0.34856534, 0.43890524],
+ input_to_forget_weights: [0.09701663, 0.20334584, -0.50592935, -0.31343272, -0.40032279, 0.44781327, 0.01387155, -0.35593212],
+ input_to_cell_weights: [-0.50013041, 0.1370284, 0.11810488, 0.2013163, -0.20583314, 0.44344562, 0.22077113, -0.29909778],
+ input_to_output_weights: [-0.25065863, -0.28290087, 0.04613829, 0.40525138, 0.44272184, 0.03897077, -0.1556896, 0.19487578],
+
+ input_gate_bias: [0.,0.,0.,0.],
+ forget_gate_bias: [1.,1.,1.,1.],
+ cell_gate_bias: [0.,0.,0.,0.],
+ output_gate_bias: [0.,0.,0.,0.],
+
+ recurrent_to_input_weights: [
+ -0.0063535, -0.2042388, 0.31454784, -0.35746509, 0.28902304, 0.08183324,
+ -0.16555229, 0.02286911, -0.13566875, 0.03034258, 0.48091322,
+ -0.12528998, 0.24077177, -0.51332325, -0.33502164, 0.10629296],
+
+ recurrent_to_cell_weights: [
+ -0.3407414, 0.24443203, -0.2078532, 0.26320225, 0.05695659, -0.00123841,
+ -0.4744786, -0.35869038, -0.06418842, -0.13502428, -0.501764, 0.22830659,
+ -0.46367589, 0.26016325, -0.03894562, -0.16368064],
+
+ recurrent_to_forget_weights: [
+ -0.48684245, -0.06655136, 0.42224967, 0.2112639, 0.27654213, 0.20864892,
+ -0.07646349, 0.45877004, 0.00141793, -0.14609534, 0.36447752, 0.09196436,
+ 0.28053468, 0.01560611, -0.20127171, -0.01140004],
+
+ recurrent_to_output_weights: [
+ 0.43385774, -0.17194885, 0.2718237, 0.09215671, 0.24107647, -0.39835793,
+ 0.18212086, 0.01301402, 0.48572797, -0.50656658, 0.20047462, -0.20607421,
+ -0.51818722, -0.15390486, 0.0468148, 0.39922136],
+
+ cell_to_input_weights: [],
+ cell_to_forget_weights: [],
+ cell_to_output_weights: [],
+
+ projection_weights: [],
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+test_input = [3., 4.]
+output_state = [-0.0297319, 0.122947, 0.208851, -0.153588]
+cell_state = [-0.145439, 0.157475, 0.293663, -0.277353,]
+golden_output = [-0.03716109, 0.12507336, 0.41193449, -0.20860538]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ -0.287121, 0.148115, 0.556837, -0.388276 ],
+ output_state_out: [ -0.0371611, 0.125073, 0.411934, -0.208605 ],
+ output: golden_output
+}
+input0[input] = test_input
+input0[output_state_in] = output_state
+input0[cell_state_in] = cell_state
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/lstm_state2.mod.py b/nn/runtime/test/specs/lstm_state2.mod.py
new file mode 100644
index 000000000..945c631ef
--- /dev/null
+++ b/nn/runtime/test/specs/lstm_state2.mod.py
@@ -0,0 +1,152 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test: No Cifg, No Peephole, No Projection, and No Clipping.
+
+model = Model()
+
+n_batch = 1
+n_input = 2
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 4
+n_output = 4
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{0}")
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{0,0}")
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}")
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
+output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+# Example 1. Input in operand 0,
+input0 = {input_to_input_weights: [-0.45018822, -0.02338299, -0.0870589, -0.34550029, 0.04266912, -0.15680569, -0.34856534, 0.43890524],
+ input_to_forget_weights: [0.09701663, 0.20334584, -0.50592935, -0.31343272, -0.40032279, 0.44781327, 0.01387155, -0.35593212],
+ input_to_cell_weights: [-0.50013041, 0.1370284, 0.11810488, 0.2013163, -0.20583314, 0.44344562, 0.22077113, -0.29909778],
+ input_to_output_weights: [-0.25065863, -0.28290087, 0.04613829, 0.40525138, 0.44272184, 0.03897077, -0.1556896, 0.19487578],
+
+ input_gate_bias: [0.,0.,0.,0.],
+ forget_gate_bias: [1.,1.,1.,1.],
+ cell_gate_bias: [0.,0.,0.,0.],
+ output_gate_bias: [0.,0.,0.,0.],
+
+ recurrent_to_input_weights: [
+ -0.0063535, -0.2042388, 0.31454784, -0.35746509, 0.28902304, 0.08183324,
+ -0.16555229, 0.02286911, -0.13566875, 0.03034258, 0.48091322,
+ -0.12528998, 0.24077177, -0.51332325, -0.33502164, 0.10629296],
+
+ recurrent_to_cell_weights: [
+ -0.3407414, 0.24443203, -0.2078532, 0.26320225, 0.05695659, -0.00123841,
+ -0.4744786, -0.35869038, -0.06418842, -0.13502428, -0.501764, 0.22830659,
+ -0.46367589, 0.26016325, -0.03894562, -0.16368064],
+
+ recurrent_to_forget_weights: [
+ -0.48684245, -0.06655136, 0.42224967, 0.2112639, 0.27654213, 0.20864892,
+ -0.07646349, 0.45877004, 0.00141793, -0.14609534, 0.36447752, 0.09196436,
+ 0.28053468, 0.01560611, -0.20127171, -0.01140004],
+
+ recurrent_to_output_weights: [
+ 0.43385774, -0.17194885, 0.2718237, 0.09215671, 0.24107647, -0.39835793,
+ 0.18212086, 0.01301402, 0.48572797, -0.50656658, 0.20047462, -0.20607421,
+ -0.51818722, -0.15390486, 0.0468148, 0.39922136],
+
+ cell_to_input_weights: [],
+ cell_to_forget_weights: [],
+ cell_to_output_weights: [],
+
+ projection_weights: [],
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+test_input = [1., 1.]
+output_state = [-0.0371611, 0.125073, 0.411934, -0.208605]
+cell_state = [-0.287121, 0.148115, 0.556837, -0.388276]
+golden_output = [-0.15053082, 0.09120187, 0.24278517, -0.12222792]
+output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
+ output_state_out: [ 0 for x in range(n_batch * n_output) ],
+ output: golden_output
+}
+input0[input] = test_input
+input0[output_state_in] = output_state
+input0[cell_state_in] = cell_state
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/mobilenet_quantized.model.py b/nn/runtime/test/specs/mobilenet_quantized.mod.py
index 6612c8dba..6612c8dba 100644
--- a/nn/runtime/test/specs/mobilenet_quantized.model.py
+++ b/nn/runtime/test/specs/mobilenet_quantized.mod.py
diff --git a/nn/runtime/test/specs/rnn_state.mod.py b/nn/runtime/test/specs/rnn_state.mod.py
new file mode 100644
index 000000000..723a6e9e7
--- /dev/null
+++ b/nn/runtime/test/specs/rnn_state.mod.py
@@ -0,0 +1,127 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+batches = 2
+units = 16
+input_size = 8
+
+model = Model()
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (batches, input_size))
+weights = Input("weights", "TENSOR_FLOAT32", "{%d, %d}" % (units, input_size))
+recurrent_weights = Input("recurrent_weights", "TENSOR_FLOAT32", "{%d, %d}" % (units, units))
+bias = Input("bias", "TENSOR_FLOAT32", "{%d}" % (units))
+hidden_state_in = Input("hidden_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (batches, units))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}")
+
+hidden_state_out = IgnoredOutput("hidden_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (batches, units))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (batches, units))
+
+model = model.Operation("RNN", input, weights, recurrent_weights, bias, hidden_state_in,
+ activation_param).To([hidden_state_out, output])
+
+input0 = {
+ weights: [
+ 0.461459, 0.153381, 0.529743, -0.00371218, 0.676267, -0.211346,
+ 0.317493, 0.969689, -0.343251, 0.186423, 0.398151, 0.152399,
+ 0.448504, 0.317662, 0.523556, -0.323514, 0.480877, 0.333113,
+ -0.757714, -0.674487, -0.643585, 0.217766, -0.0251462, 0.79512,
+ -0.595574, -0.422444, 0.371572, -0.452178, -0.556069, -0.482188,
+ -0.685456, -0.727851, 0.841829, 0.551535, -0.232336, 0.729158,
+ -0.00294906, -0.69754, 0.766073, -0.178424, 0.369513, -0.423241,
+ 0.548547, -0.0152023, -0.757482, -0.85491, 0.251331, -0.989183,
+ 0.306261, -0.340716, 0.886103, -0.0726757, -0.723523, -0.784303,
+ 0.0354295, 0.566564, -0.485469, -0.620498, 0.832546, 0.697884,
+ -0.279115, 0.294415, -0.584313, 0.548772, 0.0648819, 0.968726,
+ 0.723834, -0.0080452, -0.350386, -0.272803, 0.115121, -0.412644,
+ -0.824713, -0.992843, -0.592904, -0.417893, 0.863791, -0.423461,
+ -0.147601, -0.770664, -0.479006, 0.654782, 0.587314, -0.639158,
+ 0.816969, -0.337228, 0.659878, 0.73107, 0.754768, -0.337042,
+ 0.0960841, 0.368357, 0.244191, -0.817703, -0.211223, 0.442012,
+ 0.37225, -0.623598, -0.405423, 0.455101, 0.673656, -0.145345,
+ -0.511346, -0.901675, -0.81252, -0.127006, 0.809865, -0.721884,
+ 0.636255, 0.868989, -0.347973, -0.10179, -0.777449, 0.917274,
+ 0.819286, 0.206218, -0.00785118, 0.167141, 0.45872, 0.972934,
+ -0.276798, 0.837861, 0.747958, -0.0151566, -0.330057, -0.469077,
+ 0.277308, 0.415818
+ ],
+ recurrent_weights: [
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0.1
+ ],
+ bias: [
+ 0.065691948, -0.69055247, 0.1107955, -0.97084129, -0.23957068,
+ -0.23566568, -0.389184, 0.47481549, -0.4791103, 0.29931796,
+ 0.10463274, 0.83918178, 0.37197268, 0.61957061, 0.3956964,
+ -0.37609905
+ ],
+ activation_param: [1], # Relu
+}
+
+input0[input] = [
+ -0.69424844, -0.93421471, -0.87287879, 0.37144363,
+ -0.62476718, 0.23791671, 0.40060222, 0.1356622,
+ -0.69424844, -0.93421471, -0.87287879, 0.37144363,
+ -0.62476718, 0.23791671, 0.40060222, 0.1356622,
+]
+input0[hidden_state_in] = [
+ 0.496726, 0, 0.965996, 0,
+ 0.0584256, 0, 0, 0.12315,
+ 0, 0, 0.612267, 0.456601,
+ 0, 0.52286, 1.16099, 0.0291233,
+ 0.496726, 0, 0.965996, 0,
+ 0.0584256, 0, 0, 0.12315,
+ 0, 0, 0.612267, 0.456601,
+ 0, 0.52286, 1.16099, 0.0291233,
+]
+output0 = {
+ hidden_state_out : [
+ 0, 0, 0.524902, 0,
+ 0, 0, 0, 1.02116,
+ 0, 1.35762, 0, 0.356909,
+ 0.436415, 0.0355731, 0, 0,
+ 0, 0, 0.524902, 0,
+ 0, 0, 0, 1.02116,
+ 0, 1.35762, 0, 0.356909,
+ 0.436415, 0.0355731, 0, 0,
+ ]
+}
+output0[output] = [
+ 0, 0, 0.524901, 0, 0, 0,
+ 0, 1.02116, 0, 1.35762, 0, 0.356909,
+ 0.436415, 0.0355727, 0, 0,
+
+ 0, 0, 0.524901, 0, 0, 0,
+ 0, 1.02116, 0, 1.35762, 0, 0.356909,
+ 0.436415, 0.0355727, 0, 0,
+]
+
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/space_to_depth_float_1.mod.py b/nn/runtime/test/specs/space_to_depth_float_1.mod.py
index 5fe1a48a7..d11d8de9c 100644
--- a/nn/runtime/test/specs/space_to_depth_float_1.mod.py
+++ b/nn/runtime/test/specs/space_to_depth_float_1.mod.py
@@ -1,6 +1,6 @@
model = Model()
i1 = Input("input", "TENSOR_FLOAT32", "{1, 2, 2, 2}")
-block = Int32Scalar("radius", 2)
+block = Int32Scalar("block_size", 2)
output = Output("output", "TENSOR_FLOAT32", "{1, 1, 1, 8}")
model = model.Operation("SPACE_TO_DEPTH", i1, block).To(output)
diff --git a/nn/runtime/test/specs/space_to_depth_float_2.mod.py b/nn/runtime/test/specs/space_to_depth_float_2.mod.py
index 586719333..df557f6dc 100644
--- a/nn/runtime/test/specs/space_to_depth_float_2.mod.py
+++ b/nn/runtime/test/specs/space_to_depth_float_2.mod.py
@@ -1,6 +1,6 @@
model = Model()
i1 = Input("input", "TENSOR_FLOAT32", "{1, 4, 4, 1}")
-block = Int32Scalar("radius", 2)
+block = Int32Scalar("block_size", 2)
output = Output("output", "TENSOR_FLOAT32", "{1, 2, 2, 4}")
model = model.Operation("SPACE_TO_DEPTH", i1, block).To(output)
diff --git a/nn/runtime/test/specs/space_to_depth_float_3.mod.py b/nn/runtime/test/specs/space_to_depth_float_3.mod.py
new file mode 100644
index 000000000..e5298dff1
--- /dev/null
+++ b/nn/runtime/test/specs/space_to_depth_float_3.mod.py
@@ -0,0 +1,22 @@
+model = Model()
+i1 = Input("input", "TENSOR_FLOAT32", "{1, 4, 4, 2}")
+block = Int32Scalar("block_size", 2)
+output = Output("output", "TENSOR_FLOAT32", "{1, 2, 2, 8}")
+
+model = model.Operation("SPACE_TO_DEPTH", i1, block).To(output)
+
+# Example 1. Input in operand 0,
+input0 = {i1: # input 0
+ [10, 20, 11, 21, 12, 22, 13, 23,
+ 14, 24, 15, 25, 16, 26, 17, 27,
+ 18, 28, 19, 29, 110, 210, 111, 211,
+ 112, 212, 113, 213, 114, 214, 115, 215]}
+
+output0 = {output: # output 0
+ [10, 20, 11, 21, 14, 24, 15, 25,
+ 12, 22, 13, 23, 16, 26, 17, 27,
+ 18, 28, 19, 29, 112, 212, 113, 213,
+ 110, 210, 111, 211, 114, 214, 115, 215]}
+
+# Instantiate an example
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/svdf_state.mod.py b/nn/runtime/test/specs/svdf_state.mod.py
new file mode 100644
index 000000000..aad2114e7
--- /dev/null
+++ b/nn/runtime/test/specs/svdf_state.mod.py
@@ -0,0 +1,116 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+batches = 2
+units = 4
+input_size = 3
+memory_size = 10
+
+model = Model()
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (batches, input_size))
+weights_feature = Input("weights_feature", "TENSOR_FLOAT32", "{%d, %d}" % (units, input_size))
+weights_time = Input("weights_time", "TENSOR_FLOAT32", "{%d, %d}" % (units, memory_size))
+bias = Input("bias", "TENSOR_FLOAT32", "{%d}" % (units))
+state_in = Input("state_in", "TENSOR_FLOAT32", "{%d, %d}" % (batches, memory_size*units))
+rank_param = Input("rank_param", "TENSOR_INT32", "{1}")
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}")
+state_out = Output("state_out", "TENSOR_FLOAT32", "{%d, %d}" % (batches, memory_size*units))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (batches, units))
+
+model = model.Operation("SVDF", input, weights_feature, weights_time, bias, state_in,
+ rank_param, activation_param).To([state_out, output])
+
+input0 = {
+ weights_feature: [
+ -0.31930989, -0.36118156, 0.0079667, 0.37613347,
+ 0.22197971, 0.12416199, 0.27901134, 0.27557442,
+ 0.3905206, -0.36137494, -0.06634006, -0.10640851
+ ],
+ weights_time: [
+ -0.31930989, 0.37613347, 0.27901134, -0.36137494, -0.36118156,
+ 0.22197971, 0.27557442, -0.06634006, 0.0079667, 0.12416199,
+
+ 0.3905206, -0.10640851, -0.0976817, 0.15294972, 0.39635518,
+ -0.02702999, 0.39296314, 0.15785322, 0.21931258, 0.31053296,
+
+ -0.36916667, 0.38031587, -0.21580373, 0.27072677, 0.23622236,
+ 0.34936687, 0.18174365, 0.35907319, -0.17493086, 0.324846,
+
+ -0.10781813, 0.27201805, 0.14324132, -0.23681851, -0.27115166,
+ -0.01580888, -0.14943552, 0.15465137, 0.09784451, -0.0337657
+ ],
+ bias: [],
+ rank_param: [1],
+ activation_param: [0],
+}
+
+input0[input] = [
+ 0.14278367, -1.64410412, -0.75222826,
+ 0.14278367, -1.64410412, -0.75222826,
+]
+input0[state_in] = [
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0.119996, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, -0.166701, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, -0.44244, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0.0805206,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0.119996, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, -0.166701, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, -0.44244, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0.0805206,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+]
+output0 = {
+ state_out : [
+ 0, 0, 0, 0,
+ 0, 0, 0, 0.119996,
+ 0.542235, 0, 0, 0,
+ 0, 0, 0, 0,
+ -0.166701, -0.40465, 0, 0,
+ 0, 0, 0, 0,
+ 0, -0.44244, -0.706995, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0.0805206, 0.137515,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0.119996,
+ 0.542235, 0, 0, 0,
+ 0, 0, 0, 0,
+ -0.166701, -0.40465, 0, 0,
+ 0, 0, 0, 0,
+ 0, -0.44244, -0.706995, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0.0805206, 0.137515,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ ],
+ output : [
+ 0.068281, -0.162217, -0.152268, 0.00323521,
+ 0.068281, -0.162217, -0.152268, 0.00323521,
+ ]
+}
+
+Example((input0, output0))
diff --git a/nn/tools/test_generator/include/TestHarness.h b/nn/tools/test_generator/include/TestHarness.h
index 256a206e9..3e3abf0ff 100644
--- a/nn/tools/test_generator/include/TestHarness.h
+++ b/nn/tools/test_generator/include/TestHarness.h
@@ -175,7 +175,7 @@ inline void compare(const MixedTyped& golden, const MixedTyped& test) {
compare_<0>(golden, test,
[](float g, float t) { EXPECT_NEAR(g, t, 1.e-5f); });
compare_<1>(golden, test, [](int32_t g, int32_t t) { EXPECT_EQ(g, t); });
- compare_<2>(golden, test, [](uint8_t g, uint8_t t) { EXPECT_EQ(g, t); });
+ compare_<2>(golden, test, [](uint8_t g, uint8_t t) { EXPECT_NEAR(g, t, 1); });
}
}; // namespace generated_tests
diff --git a/nn/tools/test_generator/test_generator.py b/nn/tools/test_generator/test_generator.py
index 0b6f8df63..450bac446 100755
--- a/nn/tools/test_generator/test_generator.py
+++ b/nn/tools/test_generator/test_generator.py
@@ -16,7 +16,7 @@
"""NN model compiler
-Compile models and examples into NDK-based unit tests
+Compile models and examples into VTS and NDK-based CTS unit tests
"""
from __future__ import absolute_import
@@ -105,12 +105,12 @@ class Uses(object):
self.ins = ins.copy()
Uses.all_uses.add(self)
for i in ins:
- i.outs.add(self)
+ i.outs.append(self)
# Object that other objects takes its definition from
class Definitions(object):
def __init__(self, outs = []):
- self.outs = set(outs)
+ self.outs = outs.copy()
for o in outs:
o.ins.append(self)
@@ -265,20 +265,23 @@ class Input(Operand, Definitions, Traversable):
class Output(Operand, Uses, Nontraversable):
# for enumerating outputs
__next_number = 0
- __outputs = set()
+ __outputs = []
def __init__(self, name, vt, shape):
Operand.__init__(self, name, Type(vt, shape))
Uses.__init__(self)
- Output.__outputs.add(self)
+ Output.__outputs.append(self)
self.number = Output.__next_number
Output.__next_number += 1
def lifetime(self):
return "MODEL_OUTPUT"
+ # return all unique outputs in the original order
def get_outputs():
- return Output.__outputs
+ saw = set()
+ unique = [x for x in Output.__outputs if x not in saw and (saw.add(x) or True)]
+ return unique
# An output that we don't want to compare the results
class IgnoredOutput(Output):
@@ -513,10 +516,10 @@ class Model(object):
def Out(self, o):
if (type(o) is list or type(o) is tuple):
for i in o:
- self.__currentOp.outs.add(i)
+ self.__currentOp.outs.append(i)
i.ins.append(self.__currentOp)
else:
- self.__currentOp.outs.add(o)
+ self.__currentOp.outs.append(o)
o.ins.append(self.__currentOp)
return self
@@ -605,7 +608,8 @@ def TopologicalSort(format_op):
while len(start) > 0:
cur = start.pop()
format_op(cur) #cur.Definition()
- for o in cur.outs:
+ distinct_outs = set(cur.outs)
+ for o in distinct_outs:
deps[o].remove(cur)
if len(deps[o]) == 0 and o.traversable():
start.add(o)
diff --git a/nn/tools/test_generator/tests/P_conv/stdout.txt.expect b/nn/tools/test_generator/tests/P_conv/stdout.txt.expect
index e9196f640..47d92b6b8 100644
--- a/nn/tools/test_generator/tests/P_conv/stdout.txt.expect
+++ b/nn/tools/test_generator/tests/P_conv/stdout.txt.expect
@@ -25,7 +25,7 @@ void CreateModel(Model *model) {
model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f};
model->setOperandValue(op0, op0_init, sizeof(float) * 18);
- static float op1_init[] = {0f};
+ static float op1_init[] = {0.0f};
model->setOperandValue(op1, op1_init, sizeof(float) * 1);
model->addOperation(ANEURALNETWORKS_CONV_2D, {op2, op0, op1, b4, b5, b6, b7}, {op3});
// Phase 3, inputs and outputs
diff --git a/nn/tools/test_generator/tests/P_depthwise_conv/stdout.txt.expect b/nn/tools/test_generator/tests/P_depthwise_conv/stdout.txt.expect
index 6f8ea7c90..9a22cc3e3 100644
--- a/nn/tools/test_generator/tests/P_depthwise_conv/stdout.txt.expect
+++ b/nn/tools/test_generator/tests/P_depthwise_conv/stdout.txt.expect
@@ -27,7 +27,7 @@ void CreateModel(Model *model) {
model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
model->setOperandValue(op0, op0_init, sizeof(float) * 3);
- static float op1_init[] = {0f, 0f, 0f};
+ static float op1_init[] = {0.0f, 0.0f, 0.0f};
model->setOperandValue(op1, op1_init, sizeof(float) * 3);
model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
// Phase 3, inputs and outputs
diff --git a/nn/tools/test_generator/tests/P_lstm/lstm.mod.py b/nn/tools/test_generator/tests/P_lstm/lstm.mod.py
new file mode 100644
index 000000000..cb1bf6010
--- /dev/null
+++ b/nn/tools/test_generator/tests/P_lstm/lstm.mod.py
@@ -0,0 +1,161 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# LSTM Test: No Cifg, No Peephole, No Projection, and No Clipping.
+
+model = Model()
+
+n_batch = 1
+n_input = 2
+# n_cell and n_output have the same size when there is no projection.
+n_cell = 4
+n_output = 4
+
+input = Input("input", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_input))
+
+input_to_input_weights = Input("input_to_input_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_forget_weights = Input("input_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_cell_weights = Input("input_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+input_to_output_weights = Input("input_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_input))
+
+recurrent_to_input_weights = Input("recurrent_to_intput_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_forget_weights = Input("recurrent_to_forget_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_cell_weights = Input("recurrent_to_cell_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+recurrent_to_output_weights = Input("recurrent_to_output_weights", "TENSOR_FLOAT32", "{%d, %d}" % (n_cell, n_output))
+
+cell_to_input_weights = Input("cell_to_input_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_forget_weights = Input("cell_to_forget_weights", "TENSOR_FLOAT32", "{0}")
+cell_to_output_weights = Input("cell_to_output_weights", "TENSOR_FLOAT32", "{0}")
+
+input_gate_bias = Input("input_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+forget_gate_bias = Input("forget_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+cell_gate_bias = Input("cell_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+output_gate_bias = Input("output_gate_bias", "TENSOR_FLOAT32", "{%d}"%(n_cell))
+
+projection_weights = Input("projection_weights", "TENSOR_FLOAT32", "{0,0}")
+projection_bias = Input("projection_bias", "TENSOR_FLOAT32", "{0}")
+
+output_state_in = Input("output_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_in = Input("cell_state_in", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+
+activation_param = Input("activation_param", "TENSOR_INT32", "{1}")
+cell_clip_param = Input("cell_clip_param", "TENSOR_FLOAT32", "{1}")
+proj_clip_param = Input("proj_clip_param", "TENSOR_FLOAT32", "{1}")
+
+scratch_buffer = IgnoredOutput("scratch_buffer", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, (n_cell * 4)))
+output_state_out = IgnoredOutput("output_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+cell_state_out = IgnoredOutput("cell_state_out", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_cell))
+output = Output("output", "TENSOR_FLOAT32", "{%d, %d}" % (n_batch, n_output))
+
+model = model.Operation("LSTM",
+ input,
+
+ input_to_input_weights,
+ input_to_forget_weights,
+ input_to_cell_weights,
+ input_to_output_weights,
+
+ recurrent_to_input_weights,
+ recurrent_to_forget_weights,
+ recurrent_to_cell_weights,
+ recurrent_to_output_weights,
+
+ cell_to_input_weights,
+ cell_to_forget_weights,
+ cell_to_output_weights,
+
+ input_gate_bias,
+ forget_gate_bias,
+ cell_gate_bias,
+ output_gate_bias,
+
+ projection_weights,
+ projection_bias,
+
+ output_state_in,
+ cell_state_in,
+
+ activation_param,
+ cell_clip_param,
+ proj_clip_param
+).To([scratch_buffer, output_state_out, cell_state_out, output])
+
+# Example 1. Input in operand 0,
+input0 = {input_to_input_weights: [-0.45018822, -0.02338299, -0.0870589, -0.34550029, 0.04266912, -0.15680569, -0.34856534, 0.43890524],
+ input_to_forget_weights: [0.09701663, 0.20334584, -0.50592935, -0.31343272, -0.40032279, 0.44781327, 0.01387155, -0.35593212],
+ input_to_cell_weights: [-0.50013041, 0.1370284, 0.11810488, 0.2013163, -0.20583314, 0.44344562, 0.22077113, -0.29909778],
+ input_to_output_weights: [-0.25065863, -0.28290087, 0.04613829, 0.40525138, 0.44272184, 0.03897077, -0.1556896, 0.19487578],
+
+ input_gate_bias: [0.,0.,0.,0.],
+ forget_gate_bias: [1.,1.,1.,1.],
+ cell_gate_bias: [0.,0.,0.,0.],
+ output_gate_bias: [0.,0.,0.,0.],
+
+ recurrent_to_input_weights: [
+ -0.0063535, -0.2042388, 0.31454784, -0.35746509, 0.28902304, 0.08183324,
+ -0.16555229, 0.02286911, -0.13566875, 0.03034258, 0.48091322,
+ -0.12528998, 0.24077177, -0.51332325, -0.33502164, 0.10629296],
+
+ recurrent_to_cell_weights: [
+ -0.3407414, 0.24443203, -0.2078532, 0.26320225, 0.05695659, -0.00123841,
+ -0.4744786, -0.35869038, -0.06418842, -0.13502428, -0.501764, 0.22830659,
+ -0.46367589, 0.26016325, -0.03894562, -0.16368064],
+
+ recurrent_to_forget_weights: [
+ -0.48684245, -0.06655136, 0.42224967, 0.2112639, 0.27654213, 0.20864892,
+ -0.07646349, 0.45877004, 0.00141793, -0.14609534, 0.36447752, 0.09196436,
+ 0.28053468, 0.01560611, -0.20127171, -0.01140004],
+
+ recurrent_to_output_weights: [
+ 0.43385774, -0.17194885, 0.2718237, 0.09215671, 0.24107647, -0.39835793,
+ 0.18212086, 0.01301402, 0.48572797, -0.50656658, 0.20047462, -0.20607421,
+ -0.51818722, -0.15390486, 0.0468148, 0.39922136],
+
+ cell_to_input_weights: [],
+ cell_to_forget_weights: [],
+ cell_to_output_weights: [],
+
+ projection_weights: [],
+ projection_bias: [],
+
+ activation_param: [4], # Tanh
+ cell_clip_param: [0.],
+ proj_clip_param: [0.],
+}
+
+# Instantiate examples
+# TODO: Add more examples after fixing the reference issue
+test_inputs = [
+ [2., 3.],
+# [3., 4.],[1., 1.]
+]
+golden_outputs = [
+ [-0.02973187, 0.1229473, 0.20885126, -0.15358765,],
+# [-0.03716109, 0.12507336, 0.41193449, -0.20860538],
+# [-0.15053082, 0.09120187, 0.24278517, -0.12222792]
+]
+
+for (input_tensor, output_tensor) in zip(test_inputs, golden_outputs):
+ output0 = {
+ scratch_buffer: [ 0 for x in range(n_batch * n_cell * 4) ],
+ cell_state_out: [ 0 for x in range(n_batch * n_cell) ],
+ output_state_out: [ 0 for x in range(n_batch * n_output) ],
+ output: output_tensor
+ }
+ input0[input] = input_tensor
+ input0[output_state_in] = [ 0 for _ in range(n_batch * n_output) ]
+ input0[cell_state_in] = [ 0 for _ in range(n_batch * n_cell) ]
+ Example((input0, output0))
diff --git a/nn/tools/test_generator/tests/P_lstm/stderr.txt.expect b/nn/tools/test_generator/tests/P_lstm/stderr.txt.expect
new file mode 100644
index 000000000..c5a6e36b9
--- /dev/null
+++ b/nn/tools/test_generator/tests/P_lstm/stderr.txt.expect
@@ -0,0 +1,2 @@
+Output CTS model: -
+Output example:-
diff --git a/nn/tools/test_generator/tests/P_lstm/stdout.txt.expect b/nn/tools/test_generator/tests/P_lstm/stdout.txt.expect
new file mode 100644
index 000000000..2ba320d77
--- /dev/null
+++ b/nn/tools/test_generator/tests/P_lstm/stdout.txt.expect
@@ -0,0 +1,75 @@
+// Generated file (from: lstm.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type5(Type::TENSOR_FLOAT32, {0,0});
+ OperandType type3(Type::TENSOR_FLOAT32, {0});
+ OperandType type9(Type::TENSOR_FLOAT32, {1, 16});
+ OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
+ OperandType type6(Type::TENSOR_FLOAT32, {1, 4});
+ OperandType type8(Type::TENSOR_FLOAT32, {1});
+ OperandType type1(Type::TENSOR_FLOAT32, {4, 2});
+ OperandType type2(Type::TENSOR_FLOAT32, {4, 4});
+ OperandType type4(Type::TENSOR_FLOAT32, {4});
+ OperandType type7(Type::TENSOR_INT32, {1});
+ // Phase 1, operands
+ auto input = model->addOperand(&type0);
+ auto input_to_input_weights = model->addOperand(&type1);
+ auto input_to_forget_weights = model->addOperand(&type1);
+ auto input_to_cell_weights = model->addOperand(&type1);
+ auto input_to_output_weights = model->addOperand(&type1);
+ auto recurrent_to_intput_weights = model->addOperand(&type2);
+ auto recurrent_to_forget_weights = model->addOperand(&type2);
+ auto recurrent_to_cell_weights = model->addOperand(&type2);
+ auto recurrent_to_output_weights = model->addOperand(&type2);
+ auto cell_to_input_weights = model->addOperand(&type3);
+ auto cell_to_forget_weights = model->addOperand(&type3);
+ auto cell_to_output_weights = model->addOperand(&type3);
+ auto input_gate_bias = model->addOperand(&type4);
+ auto forget_gate_bias = model->addOperand(&type4);
+ auto cell_gate_bias = model->addOperand(&type4);
+ auto output_gate_bias = model->addOperand(&type4);
+ auto projection_weights = model->addOperand(&type5);
+ auto projection_bias = model->addOperand(&type3);
+ auto output_state_in = model->addOperand(&type6);
+ auto cell_state_in = model->addOperand(&type6);
+ auto activation_param = model->addOperand(&type7);
+ auto cell_clip_param = model->addOperand(&type8);
+ auto proj_clip_param = model->addOperand(&type8);
+ auto scratch_buffer = model->addOperand(&type9);
+ auto output_state_out = model->addOperand(&type6);
+ auto cell_state_out = model->addOperand(&type6);
+ auto output = model->addOperand(&type6);
+ // Phase 2, operations
+ model->addOperation(ANEURALNETWORKS_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param}, {scratch_buffer, output_state_out, cell_state_out, output});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param},
+ {scratch_buffer, output_state_out, cell_state_out, output});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {1, 2, 0};
+ return ignore.find(i) != ignore.end();
+}
+// Generated file (from: lstm.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {2.0f, 3.0f}}, {1, {-0.45018822f, -0.02338299f, -0.0870589f, -0.34550029f, 0.04266912f, -0.15680569f, -0.34856534f, 0.43890524f}}, {2, {0.09701663f, 0.20334584f, -0.50592935f, -0.31343272f, -0.40032279f, 0.44781327f, 0.01387155f, -0.35593212f}}, {3, {-0.50013041f, 0.1370284f, 0.11810488f, 0.2013163f, -0.20583314f, 0.44344562f, 0.22077113f, -0.29909778f}}, {4, {-0.25065863f, -0.28290087f, 0.04613829f, 0.40525138f, 0.44272184f, 0.03897077f, -0.1556896f, 0.19487578f}}, {5, {-0.0063535f, -0.2042388f, 0.31454784f, -0.35746509f, 0.28902304f, 0.08183324f, -0.16555229f, 0.02286911f, -0.13566875f, 0.03034258f, 0.48091322f, -0.12528998f, 0.24077177f, -0.51332325f, -0.33502164f, 0.10629296f}}, {6, {-0.48684245f, -0.06655136f, 0.42224967f, 0.2112639f, 0.27654213f, 0.20864892f, -0.07646349f, 0.45877004f, 0.00141793f, -0.14609534f, 0.36447752f, 0.09196436f, 0.28053468f, 0.01560611f, -0.20127171f, -0.01140004f}}, {7, {-0.3407414f, 0.24443203f, -0.2078532f, 0.26320225f, 0.05695659f, -0.00123841f, -0.4744786f, -0.35869038f, -0.06418842f, -0.13502428f, -0.501764f, 0.22830659f, -0.46367589f, 0.26016325f, -0.03894562f, -0.16368064f}}, {8, {0.43385774f, -0.17194885f, 0.2718237f, 0.09215671f, 0.24107647f, -0.39835793f, 0.18212086f, 0.01301402f, 0.48572797f, -0.50656658f, 0.20047462f, -0.20607421f, -0.51818722f, -0.15390486f, 0.0468148f, 0.39922136f}}, {9, {}}, {10, {}}, {11, {}}, {12, {0.0f, 0.0f, 0.0f, 0.0f}}, {13, {1.0f, 1.0f, 1.0f, 1.0f}}, {14, {0.0f, 0.0f, 0.0f, 0.0f}}, {15, {0.0f, 0.0f, 0.0f, 0.0f}}, {16, {}}, {17, {}}, {18, {0, 0, 0, 0}}, {19, {0, 0, 0, 0}}, {21, {0.0f}}, {22, {0.0f}}},
+ // int -> INT32 map
+ {{20, {4}}},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{1, {0, 0, 0, 0}}, {2, {0, 0, 0, 0}}, {3, {-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f}}, {0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/tools/test_generator/tests/P_weird/stderr.txt.expect b/nn/tools/test_generator/tests/P_weird/stderr.txt.expect
new file mode 100644
index 000000000..c5a6e36b9
--- /dev/null
+++ b/nn/tools/test_generator/tests/P_weird/stderr.txt.expect
@@ -0,0 +1,2 @@
+Output CTS model: -
+Output example:-
diff --git a/nn/tools/test_generator/tests/P_weird/stdout.txt.expect b/nn/tools/test_generator/tests/P_weird/stdout.txt.expect
new file mode 100644
index 000000000..fa67d68ac
--- /dev/null
+++ b/nn/tools/test_generator/tests/P_weird/stdout.txt.expect
@@ -0,0 +1,51 @@
+// Generated file (from: weird_add.mod.py). Do not edit
+void CreateModel(Model *model) {
+ OperandType type1(Type::INT32, {});
+ OperandType type0(Type::TENSOR_FLOAT32, {2});
+ // Phase 1, operands
+ auto op1 = model->addOperand(&type0);
+ auto op2 = model->addOperand(&type0);
+ auto b0 = model->addOperand(&type1);
+ auto tmp = model->addOperand(&type0);
+ auto tmp2 = model->addOperand(&type0);
+ auto op3 = model->addOperand(&type0);
+ auto op4 = model->addOperand(&type0);
+ // Phase 2, operations
+ static int32_t b0_init[] = {0};
+ model->setOperandValue(b0, b0_init, sizeof(int32_t) * 1);
+ model->addOperation(ANEURALNETWORKS_ADD, {op1, op2, b0}, {tmp});
+ model->addOperation(ANEURALNETWORKS_ADD, {tmp, op2, b0}, {tmp2});
+ model->addOperation(ANEURALNETWORKS_ADD, {tmp2, op4, b0}, {op3});
+ // Phase 3, inputs and outputs
+ model->identifyInputsAndOutputs(
+ {op1, op2, op4},
+ {op3});
+ assert(model->isValid());
+}
+
+bool is_ignored(int i) {
+ static std::set<int> ignore = {};
+ return ignore.find(i) != ignore.end();
+}
+// Generated file (from: weird_add.mod.py). Do not edit
+// Begin of an example
+{
+//Input(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {1.0f, 2.0f}}, {1, {3.0f, 4.0f}}, {2, {5.0f, 6.0f}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+},
+//Output(s)
+{ // See tools/test_generator/include/TestHarness.h:MixedTyped
+ // int -> FLOAT32 map
+ {{0, {9.0f, 12.0f}}},
+ // int -> INT32 map
+ {},
+ // int -> QUANT8_ASYMM map
+ {}
+}
+}, // End of an example
diff --git a/nn/tools/test_generator/tests/P_weird/weird_add.mod.py b/nn/tools/test_generator/tests/P_weird/weird_add.mod.py
new file mode 100644
index 000000000..a230267a4
--- /dev/null
+++ b/nn/tools/test_generator/tests/P_weird/weird_add.mod.py
@@ -0,0 +1,29 @@
+# model
+model = Model()
+i1 = Input("op1", "TENSOR_FLOAT32", "{2}") # a vector of 2 float32s
+i2 = Input("op2", "TENSOR_FLOAT32", "{2}") # another vector of 2 float32s
+b0 = Int32Scalar("b0", 0) # an int32_t scalar bias
+tmp = Internal("tmp", "TENSOR_FLOAT32", "{2}")
+tmp2 = Internal("tmp2", "TENSOR_FLOAT32", "{2}")
+o3 = Output("op3", "TENSOR_FLOAT32", "{2}")
+i4 = Input("op4", "TENSOR_FLOAT32", "{2}") # another vector of 2 float32s
+model = model.Operation("ADD", i1, i2, b0).To(tmp)
+model = model.Operation("ADD", tmp, i2, b0).To(tmp2)
+model = model.Operation("ADD", tmp2, i4, b0).To(o3)
+
+# Example 1. Input in operand 0,
+input0 = {i1: # input 0
+ [1.0, 2.0],
+ i2: # input 1
+ [3.0, 4.0],
+ i4: # input 4
+ [5.0, 6.0]}
+
+output0 = {o3: # output 0
+ [9.0, 12.0]}
+
+# Instantiate an example
+Example((input0, output0))
+
+
+