From 9150bff63a690caa743c471943afe509ebed1044 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 26 May 2021 15:40:53 +0100 Subject: IVGCVSW-4618 'Transition Units Test Suites' * Used doctest in android-nn-driver unit tests. Signed-off-by: Sadik Armagan Change-Id: I9b5d4dfd77d53c7ebee7f8c43628a1d6ff74d1a3 --- test/Concat.cpp | 680 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 459 insertions(+), 221 deletions(-) (limited to 'test/Concat.cpp') diff --git a/test/Concat.cpp b/test/Concat.cpp index 54ee8a23..d39375af 100644 --- a/test/Concat.cpp +++ b/test/Concat.cpp @@ -7,15 +7,11 @@ #include "../1.0/HalPolicy.hpp" -#include -#include +#include #include #include - -BOOST_AUTO_TEST_SUITE(ConcatTests) - using namespace android::hardware; using namespace driverTestHelpers; using namespace armnn_driver; @@ -26,12 +22,6 @@ using RequestArgument = V1_0::RequestArgument; namespace { -#ifndef ARMCOMPUTECL_ENABLED - static const std::array COMPUTE_DEVICES = {{ armnn::Compute::CpuRef }}; -#else - static const std::array COMPUTE_DEVICES = {{ armnn::Compute::CpuRef, armnn::Compute::GpuAcc }}; -#endif - void ConcatTestImpl(const std::vector & inputs, int32_t concatAxis, @@ -61,19 +51,19 @@ ConcatTestImpl(const std::vector & inputs, model.operations[0].outputs = hidl_vec{static_cast(inputs.size()+1)}; // make the prepared model - V1_0::ErrorStatus prepareStatus=V1_0::ErrorStatus::NONE; + V1_0::ErrorStatus prepareStatus = V1_0::ErrorStatus::NONE; android::sp preparedModel = PrepareModelWithStatus(model, *driver, prepareStatus, expectedPrepareStatus); - BOOST_TEST(prepareStatus == expectedPrepareStatus); + CHECK((int)prepareStatus == (int)expectedPrepareStatus); if (prepareStatus != V1_0::ErrorStatus::NONE) { // prepare failed, we cannot continue return; } - BOOST_TEST(preparedModel.get() != nullptr); + CHECK(preparedModel.get() != nullptr); if (preparedModel.get() == nullptr) { // don't spoil other tests if prepare failed @@ -132,7 +122,7 @@ ConcatTestImpl(const std::vector & inputs, // run the execution ARMNN_ASSERT(preparedModel.get() != nullptr); auto execStatus = Execute(preparedModel, request, expectedExecStatus); - BOOST_TEST(execStatus == expectedExecStatus); + CHECK((int)execStatus == (int)expectedExecStatus); if (execStatus == V1_0::ErrorStatus::NONE) { @@ -140,359 +130,607 @@ ConcatTestImpl(const std::vector & inputs, const float * expectedOutput = expectedOutputTensor.GetData(); for (unsigned int i=0; i - - -BOOST_DATA_TEST_CASE(SimpleConcatAxis0, COMPUTE_DEVICES) +/// Test cases... +void SimpleConcatAxis0(armnn::Compute computeDevice) { int32_t axis = 0; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{3,1,1,1},{0,1,2}}; - - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + TestTensor expected{armnn::TensorShape{3, 1, 1, 1}, {0, 1, 2}}; + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(ConcatAxis0_NoInterleave, COMPUTE_DEVICES) +void ConcatAxis0NoInterleave(armnn::Compute computeDevice) { int32_t axis = 0; - TestTensor aIn{armnn::TensorShape{2,1,2,1},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{3,1,2,1},{4, 5, - 6, 7, - 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,2,1},{10, 11}}; - - TestTensor expected{armnn::TensorShape{6,1,2,1},{0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11}}; - - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + TestTensor aIn{armnn::TensorShape{2, 1, 2, 1}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{3, 1, 2, 1}, {4, 5, + 6, 7, + 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 2, 1}, {10, 11}}; + + TestTensor expected{armnn::TensorShape{6, 1, 2, 1}, {0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11}}; + + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxis1, COMPUTE_DEVICES) +void SimpleConcatAxis1(armnn::Compute computeDevice) { int32_t axis = 1; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{1,3,1,1},{0,1,2}}; + TestTensor expected{armnn::TensorShape{1, 3, 1, 1}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(ConcatAxis1_NoInterleave, COMPUTE_DEVICES) +void ConcatAxis1NoInterleave(armnn::Compute computeDevice) { int32_t axis = 1; - TestTensor aIn{armnn::TensorShape{1,2,2,1},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,3,2,1},{4, 5, - 6, 7, - 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,2,1},{10, 11}}; - - TestTensor expected{armnn::TensorShape{1,6,2,1},{0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11}}; - - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + TestTensor aIn{armnn::TensorShape{1, 2, 2, 1}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 3, 2, 1}, {4, 5, + 6, 7, + 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 2, 1}, {10, 11}}; + + TestTensor expected{armnn::TensorShape{1, 6, 2, 1}, {0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11}}; + + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxis1_DoInterleave, COMPUTE_DEVICES) +void SimpleConcatAxis1DoInterleave(armnn::Compute computeDevice) { int32_t axis = 1; - TestTensor aIn{armnn::TensorShape{2,2,1,1},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{2,3,1,1},{4, 5, 6, - 7, 8, 9}}; - TestTensor cIn{armnn::TensorShape{2,1,1,1},{10, - 11}}; - - TestTensor expected{armnn::TensorShape{2,6,1,1},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor aIn{armnn::TensorShape{2, 2, 1, 1}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{2, 3, 1, 1}, {4, 5, 6, + 7, 8, 9}}; + TestTensor cIn{armnn::TensorShape{2, 1, 1, 1}, {10, + 11}}; + + TestTensor expected{armnn::TensorShape{2, 6, 1, 1}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxis2, COMPUTE_DEVICES) +void SimpleConcatAxis2(armnn::Compute computeDevice) { int32_t axis = 2; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{1,1,3,1},{0,1,2}}; + TestTensor expected{armnn::TensorShape{1, 1, 3, 1}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(ConcatAxis2_NoInterleave, COMPUTE_DEVICES) +void ConcatAxis2NoInterleave(armnn::Compute computeDevice) { int32_t axis = 2; - TestTensor aIn{armnn::TensorShape{1,1,2,2},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,1,3,2},{4, 5, - 6, 7, - 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,1,2},{10, 11}}; - - TestTensor expected{armnn::TensorShape{1,1,6,2},{0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11}}; - - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + TestTensor aIn{armnn::TensorShape{1, 1, 2, 2}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 1, 3, 2}, {4, 5, + 6, 7, + 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1, 2}, {10, 11}}; + + TestTensor expected{armnn::TensorShape{1, 1, 6, 2}, {0, 1, + 2, 3, + 4, 5, + 6, 7, + 8, 9, + 10, 11}}; + + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxis2_DoInterleave, COMPUTE_DEVICES) +void SimpleConcatAxis2DoInterleave(armnn::Compute computeDevice) { int32_t axis = 2; - TestTensor aIn{armnn::TensorShape{1,2,2,1},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,2,3,1},{4, 5, 6, - 7, 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,2,1,1},{10, - 11}}; - - TestTensor expected{armnn::TensorShape{1,2,6,1},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor aIn{armnn::TensorShape{1, 2, 2, 1}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 2, 3, 1}, {4, 5, 6, + 7, 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 2, 1, 1}, {10, + 11}}; + + TestTensor expected{armnn::TensorShape{1, 2, 6, 1}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxis3, COMPUTE_DEVICES) +void SimpleConcatAxis3(armnn::Compute computeDevice) { int32_t axis = 3; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{1,1,1,3},{0,1,2}}; + TestTensor expected{armnn::TensorShape{1, 1, 1, 3}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxis3_DoInterleave, COMPUTE_DEVICES) +void SimpleConcatAxis3DoInterleave(armnn::Compute computeDevice) { int32_t axis = 3; - TestTensor aIn{armnn::TensorShape{1,1,2,2},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,1,2,3},{4, 5, 6, - 7, 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,2,1},{10, - 11}}; - - TestTensor expected{armnn::TensorShape{1,1,2,6},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor aIn{armnn::TensorShape{1, 1, 2, 2}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 1, 2, 3}, {4, 5, 6, + 7, 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 2, 1}, {10, + 11}}; + + TestTensor expected{armnn::TensorShape{1, 1, 2, 6}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(AxisTooBig, COMPUTE_DEVICES) +void AxisTooBig(armnn::Compute computeDevice) { int32_t axis = 4; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1,1},{0}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; // The axis must be within the range of [-rank(values), rank(values)) // see: https://www.tensorflow.org/api_docs/python/tf/concat - TestTensor uncheckedOutput{armnn::TensorShape{1,1,1,1},{0}}; + TestTensor uncheckedOutput{armnn::TensorShape{1, 1, 1, 1}, {0}}; V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn, &bIn}, axis, uncheckedOutput, sample, expectedParserStatus); + ConcatTestImpl({&aIn, &bIn}, axis, uncheckedOutput, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(AxisTooSmall, COMPUTE_DEVICES) +void AxisTooSmall(armnn::Compute computeDevice) { int32_t axis = -5; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1,1},{0}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; // The axis must be within the range of [-rank(values), rank(values)) // see: https://www.tensorflow.org/api_docs/python/tf/concat - TestTensor uncheckedOutput{armnn::TensorShape{1,1,1,1},{0}}; + TestTensor uncheckedOutput{armnn::TensorShape{1, 1, 1, 1}, {0}}; V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn, &bIn}, axis, uncheckedOutput, sample, expectedParserStatus); + ConcatTestImpl({&aIn, &bIn}, axis, uncheckedOutput, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(TooFewInputs, COMPUTE_DEVICES) +void TooFewInputs(armnn::Compute computeDevice) { int32_t axis = 0; - TestTensor aIn{armnn::TensorShape{1,1,1,1},{0}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1, 1}, {0}}; // We need at least two tensors to concatenate V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn}, axis, aIn, sample, expectedParserStatus); + ConcatTestImpl({&aIn}, axis, aIn, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(MismatchedInputDimensions, COMPUTE_DEVICES) +void MismatchedInputDimensions(armnn::Compute computeDevice) { int32_t axis = 3; - TestTensor aIn{armnn::TensorShape{1,1,2,2},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,1,2,3},{4, 5, 6, - 7, 8, 9}}; - TestTensor mismatched{armnn::TensorShape{1,1,1,1},{10}}; + TestTensor aIn{armnn::TensorShape{1, 1, 2, 2}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 1, 2, 3}, {4, 5, 6, + 7, 8, 9}}; + TestTensor mismatched{armnn::TensorShape{1, 1, 1, 1}, {10}}; - TestTensor expected{armnn::TensorShape{1,1,2,6},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor expected{armnn::TensorShape{1, 1, 2, 6}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; // The input dimensions must be compatible V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn, &bIn, &mismatched}, axis, expected, sample, expectedParserStatus); + ConcatTestImpl({&aIn, &bIn, &mismatched}, axis, expected, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(MismatchedInputRanks, COMPUTE_DEVICES) +void MismatchedInputRanks(armnn::Compute computeDevice) { int32_t axis = 2; - TestTensor aIn{armnn::TensorShape{1,1,2},{0,1}}; - TestTensor bIn{armnn::TensorShape{1,1},{4}}; - TestTensor expected{armnn::TensorShape{1,1,3},{0,1,4}}; + TestTensor aIn{armnn::TensorShape{1, 1, 2}, {0, 1}}; + TestTensor bIn{armnn::TensorShape{1, 1}, {4}}; + TestTensor expected{armnn::TensorShape{1, 1, 3}, {0, 1, 4}}; // The input dimensions must be compatible V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn, &bIn}, axis, expected, sample, expectedParserStatus); + ConcatTestImpl({&aIn, &bIn}, axis, expected, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(MismatchedOutputDimensions, COMPUTE_DEVICES) +void MismatchedOutputDimensions(armnn::Compute computeDevice) { int32_t axis = 3; - TestTensor aIn{armnn::TensorShape{1,1,2,2},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,1,2,3},{4, 5, 6, - 7, 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,2,1},{10, - 11}}; + TestTensor aIn{armnn::TensorShape{1, 1, 2, 2}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 1, 2, 3}, {4, 5, 6, + 7, 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 2, 1}, {10, + 11}}; - TestTensor mismatched{armnn::TensorShape{1,1,6,2},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor mismatched{armnn::TensorShape{1, 1, 6, 2}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; // The input and output dimensions must be compatible V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, mismatched, sample, expectedParserStatus); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, mismatched, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(MismatchedOutputRank, COMPUTE_DEVICES) +void MismatchedOutputRank(armnn::Compute computeDevice) { int32_t axis = 3; - TestTensor aIn{armnn::TensorShape{1,1,2,2},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,1,2,3},{4, 5, 6, - 7, 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,2,1},{10, - 11}}; - - TestTensor mismatched{armnn::TensorShape{6,2},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor aIn{armnn::TensorShape{1, 1, 2, 2}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 1, 2, 3}, {4, 5, 6, + 7, 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 2, 1}, {10, + 11}}; + + TestTensor mismatched{armnn::TensorShape{6, 2}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; // The input and output ranks must match V1_0::ErrorStatus expectedParserStatus = V1_0::ErrorStatus::GENERAL_FAILURE; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, mismatched, sample, expectedParserStatus); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, mismatched, computeDevice, expectedParserStatus); } -BOOST_DATA_TEST_CASE(ValidNegativeAxis, COMPUTE_DEVICES) +void ValidNegativeAxis(armnn::Compute computeDevice) { // this is the same as 3 // see: https://www.tensorflow.org/api_docs/python/tf/concat int32_t axis = -1; - TestTensor aIn{armnn::TensorShape{1,1,2,2},{0, 1, - 2, 3}}; - TestTensor bIn{armnn::TensorShape{1,1,2,3},{4, 5, 6, - 7, 8, 9}}; - TestTensor cIn{armnn::TensorShape{1,1,2,1},{10, - 11}}; - - TestTensor expected{armnn::TensorShape{1,1,2,6},{0, 1, 4, 5, 6, 10, - 2, 3, 7, 8, 9, 11}}; + TestTensor aIn{armnn::TensorShape{1, 1, 2, 2}, {0, 1, + 2, 3}}; + TestTensor bIn{armnn::TensorShape{1, 1, 2, 3}, {4, 5, 6, + 7, 8, 9}}; + TestTensor cIn{armnn::TensorShape{1, 1, 2, 1}, {10, + 11}}; + + TestTensor expected{armnn::TensorShape{1, 1, 2, 6}, {0, 1, 4, 5, 6, 10, + 2, 3, 7, 8, 9, 11}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxisZero3D, COMPUTE_DEVICES) +void SimpleConcatAxisZero3D(armnn::Compute computeDevice) { int32_t axis = 0; - TestTensor aIn{armnn::TensorShape{1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{3,1,1},{0,1,2}}; + TestTensor expected{armnn::TensorShape{3, 1, 1}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxisOne3D, COMPUTE_DEVICES) +void SimpleConcatAxisOne3D(armnn::Compute computeDevice) { int32_t axis = 1; - TestTensor aIn{armnn::TensorShape{1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{1,3,1},{0,1,2}}; + TestTensor expected{armnn::TensorShape{1, 3, 1}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxisTwo3D, COMPUTE_DEVICES) +void SimpleConcatAxisTwo3D(armnn::Compute computeDevice) { int32_t axis = 2; - TestTensor aIn{armnn::TensorShape{1,1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{1,1,3},{0,1,2}}; + TestTensor expected{armnn::TensorShape{1, 1, 3}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxisZero2D, COMPUTE_DEVICES) +void SimpleConcatAxisZero2D(armnn::Compute computeDevice) { int32_t axis = 0; - TestTensor aIn{armnn::TensorShape{1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{3,1},{0,1,2}}; + TestTensor expected{armnn::TensorShape{3, 1}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxisOne2D, COMPUTE_DEVICES) +void SimpleConcatAxisOne2D(armnn::Compute computeDevice) { int32_t axis = 1; - TestTensor aIn{armnn::TensorShape{1,1},{0}}; - TestTensor bIn{armnn::TensorShape{1,1},{1}}; - TestTensor cIn{armnn::TensorShape{1,1},{2}}; + TestTensor aIn{armnn::TensorShape{1, 1}, {0}}; + TestTensor bIn{armnn::TensorShape{1, 1}, {1}}; + TestTensor cIn{armnn::TensorShape{1, 1}, {2}}; - TestTensor expected{armnn::TensorShape{1,3},{0,1,2}}; + TestTensor expected{armnn::TensorShape{1, 3}, {0, 1, 2}}; - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); } -BOOST_DATA_TEST_CASE(SimpleConcatAxisZero1D, COMPUTE_DEVICES) +void SimpleConcatAxisZero1D(armnn::Compute computeDevice) { int32_t axis = 0; - TestTensor aIn{armnn::TensorShape{1},{0}}; - TestTensor bIn{armnn::TensorShape{1},{1}}; - TestTensor cIn{armnn::TensorShape{1},{2}}; + TestTensor aIn{armnn::TensorShape{1}, {0}}; + TestTensor bIn{armnn::TensorShape{1}, {1}}; + TestTensor cIn{armnn::TensorShape{1}, {2}}; + + TestTensor expected{armnn::TensorShape{3}, {0, 1, 2}}; + ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, computeDevice); +} + +} // namespace + +TEST_SUITE("ConcatTests_CpuRef") +{ + +TEST_CASE("SimpleConcatAxis0") +{ + SimpleConcatAxis0(armnn::Compute::CpuRef); +} + +TEST_CASE("ConcatAxis0NoInterleave") +{ + ConcatAxis0NoInterleave(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxis1") +{ + SimpleConcatAxis1(armnn::Compute::CpuRef); +} + +TEST_CASE("ConcatAxis1NoInterleave") +{ + ConcatAxis1NoInterleave(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxis1DoInterleave") +{ + SimpleConcatAxis1DoInterleave(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxis2") +{ + SimpleConcatAxis2(armnn::Compute::CpuRef); +} + +TEST_CASE("ConcatAxis2NoInterleave") +{ + ConcatAxis2NoInterleave(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxis2DoInterleave") +{ + SimpleConcatAxis2DoInterleave(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxis3") +{ + SimpleConcatAxis3(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxis3DoInterleave") +{ + SimpleConcatAxis3DoInterleave(armnn::Compute::CpuRef); +} + +TEST_CASE("AxisTooBig") +{ + AxisTooBig(armnn::Compute::CpuRef); +} + +TEST_CASE("AxisTooSmall") +{ + AxisTooSmall(armnn::Compute::CpuRef); +} - TestTensor expected{armnn::TensorShape{3},{0,1,2}}; +TEST_CASE("TooFewInputs") +{ + TooFewInputs(armnn::Compute::CpuRef); +} + +TEST_CASE("MismatchedInputDimensions") +{ + MismatchedInputDimensions(armnn::Compute::CpuRef); +} + +TEST_CASE("MismatchedInputRanks") +{ + MismatchedInputRanks(armnn::Compute::CpuRef); +} + +TEST_CASE("MismatchedOutputDimensions") +{ + MismatchedOutputDimensions(armnn::Compute::CpuRef); +} - ConcatTestImpl({&aIn, &bIn, &cIn}, axis, expected, sample); +TEST_CASE("MismatchedOutputRank") +{ + MismatchedOutputRank(armnn::Compute::CpuRef); +} + +TEST_CASE("ValidNegativeAxis") +{ + ValidNegativeAxis(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxisZero3D") +{ + SimpleConcatAxisZero3D(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxisOne3D") +{ + SimpleConcatAxisOne3D(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxisTwo3D") +{ + SimpleConcatAxisTwo3D(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxisZero2D") +{ + SimpleConcatAxisZero2D(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxisOne2D") +{ + SimpleConcatAxisOne2D(armnn::Compute::CpuRef); +} + +TEST_CASE("SimpleConcatAxisZero1D") +{ + SimpleConcatAxisZero1D(armnn::Compute::CpuRef); +} + +} + +#ifdef ARMCOMPUTECL_ENABLED +TEST_SUITE("ConcatTests_GpuAcc") +{ + +TEST_CASE("SimpleConcatAxis0") +{ + SimpleConcatAxis0(armnn::Compute::GpuAcc); +} + +TEST_CASE("ConcatAxis0NoInterleave") +{ + ConcatAxis0NoInterleave(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxis1") +{ + SimpleConcatAxis1(armnn::Compute::GpuAcc); +} + +TEST_CASE("ConcatAxis1NoInterleave") +{ + ConcatAxis1NoInterleave(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxis1DoInterleave") +{ + SimpleConcatAxis1DoInterleave(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxis2") +{ + SimpleConcatAxis2(armnn::Compute::GpuAcc); +} + +TEST_CASE("ConcatAxis2NoInterleave") +{ + ConcatAxis2NoInterleave(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxis2DoInterleave") +{ + SimpleConcatAxis2DoInterleave(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxis3") +{ + SimpleConcatAxis3(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxis3DoInterleave") +{ + SimpleConcatAxis3DoInterleave(armnn::Compute::GpuAcc); +} + +TEST_CASE("AxisTooBig") +{ + AxisTooBig(armnn::Compute::GpuAcc); +} + +TEST_CASE("AxisTooSmall") +{ + AxisTooSmall(armnn::Compute::GpuAcc); +} + +TEST_CASE("TooFewInputs") +{ + TooFewInputs(armnn::Compute::GpuAcc); +} + +TEST_CASE("MismatchedInputDimensions") +{ + MismatchedInputDimensions(armnn::Compute::GpuAcc); +} + +TEST_CASE("MismatchedInputRanks") +{ + MismatchedInputRanks(armnn::Compute::GpuAcc); +} + +TEST_CASE("MismatchedOutputDimensions") +{ + MismatchedOutputDimensions(armnn::Compute::GpuAcc); +} + +TEST_CASE("MismatchedOutputRank") +{ + MismatchedOutputRank(armnn::Compute::GpuAcc); +} + +TEST_CASE("ValidNegativeAxis") +{ + ValidNegativeAxis(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxisZero3D") +{ + SimpleConcatAxisZero3D(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxisOne3D") +{ + SimpleConcatAxisOne3D(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxisTwo3D") +{ + SimpleConcatAxisTwo3D(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxisZero2D") +{ + SimpleConcatAxisZero2D(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxisOne2D") +{ + SimpleConcatAxisOne2D(armnn::Compute::GpuAcc); +} + +TEST_CASE("SimpleConcatAxisZero1D") +{ + SimpleConcatAxisZero1D(armnn::Compute::GpuAcc); } -BOOST_AUTO_TEST_SUITE_END() +}// End of GpuAcc Test Suite +#endif \ No newline at end of file -- cgit v1.2.1