Improve validation of the HAL structures.
Add a lot of validation of the structures passed in the HAL.
Particularly important are those that operands & arguments
don't try to reach out of their memory blocks.
Also grabs a few missing generated tests.
Bug: 67828197
Test: System tests & VTS tests.
Change-Id: I2edf6219fc660fab7c5b6a73e7a9cb8a358fb29b
diff --git a/nn/runtime/test/generated/models/depth_to_space_quant8_2.model.cpp b/nn/runtime/test/generated/models/depth_to_space_quant8_2.model.cpp
index f855432..dcabb12 100644
--- a/nn/runtime/test/generated/models/depth_to_space_quant8_2.model.cpp
+++ b/nn/runtime/test/generated/models/depth_to_space_quant8_2.model.cpp
@@ -1,8 +1,8 @@
// Generated file (from: depth_to_space_quant8_2.mod.py). Do not edit
void CreateModel(Model *model) {
OperandType type1(Type::INT32, {});
- OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4});
- OperandType type2(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1});
+ OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 0);
+ OperandType type2(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 0.5f, 0);
// Phase 1, operands
auto input = model->addOperand(&type0);
auto radius = model->addOperand(&type1);
diff --git a/nn/runtime/test/generated/models/space_to_depth_quant8_2.model.cpp b/nn/runtime/test/generated/models/space_to_depth_quant8_2.model.cpp
index 7bd289d..4e91914 100644
--- a/nn/runtime/test/generated/models/space_to_depth_quant8_2.model.cpp
+++ b/nn/runtime/test/generated/models/space_to_depth_quant8_2.model.cpp
@@ -1,8 +1,8 @@
// Generated file (from: space_to_depth_quant8_2.mod.py). Do not edit
void CreateModel(Model *model) {
OperandType type1(Type::INT32, {});
- OperandType type2(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4});
- OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1});
+ OperandType type2(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 4}, 0.5f, 0);
+ OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 0.5f, 0);
// Phase 1, operands
auto input = model->addOperand(&type0);
auto radius = model->addOperand(&type1);
diff --git a/nn/runtime/test/generated/vts_models/depth_to_space_quant8_2.model.cpp b/nn/runtime/test/generated/vts_models/depth_to_space_quant8_2.model.cpp
index 3af6f3d..404c79b 100644
--- a/nn/runtime/test/generated/vts_models/depth_to_space_quant8_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/depth_to_space_quant8_2.model.cpp
@@ -6,7 +6,7 @@
.type = OperandType::TENSOR_QUANT8_ASYMM,
.dimensions = {1, 2, 2, 4},
.numberOfConsumers = 1,
- .scale = 0.0f,
+ .scale = 0.5f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::MODEL_INPUT,
.location = {.poolIndex = 0, .offset = 0, .length = 0},
@@ -24,7 +24,7 @@
.type = OperandType::TENSOR_QUANT8_ASYMM,
.dimensions = {1, 4, 4, 1},
.numberOfConsumers = 0,
- .scale = 0.0f,
+ .scale = 0.5f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::MODEL_OUTPUT,
.location = {.poolIndex = 0, .offset = 0, .length = 0},
diff --git a/nn/runtime/test/generated/vts_models/space_to_depth_quant8_2.model.cpp b/nn/runtime/test/generated/vts_models/space_to_depth_quant8_2.model.cpp
index 6205750..1d7dc58 100644
--- a/nn/runtime/test/generated/vts_models/space_to_depth_quant8_2.model.cpp
+++ b/nn/runtime/test/generated/vts_models/space_to_depth_quant8_2.model.cpp
@@ -6,7 +6,7 @@
.type = OperandType::TENSOR_QUANT8_ASYMM,
.dimensions = {1, 4, 4, 1},
.numberOfConsumers = 1,
- .scale = 0.0f,
+ .scale = 0.5f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::MODEL_INPUT,
.location = {.poolIndex = 0, .offset = 0, .length = 0},
@@ -24,7 +24,7 @@
.type = OperandType::TENSOR_QUANT8_ASYMM,
.dimensions = {1, 2, 2, 4},
.numberOfConsumers = 0,
- .scale = 0.0f,
+ .scale = 0.5f,
.zeroPoint = 0,
.lifetime = OperandLifeTime::MODEL_OUTPUT,
.location = {.poolIndex = 0, .offset = 0, .length = 0},