Add new OperandType FLOAT16.
Bug: 120225191
Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksV1_2TargetTest
Change-Id: Iaabebe490303c9c93a34d319c8c594df13fb7899
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index 45476ee..4ab0c24 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -40,7 +40,7 @@
* scale is a 32 bit floating point with value greater then zero.
*/
TENSOR_QUANT16_SYMM = 7,
- /** A tensor of 16 bit floating point values. */
+ /** A tensor of IEEE 754 16 bit floating point values. */
TENSOR_FLOAT16 = 8,
/**
* A tensor of 8 bit boolean values.
@@ -49,6 +49,8 @@
* represents false; any other value represents true.
*/
TENSOR_BOOL8 = 9,
+ /** An IEEE 754 16 bit floating point scalar value. */
+ FLOAT16 = 10,
/* ADDING A NEW FUNDAMENTAL TYPE REQUIRES UPDATING THE VALUE OF
* OperandTypeRange::OPERAND_FUNDAMENTAL_MAX.
*/
@@ -62,7 +64,7 @@
*/
enum OperandTypeRange : uint32_t {
OPERAND_FUNDAMENTAL_MIN = 0,
- OPERAND_FUNDAMENTAL_MAX = 9,
+ OPERAND_FUNDAMENTAL_MAX = 10,
OPERAND_OEM_MIN = 10000,
OPERAND_OEM_MAX = 10001,
};
diff --git a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
index 294415b..3fadd48 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateModel.cpp
@@ -152,6 +152,7 @@
static uint32_t getInvalidRank(OperandType type) {
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -183,6 +184,7 @@
static float getInvalidScale(OperandType type) {
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -215,6 +217,7 @@
static std::vector<int32_t> getInvalidZeroPoints(OperandType type) {
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32:
@@ -258,6 +261,7 @@
Operand newOperand = *operand;
newOperand.type = type;
switch (type) {
+ case OperandType::FLOAT16:
case OperandType::FLOAT32:
case OperandType::INT32:
case OperandType::UINT32: