summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-06-04 01:02:51 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-06-04 01:02:51 +0000
commit8df8e8aa5d78fc7aa95c3a93c26b8c069d2ca019 (patch)
tree02341f58ada78cddcff535c7c609f78bc81d57b7
parent29dc1f2cba359e1af8ffef405b44416769550246 (diff)
parent54688b80e26325de12e1dd5112a31343f94d68ae (diff)
downloadml-8df8e8aa5d78fc7aa95c3a93c26b8c069d2ca019.tar.gz
Snap for 6557338 from 54688b80e26325de12e1dd5112a31343f94d68ae to rvc-release
Change-Id: I0285a6d5b4a40655c54c1a0d709b5def5afbf8c8
-rw-r--r--nn/runtime/test/generated/spec_V1_1/lsh_projection_2_relaxed.example.cpp111
-rw-r--r--nn/runtime/test/generated/spec_V1_1/lsh_projection_relaxed.example.cpp44
-rw-r--r--nn/runtime/test/generated/spec_V1_2/lsh_projection_3_relaxed.example.cpp111
-rw-r--r--nn/runtime/test/generated/spec_V1_2/lsh_projection_4_relaxed.example.cpp111
-rw-r--r--nn/runtime/test/generated/spec_V1_2/lsh_projection_deprecated.example.cpp111
-rw-r--r--nn/runtime/test/generated/spec_V1_2/lsh_projection_float16.example.cpp410
-rw-r--r--nn/runtime/test/specs/V1_1/lsh_projection_2_relaxed.mod.py5
-rw-r--r--nn/runtime/test/specs/V1_1/lsh_projection_relaxed.mod.py6
-rw-r--r--nn/runtime/test/specs/V1_2/lsh_projection_3_relaxed.mod.py5
-rw-r--r--nn/runtime/test/specs/V1_2/lsh_projection_4_relaxed.mod.py5
-rw-r--r--nn/runtime/test/specs/V1_2/lsh_projection_deprecated.mod.py5
-rw-r--r--nn/runtime/test/specs/V1_2/lsh_projection_float16.mod.py2
-rw-r--r--nn/tools/test_generator/README.md8
-rwxr-xr-xnn/tools/test_generator/test_generator.py10
14 files changed, 38 insertions, 906 deletions
diff --git a/nn/runtime/test/generated/spec_V1_1/lsh_projection_2_relaxed.example.cpp b/nn/runtime/test/generated/spec_V1_1/lsh_projection_2_relaxed.example.cpp
index 6fcbb81ec..23dbd2795 100644
--- a/nn/runtime/test/generated/spec_V1_1/lsh_projection_2_relaxed.example.cpp
+++ b/nn/runtime/test/generated/spec_V1_1/lsh_projection_2_relaxed.example.cpp
@@ -158,114 +158,3 @@ const auto dummy_test_model_all_tensors_as_inputs = TestModelManager::get().add(
} // namespace generated_tests::lsh_projection_2_relaxed
-namespace generated_tests::lsh_projection_2_relaxed {
-
-const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = true,
- .main = {
- .inputIndexes = {1, 2, 5},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 2, 2, 0}),
- .dimensions = {4},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // hash_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // dummy
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {5, 6, 7},
- .outputs = {0},
- .type = TestOperationType::ADD
- }, {
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::UNKNOWN,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_all_tensors_as_inputs_all_inputs_as_internal = TestModelManager::get().add("lsh_projection_2_relaxed_all_tensors_as_inputs_all_inputs_as_internal", get_test_model_all_tensors_as_inputs_all_inputs_as_internal());
-
-} // namespace generated_tests::lsh_projection_2_relaxed
-
diff --git a/nn/runtime/test/generated/spec_V1_1/lsh_projection_relaxed.example.cpp b/nn/runtime/test/generated/spec_V1_1/lsh_projection_relaxed.example.cpp
index 68782659b..aa7ccfb24 100644
--- a/nn/runtime/test/generated/spec_V1_1/lsh_projection_relaxed.example.cpp
+++ b/nn/runtime/test/generated/spec_V1_1/lsh_projection_relaxed.example.cpp
@@ -277,13 +277,13 @@ const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
.expectedMultinomialDistributionTolerance = 0,
.isRelaxed = true,
.main = {
- .inputIndexes = {1, 5, 8},
+ .inputIndexes = {0, 1, 5},
.operands = {{ // hash
.channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
+ .data = TestBuffer::createFromVector<float>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
.dimensions = {4, 2},
.isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
+ .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
.scale = 0.0f,
.type = TestOperandType::TENSOR_FLOAT32,
@@ -328,36 +328,6 @@ const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
.scale = 0.0f,
.type = TestOperandType::TENSOR_INT32,
.zeroPoint = 0
- }, { // hash_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // dummy1
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // param1
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
}, { // weight_new
.channelQuant = {},
.data = TestBuffer::createFromVector<float>({0.12f, 0.34f, 0.56f}),
@@ -368,7 +338,7 @@ const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
.scale = 0.0f,
.type = TestOperandType::TENSOR_FLOAT32,
.zeroPoint = 0
- }, { // dummy2
+ }, { // dummy1
.channelQuant = {},
.data = TestBuffer::createFromVector<float>({0.0f}),
.dimensions = {1},
@@ -378,7 +348,7 @@ const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
.scale = 0.0f,
.type = TestOperandType::TENSOR_FLOAT32,
.zeroPoint = 0
- }, { // param2
+ }, { // param1
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
.dimensions = {},
@@ -391,10 +361,6 @@ const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
}},
.operations = {{
.inputs = {5, 6, 7},
- .outputs = {0},
- .type = TestOperationType::ADD
- }, {
- .inputs = {8, 9, 10},
.outputs = {2},
.type = TestOperationType::ADD
}, {
diff --git a/nn/runtime/test/generated/spec_V1_2/lsh_projection_3_relaxed.example.cpp b/nn/runtime/test/generated/spec_V1_2/lsh_projection_3_relaxed.example.cpp
index 0b964f97c..f44967963 100644
--- a/nn/runtime/test/generated/spec_V1_2/lsh_projection_3_relaxed.example.cpp
+++ b/nn/runtime/test/generated/spec_V1_2/lsh_projection_3_relaxed.example.cpp
@@ -158,114 +158,3 @@ const auto dummy_test_model_all_tensors_as_inputs = TestModelManager::get().add(
} // namespace generated_tests::lsh_projection_3_relaxed
-namespace generated_tests::lsh_projection_3_relaxed {
-
-const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = true,
- .main = {
- .inputIndexes = {1, 2, 5},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({3}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 6, 10, 12}),
- .dimensions = {4},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // hash_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // dummy
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {5, 6, 7},
- .outputs = {0},
- .type = TestOperationType::ADD
- }, {
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::UNKNOWN,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_all_tensors_as_inputs_all_inputs_as_internal = TestModelManager::get().add("lsh_projection_3_relaxed_all_tensors_as_inputs_all_inputs_as_internal", get_test_model_all_tensors_as_inputs_all_inputs_as_internal());
-
-} // namespace generated_tests::lsh_projection_3_relaxed
-
diff --git a/nn/runtime/test/generated/spec_V1_2/lsh_projection_4_relaxed.example.cpp b/nn/runtime/test/generated/spec_V1_2/lsh_projection_4_relaxed.example.cpp
index 2329565ae..09e165d52 100644
--- a/nn/runtime/test/generated/spec_V1_2/lsh_projection_4_relaxed.example.cpp
+++ b/nn/runtime/test/generated/spec_V1_2/lsh_projection_4_relaxed.example.cpp
@@ -158,114 +158,3 @@ const auto dummy_test_model_all_tensors_as_inputs = TestModelManager::get().add(
} // namespace generated_tests::lsh_projection_4_relaxed
-namespace generated_tests::lsh_projection_4_relaxed {
-
-const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = true,
- .main = {
- .inputIndexes = {1, 2, 5},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 2, 2, 0}),
- .dimensions = {4},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // hash_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // dummy
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {5, 6, 7},
- .outputs = {0},
- .type = TestOperationType::ADD
- }, {
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::UNKNOWN,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_all_tensors_as_inputs_all_inputs_as_internal = TestModelManager::get().add("lsh_projection_4_relaxed_all_tensors_as_inputs_all_inputs_as_internal", get_test_model_all_tensors_as_inputs_all_inputs_as_internal());
-
-} // namespace generated_tests::lsh_projection_4_relaxed
-
diff --git a/nn/runtime/test/generated/spec_V1_2/lsh_projection_deprecated.example.cpp b/nn/runtime/test/generated/spec_V1_2/lsh_projection_deprecated.example.cpp
index e225e5500..e87591ee9 100644
--- a/nn/runtime/test/generated/spec_V1_2/lsh_projection_deprecated.example.cpp
+++ b/nn/runtime/test/generated/spec_V1_2/lsh_projection_deprecated.example.cpp
@@ -158,114 +158,3 @@ const auto dummy_test_model_all_tensors_as_inputs = TestModelManager::get().add(
} // namespace generated_tests::lsh_projection_deprecated
-namespace generated_tests::lsh_projection_deprecated {
-
-const TestModel& get_test_model_all_tensors_as_inputs_all_inputs_as_internal() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = true,
- .main = {
- .inputIndexes = {1, 2, 5},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 2, 2, 0}),
- .dimensions = {4},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // hash_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // dummy
- .channelQuant = {},
- .data = TestBuffer::createFromVector<float>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT32,
- .zeroPoint = 0
- }, { // param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {5, 6, 7},
- .outputs = {0},
- .type = TestOperationType::ADD
- }, {
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::UNKNOWN,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_all_tensors_as_inputs_all_inputs_as_internal = TestModelManager::get().add("lsh_projection_deprecated_all_tensors_as_inputs_all_inputs_as_internal", get_test_model_all_tensors_as_inputs_all_inputs_as_internal());
-
-} // namespace generated_tests::lsh_projection_deprecated
-
diff --git a/nn/runtime/test/generated/spec_V1_2/lsh_projection_float16.example.cpp b/nn/runtime/test/generated/spec_V1_2/lsh_projection_float16.example.cpp
index c69b0c1e3..4a57101db 100644
--- a/nn/runtime/test/generated/spec_V1_2/lsh_projection_float16.example.cpp
+++ b/nn/runtime/test/generated/spec_V1_2/lsh_projection_float16.example.cpp
@@ -414,413 +414,3 @@ const auto dummy_test_model_all_tensors_as_inputs_all_inputs_as_internal = TestM
} // namespace generated_tests::lsh_projection_float16
-namespace generated_tests::lsh_projection_float16 {
-
-const TestModel& get_test_model_float16() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = false,
- .main = {
- .inputIndexes = {1, 2},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.12f, 0.34f, 0.56f}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({2}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 1, 1, 1, 1, 0, 0, 0}),
- .dimensions = {8},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::V1_2,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_float16 = TestModelManager::get().add("lsh_projection_float16_float16", get_test_model_float16());
-
-} // namespace generated_tests::lsh_projection_float16
-
-namespace generated_tests::lsh_projection_float16 {
-
-const TestModel& get_test_model_float16_all_inputs_as_internal() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = false,
- .main = {
- .inputIndexes = {1, 5},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({2}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 1, 1, 1, 1, 0, 0, 0}),
- .dimensions = {8},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.12f, 0.34f, 0.56f}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // dummy3
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // param3
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {5, 6, 7},
- .outputs = {2},
- .type = TestOperationType::ADD
- }, {
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::V1_2,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_float16_all_inputs_as_internal = TestModelManager::get().add("lsh_projection_float16_float16_all_inputs_as_internal", get_test_model_float16_all_inputs_as_internal());
-
-} // namespace generated_tests::lsh_projection_float16
-
-namespace generated_tests::lsh_projection_float16 {
-
-const TestModel& get_test_model_float16_all_tensors_as_inputs() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = false,
- .main = {
- .inputIndexes = {0, 1, 2},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.12f, 0.34f, 0.56f}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({2}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 1, 1, 1, 1, 0, 0, 0}),
- .dimensions = {8},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::V1_2,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_float16_all_tensors_as_inputs = TestModelManager::get().add("lsh_projection_float16_float16_all_tensors_as_inputs", get_test_model_float16_all_tensors_as_inputs());
-
-} // namespace generated_tests::lsh_projection_float16
-
-namespace generated_tests::lsh_projection_float16 {
-
-const TestModel& get_test_model_float16_all_tensors_as_inputs_all_inputs_as_internal() {
- static TestModel model = {
- .expectFailure = false,
- .expectedMultinomialDistributionTolerance = 0,
- .isRelaxed = false,
- .main = {
- .inputIndexes = {1, 5, 8},
- .operands = {{ // hash
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // lookup
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({12345, 54321, 67890, 9876, -12345678, -87654321}),
- .dimensions = {3, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // weight
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // type_param
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({2}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // output
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({1, 1, 1, 1, 1, 0, 0, 0}),
- .dimensions = {8},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_OUTPUT,
- .numberOfConsumers = 0,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_INT32,
- .zeroPoint = 0
- }, { // hash_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}),
- .dimensions = {4, 2},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // dummy4
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // param4
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }, { // weight_new
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.12f, 0.34f, 0.56f}),
- .dimensions = {3},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // dummy5
- .channelQuant = {},
- .data = TestBuffer::createFromVector<_Float16>({0.0f}),
- .dimensions = {1},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::TENSOR_FLOAT16,
- .zeroPoint = 0
- }, { // param5
- .channelQuant = {},
- .data = TestBuffer::createFromVector<int32_t>({0}),
- .dimensions = {},
- .isIgnored = false,
- .lifetime = TestOperandLifeTime::CONSTANT_COPY,
- .numberOfConsumers = 1,
- .scale = 0.0f,
- .type = TestOperandType::INT32,
- .zeroPoint = 0
- }},
- .operations = {{
- .inputs = {5, 6, 7},
- .outputs = {0},
- .type = TestOperationType::ADD
- }, {
- .inputs = {8, 9, 10},
- .outputs = {2},
- .type = TestOperationType::ADD
- }, {
- .inputs = {0, 1, 2, 3},
- .outputs = {4},
- .type = TestOperationType::LSH_PROJECTION
- }},
- .outputIndexes = {4}
- },
- .minSupportedVersion = TestHalVersion::V1_2,
- .referenced = {}
- };
- return model;
-}
-
-const auto dummy_test_model_float16_all_tensors_as_inputs_all_inputs_as_internal = TestModelManager::get().add("lsh_projection_float16_float16_all_tensors_as_inputs_all_inputs_as_internal", get_test_model_float16_all_tensors_as_inputs_all_inputs_as_internal());
-
-} // namespace generated_tests::lsh_projection_float16
-
diff --git a/nn/runtime/test/specs/V1_1/lsh_projection_2_relaxed.mod.py b/nn/runtime/test/specs/V1_1/lsh_projection_2_relaxed.mod.py
index 6608b0666..1904f0490 100644
--- a/nn/runtime/test/specs/V1_1/lsh_projection_2_relaxed.mod.py
+++ b/nn/runtime/test/specs/V1_1/lsh_projection_2_relaxed.mod.py
@@ -20,8 +20,9 @@ num_bits = 2
model = Model()
-hhash = Parameter("hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
- [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765])
+hhash = Parameter(
+ "hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
+ [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765]).ShouldNeverBeInternal()
lookup = Input("lookup", "TENSOR_INT32", "{%d, %d}" % (num_input, num_bits))
weight = Input("weight", "TENSOR_FLOAT32", "{%d}" % (num_input))
type_param = Int32Scalar("type_param", 1) # SPARSE
diff --git a/nn/runtime/test/specs/V1_1/lsh_projection_relaxed.mod.py b/nn/runtime/test/specs/V1_1/lsh_projection_relaxed.mod.py
index 9a1bfaca2..c8ac42bdc 100644
--- a/nn/runtime/test/specs/V1_1/lsh_projection_relaxed.mod.py
+++ b/nn/runtime/test/specs/V1_1/lsh_projection_relaxed.mod.py
@@ -20,8 +20,9 @@ num_bits = 2
model = Model()
-hhash = Parameter("hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
- [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765])
+hhash = Parameter(
+ "hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
+ [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765]).ShouldNeverBeInternal()
lookup = Input("lookup", "TENSOR_INT32", "{%d, %d}" % (num_input, num_bits))
weight = Input("weight", "TENSOR_FLOAT32", "{%d}" % (num_input))
type_param = Int32Scalar("type_param", 2) # DENSE
@@ -38,4 +39,3 @@ input0 = {
output0 = {output: [1, 1, 1, 0, 1, 1, 1, 0]}
Example((input0, output0))
-
diff --git a/nn/runtime/test/specs/V1_2/lsh_projection_3_relaxed.mod.py b/nn/runtime/test/specs/V1_2/lsh_projection_3_relaxed.mod.py
index de7cec111..443fe6956 100644
--- a/nn/runtime/test/specs/V1_2/lsh_projection_3_relaxed.mod.py
+++ b/nn/runtime/test/specs/V1_2/lsh_projection_3_relaxed.mod.py
@@ -20,8 +20,9 @@ num_bits = 2
model = Model()
-hhash = Parameter("hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
- [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765])
+hhash = Parameter(
+ "hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
+ [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765]).ShouldNeverBeInternal()
lookup = Input("lookup", "TENSOR_INT32", "{%d, %d}" % (num_input, num_bits))
weight = Input("weight", "TENSOR_FLOAT32", "{%d}" % (num_input))
type_param = Int32Scalar("type_param", 3) # SPARSE
diff --git a/nn/runtime/test/specs/V1_2/lsh_projection_4_relaxed.mod.py b/nn/runtime/test/specs/V1_2/lsh_projection_4_relaxed.mod.py
index 2b3b33a1e..a8af8940d 100644
--- a/nn/runtime/test/specs/V1_2/lsh_projection_4_relaxed.mod.py
+++ b/nn/runtime/test/specs/V1_2/lsh_projection_4_relaxed.mod.py
@@ -20,8 +20,9 @@ num_bits = 2
model = Model()
-hhash = Parameter("hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
- [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765])
+hhash = Parameter(
+ "hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
+ [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765]).ShouldNeverBeInternal()
lookup = Input("lookup", "TENSOR_INT32", "{%d, %d}" % (num_input, num_bits))
weight = Input("weight", "TENSOR_FLOAT32", "{%d}" % (num_input))
type_param = Int32Scalar("type_param", 1) # SPARSE DEPRECATED
diff --git a/nn/runtime/test/specs/V1_2/lsh_projection_deprecated.mod.py b/nn/runtime/test/specs/V1_2/lsh_projection_deprecated.mod.py
index 2b3b33a1e..a8af8940d 100644
--- a/nn/runtime/test/specs/V1_2/lsh_projection_deprecated.mod.py
+++ b/nn/runtime/test/specs/V1_2/lsh_projection_deprecated.mod.py
@@ -20,8 +20,9 @@ num_bits = 2
model = Model()
-hhash = Parameter("hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
- [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765])
+hhash = Parameter(
+ "hash", "TENSOR_FLOAT32", "{%d, %d}" % (num_hash, num_bits),
+ [0.123, 0.456, -0.321, -0.654, 1.234, 5.678, -4.321, -8.765]).ShouldNeverBeInternal()
lookup = Input("lookup", "TENSOR_INT32", "{%d, %d}" % (num_input, num_bits))
weight = Input("weight", "TENSOR_FLOAT32", "{%d}" % (num_input))
type_param = Int32Scalar("type_param", 1) # SPARSE DEPRECATED
diff --git a/nn/runtime/test/specs/V1_2/lsh_projection_float16.mod.py b/nn/runtime/test/specs/V1_2/lsh_projection_float16.mod.py
index ed19b17f7..4b22ad190 100644
--- a/nn/runtime/test/specs/V1_2/lsh_projection_float16.mod.py
+++ b/nn/runtime/test/specs/V1_2/lsh_projection_float16.mod.py
@@ -36,4 +36,4 @@ input0 = {
}
output0 = {output: [1, 1, 1, 1, 1, 0, 0, 0]}
-Example((input0, output0)).AddVariations("float16");
+Example((input0, output0))
diff --git a/nn/tools/test_generator/README.md b/nn/tools/test_generator/README.md
index 29c1155d2..e781771ce 100644
--- a/nn/tools/test_generator/README.md
+++ b/nn/tools/test_generator/README.md
@@ -244,6 +244,14 @@ example.DisableLifeTimeVariation()
example.DisableDynamicOutputShapeVariation()
```
+You may also specify a certain operand to be input/const-only that `AllInputsAsInternalCoverter` will skip converting this operand.
+
+```Python
+# "hash" will be converted to a model input when applying AllTensorsAsInputsConverter,
+# but will be skipped when further applying AllInputsAsInternalCoverter.
+hash = Parameter("hash", "TENSOR_FLOAT32", "{1, 1}", [0.123]).ShouldNeverBeInternal()
+```
+
#### Some helper functions
The test generator provides several helper functions or shorthands to add commonly used group of variations.
diff --git a/nn/tools/test_generator/test_generator.py b/nn/tools/test_generator/test_generator.py
index e1b10a7ad..92dfad756 100755
--- a/nn/tools/test_generator/test_generator.py
+++ b/nn/tools/test_generator/test_generator.py
@@ -295,6 +295,7 @@ class Operand(NamedVariable):
self.model_index = None
self.ins = []
self.outs = []
+ self.mayBeInternal = True
def SetValue(self, value):
self.value = value if type(value) is list or type(value) is tuple or value is None \
@@ -330,8 +331,15 @@ class Operand(NamedVariable):
extraParams=self.type.extraParams)
if not issubclass(DerivedClass, Internal):
newop.SetValue(self.value)
+ if not self.mayBeInternal:
+ assert not issubclass(DerivedClass, Internal)
+ newop.ShouldNeverBeInternal()
return newop
+ def ShouldNeverBeInternal(self):
+ self.mayBeInternal = False
+ return self
+
# Base class of user-defined input/output operand
class InOut(Operand):
@@ -1031,7 +1039,7 @@ class AllInputsAsInternalCoverter(ModelVariation):
raise SkipVariation
# Find all input tensors that can be an output of the ADD operation.
- modelInputs = [i for i in model.GetInputs() if CompatibleWithADD(i)]
+ modelInputs = [i for i in model.GetInputs() if CompatibleWithADD(i) and i.mayBeInternal]
if not modelInputs:
raise SkipVariation