From 8b287c23f5141102555ba869a34397ec720a3e4f Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Fri, 7 Sep 2018 09:25:10 +0100 Subject: IVGCVSW-1806 More Android NN Driver refactoring * Changed #if defined to #ifdef * Simplified the Android ML namespace resolution * Fixed the relative path in some include directives Change-Id: I46e46faff98559c8042c1a4b8b82007f462df57d --- test/GenericLayerTests.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'test/GenericLayerTests.cpp') diff --git a/test/GenericLayerTests.cpp b/test/GenericLayerTests.cpp index c66854f4..63198b4c 100644 --- a/test/GenericLayerTests.cpp +++ b/test/GenericLayerTests.cpp @@ -25,7 +25,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) supported = _supported; }; - neuralnetworks::V1_0::Model model0 = {}; + V1_0::Model model0 = {}; // Add operands int32_t actValue = 0; @@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model0.operations.resize(1); // Make a correct fully connected operation - model0.operations[0].type = neuralnetworks::V1_0::OperationType::FULLY_CONNECTED; + model0.operations[0].type = V1_0::OperationType::FULLY_CONNECTED; model0.operations[0].inputs = hidl_vec{0, 1, 2, 3}; model0.operations[0].outputs = hidl_vec{4}; @@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) BOOST_TEST(supported.size() == (size_t)1); BOOST_TEST(supported[0] == true); - neuralnetworks::V1_0::Model model1 = {}; + V1_0::Model model1 = {}; AddInputOperand (model1, hidl_vec{1, 3}); AddTensorOperand(model1, hidl_vec{1, 3}, weightValue); @@ -61,14 +61,14 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model1.operations.resize(2); // Make a correct fully connected operation - model1.operations[0].type = neuralnetworks::V1_0::OperationType::FULLY_CONNECTED; + model1.operations[0].type = V1_0::OperationType::FULLY_CONNECTED; model1.operations[0].inputs = hidl_vec{0, 1, 2, 3}; model1.operations[0].outputs = hidl_vec{4}; // Add an incorrect fully connected operation AddIntOperand (model1, actValue); AddOutputOperand(model1, hidl_vec{1, 1}); - model1.operations[1].type = neuralnetworks::V1_0::OperationType::FULLY_CONNECTED; + model1.operations[1].type = V1_0::OperationType::FULLY_CONNECTED; model1.operations[1].inputs = hidl_vec{4}; // Only 1 input operand, expected 4 model1.operations[1].outputs = hidl_vec{5}; @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) #endif // Test Broadcast on add/mul operators - neuralnetworks::V1_0::Model model2 = {}; + V1_0::Model model2 = {}; AddInputOperand (model2, hidl_vec{1, 1, 3, 4}); AddInputOperand (model2, hidl_vec{4}); @@ -99,11 +99,11 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model2.operations.resize(2); - model2.operations[0].type = neuralnetworks::V1_0::OperationType::ADD; + model2.operations[0].type = V1_0::OperationType::ADD; model2.operations[0].inputs = hidl_vec{0, 1, 2}; model2.operations[0].outputs = hidl_vec{3}; - model2.operations[1].type = neuralnetworks::V1_0::OperationType::MUL; + model2.operations[1].type = V1_0::OperationType::MUL; model2.operations[1].inputs = hidl_vec{0, 1, 2}; model2.operations[1].outputs = hidl_vec{4}; @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) BOOST_TEST(supported[0] == true); BOOST_TEST(supported[1] == true); - neuralnetworks::V1_0::Model model3 = {}; + V1_0::Model model3 = {}; AddInputOperand (model3, hidl_vec{1, 1, 1, 8}); AddIntOperand (model3, 2); @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) model3.operations.resize(1); // Add unsupported operation, should return no error but we don't support it - model3.operations[0].type = neuralnetworks::V1_0::OperationType::DEPTH_TO_SPACE; + model3.operations[0].type = V1_0::OperationType::DEPTH_TO_SPACE; model3.operations[0].inputs = hidl_vec{0, 1}; model3.operations[0].outputs = hidl_vec{2}; @@ -131,14 +131,14 @@ BOOST_AUTO_TEST_CASE(GetSupportedOperations) BOOST_TEST(supported.size() == (size_t)1); BOOST_TEST(supported[0] == false); - neuralnetworks::V1_0::Model model4 = {}; + V1_0::Model model4 = {}; AddIntOperand(model4, 0); model4.operations.resize(1); // Add invalid operation - model4.operations[0].type = static_cast(100); + model4.operations[0].type = static_cast(100); model4.operations[0].outputs = hidl_vec{0}; driver->getSupportedOperations(model4, cb); @@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(UnsupportedLayerContinueOnFailure) supported = _supported; }; - neuralnetworks::V1_0::Model model = {}; + V1_0::Model model = {}; // Operands int32_t actValue = 0; @@ -170,11 +170,11 @@ BOOST_AUTO_TEST_CASE(UnsupportedLayerContinueOnFailure) float biasValue[] = {4}; // HASHTABLE_LOOKUP is unsupported at the time of writing this test, but any unsupported layer will do - AddInputOperand (model, hidl_vec{1, 1, 3, 4}, neuralnetworks::V1_0::OperandType::TENSOR_INT32); - AddInputOperand (model, hidl_vec{4}, neuralnetworks::V1_0::OperandType::TENSOR_INT32); + AddInputOperand (model, hidl_vec{1, 1, 3, 4}, V1_0::OperandType::TENSOR_INT32); + AddInputOperand (model, hidl_vec{4}, V1_0::OperandType::TENSOR_INT32); AddInputOperand (model, hidl_vec{1, 1, 3, 4}); AddOutputOperand(model, hidl_vec{1, 1, 3, 4}); - AddOutputOperand(model, hidl_vec{1, 1, 3, 4}, neuralnetworks::V1_0::OperandType::TENSOR_QUANT8_ASYMM); + AddOutputOperand(model, hidl_vec{1, 1, 3, 4}, V1_0::OperandType::TENSOR_QUANT8_ASYMM); // Fully connected is supported AddInputOperand (model, hidl_vec{1, 3}); @@ -189,17 +189,17 @@ BOOST_AUTO_TEST_CASE(UnsupportedLayerContinueOnFailure) model.operations.resize(3); // Unsupported - model.operations[0].type = neuralnetworks::V1_0::OperationType::HASHTABLE_LOOKUP; + model.operations[0].type = V1_0::OperationType::HASHTABLE_LOOKUP; model.operations[0].inputs = hidl_vec{0, 1, 2}; model.operations[0].outputs = hidl_vec{3, 4}; // Supported - model.operations[1].type = neuralnetworks::V1_0::OperationType::FULLY_CONNECTED; + model.operations[1].type = V1_0::OperationType::FULLY_CONNECTED; model.operations[1].inputs = hidl_vec{5, 6, 7, 8}; model.operations[1].outputs = hidl_vec{9}; // Unsupported - model.operations[2].type = neuralnetworks::V1_0::OperationType::EMBEDDING_LOOKUP; + model.operations[2].type = V1_0::OperationType::EMBEDDING_LOOKUP; model.operations[2].inputs = hidl_vec{1, 2}; model.operations[2].outputs = hidl_vec{10}; @@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(ModelToINetworkConverterMemPoolFail) supported = _supported; }; - neuralnetworks::V1_0::Model model = {}; + V1_0::Model model = {}; model.pools = hidl_vec{hidl_memory("Unsuported hidl memory type", nullptr, 0)}; -- cgit v1.2.1