Fixes VTS test failures.

Moves comments for type range values into their enums to make it harder
to forget to update them.

Adds missing float16 types for ARGMAX/ARGMIN/CAST.

Test: VtsHalNeuralnetworksV1_2TargetTest --hal_service_instance=android.hardware.neuralnetworks@1.2::IDevice/sample-all
Test: [  PASSED  ] 2519 tests.

Change-Id: Ic7c3df8c8fbff45fe497f304b6b2c7a09e7dc5a6
This commit is contained in:
Michael K. Sanders
2018-11-28 10:35:08 +00:00
parent 61984d221b
commit bbdab2feee
2 changed files with 19 additions and 10 deletions

View File

@@ -49,12 +49,16 @@ enum OperandType : @1.0::OperandType {
* represents false; any other value represents true.
*/
TENSOR_BOOL8 = 9,
/* ADDING A NEW FUNDAMENTAL TYPE REQUIRES UPDATING THE VALUE OF
* OperandTypeRange::OPERAND_FUNDAMENTAL_MAX.
*/
/* ADDING A NEW OEM TYPE REQUIRES UPDATING THE VALUE OF
* OperandTypeRange::OPERAND_OEM_MAX.
*/
};
/**
* The range of values in the OperandType enum.
*
* THE MAX VALUES MUST BE UPDATED WHEN ADDING NEW TYPES to the OperandType enum.
* The range of operand values in the OperandType enum.
*/
enum OperandTypeRange : uint32_t {
OPERAND_FUNDAMENTAL_MIN = 0,
@@ -122,16 +126,20 @@ enum OperationType : @1.1::OperationType {
ROTATED_BBOX_TRANSFORM = 87,
ABS = 88,
ROI_POOLING = 89,
/* ADDING A NEW FUNDAMENTAL OPERATION REQUIRES UPDATING THE VALUE OF
* OperationTypeRange::OPERATION_FUNDAMENTAL_MAX.
*/
/* ADDING A NEW OEM OPERATION REQUIRES UPDATING THE VALUE OF
* OperationTypeRange::OPERATION_OEM_MAX.
*/
};
/**
* The range of values in the OperationType enum.
*
* THE MAX VALUES MUST BE UPDATED WHEN ADDING NEW TYPES to the OperationType enum.
*/
enum OperationTypeRange : uint32_t {
OPERATION_FUNDAMENTAL_MIN = 0,
OPERATION_FUNDAMENTAL_MAX = 87,
OPERATION_FUNDAMENTAL_MAX = 89,
OPERATION_OEM_MIN = 10000,
OPERATION_OEM_MAX = 10000,
};

View File

@@ -301,8 +301,9 @@ static bool mutateOperationOperandTypeSkip(size_t operand, OperandType type, con
for (const Operation& operation : model.operations) {
// Skip mutateOperationOperandTypeTest for the following operations.
// - LSH_PROJECTION's second argument is allowed to have any type.
// - ARGMIN and ARGMAX's first argument can be any of TENSOR_(FLOAT32|INT32|QUANT8_ASYMM).
// - CAST's argument can be any of TENSOR_(FLOAT32|INT32|QUANT8_ASYMM).
// - ARGMIN and ARGMAX's first argument can be any of
// TENSOR_(FLOAT16|FLOAT32|INT32|QUANT8_ASYMM).
// - CAST's argument can be any of TENSOR_(FLOAT16|FLOAT32|INT32|QUANT8_ASYMM).
switch (operation.type) {
case OperationType::LSH_PROJECTION: {
if (operand == operation.inputs[1]) {
@@ -312,8 +313,8 @@ static bool mutateOperationOperandTypeSkip(size_t operand, OperandType type, con
case OperationType::CAST:
case OperationType::ARGMAX:
case OperationType::ARGMIN: {
if (type == OperandType::TENSOR_FLOAT32 || type == OperandType::TENSOR_INT32 ||
type == OperandType::TENSOR_QUANT8_ASYMM) {
if (type == OperandType::TENSOR_FLOAT16 || type == OperandType::TENSOR_FLOAT32 ||
type == OperandType::TENSOR_INT32 || type == OperandType::TENSOR_QUANT8_ASYMM) {
return true;
}
} break;