summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestValidateOperations.cpp
diff options
context:
space:
mode:
authorLev Proleev <levp@google.com>2020-01-20 11:17:10 +0000
committerLev Proleev <levp@google.com>2020-01-22 14:55:39 +0000
commitd58b0c40e0efb8da3c76cd43d09dfb2d710ab209 (patch)
tree1e5be3ac3367f112fb20ed63911606323516c2d1 /nn/runtime/test/TestValidateOperations.cpp
parent12be69fc719f44491e630deced3325847467520a (diff)
downloadml-d58b0c40e0efb8da3c76cd43d09dfb2d710ab209.tar.gz
Add FILL and RANK ops
Fix: 148050168 Fix: 148049333 Test: NNTest_static and VtsHalNeuralnetworksV1_3TargetTest Change-Id: I5438cdd7c0cc52e49067529edcee537278c8f7ad
Diffstat (limited to 'nn/runtime/test/TestValidateOperations.cpp')
-rw-r--r--nn/runtime/test/TestValidateOperations.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/nn/runtime/test/TestValidateOperations.cpp b/nn/runtime/test/TestValidateOperations.cpp
index 72f5f39b7..304935f79 100644
--- a/nn/runtime/test/TestValidateOperations.cpp
+++ b/nn/runtime/test/TestValidateOperations.cpp
@@ -155,6 +155,10 @@ class OperationTestBase {
if (mOpCode == ANEURALNETWORKS_LSH_PROJECTION && i == 1) {
continue;
}
+ // RANK can have input of any type.
+ if (mOpCode == ANEURALNETWORKS_RANK) {
+ continue;
+ }
OperandTypeWithExtraParams newType = mValidInputs[i];
int32_t originalOperandCode = mValidInputs[i].operandType.type;
std::set<int32_t> operandTypesToSkip;
@@ -3717,4 +3721,54 @@ TEST(OperationValidationTest, QUANTIZED_LSTM) {
test.testOpsValidations();
}
+void fillTest(int32_t valueOperandType, int32_t outputOperandType) {
+ uint32_t inputDimensions[1] = {3};
+ ANeuralNetworksOperandType input0 = getOpType(ANEURALNETWORKS_TENSOR_INT32, 1, inputDimensions);
+ ANeuralNetworksOperandType input1 = getOpType(valueOperandType);
+ uint32_t outputDimensions[3] = {3, 4, 5};
+ ANeuralNetworksOperandType output = getOpType(outputOperandType, 3, outputDimensions);
+ OperationTestBase test(ANEURALNETWORKS_FILL, {input0, input1}, {output});
+ test.testOpsValidations();
+}
+
+TEST(OperationValidationTest, FILL_float16) {
+ fillTest(ANEURALNETWORKS_FLOAT16, ANEURALNETWORKS_TENSOR_FLOAT16);
+}
+
+TEST(OperationValidationTest, FILL_float32) {
+ fillTest(ANEURALNETWORKS_FLOAT32, ANEURALNETWORKS_TENSOR_FLOAT32);
+}
+
+TEST(OperationValidationTest, FILL_int32) {
+ fillTest(ANEURALNETWORKS_INT32, ANEURALNETWORKS_TENSOR_INT32);
+}
+
+void rankTest(int32_t inputOperandType) {
+ uint32_t inputDimensions[3] = {3, 4, 5};
+ ANeuralNetworksOperandType input = getOpType(inputOperandType, 3, inputDimensions);
+ ANeuralNetworksOperandType output = getOpType(ANEURALNETWORKS_INT32);
+ OperationTestBase test(ANEURALNETWORKS_RANK, {input}, {output});
+ test.testOpsValidations();
+}
+
+TEST(OperationValidationTest, RANK_float16) {
+ rankTest(ANEURALNETWORKS_TENSOR_FLOAT16);
+}
+
+TEST(OperationValidationTest, RANK_float32) {
+ rankTest(ANEURALNETWORKS_TENSOR_FLOAT32);
+}
+
+TEST(OperationValidationTest, RANK_int32) {
+ rankTest(ANEURALNETWORKS_TENSOR_INT32);
+}
+
+TEST(OperationValidationTest, RANK_quant8) {
+ rankTest(ANEURALNETWORKS_TENSOR_QUANT8_ASYMM);
+}
+
+TEST(OperationValidationTest, RANK_quant8_signed) {
+ rankTest(ANEURALNETWORKS_TENSOR_QUANT8_ASYMM_SIGNED);
+}
+
} // end namespace