Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 6 | #include <backendsCommon/test/EndToEndTestImpl.hpp> |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 7 | #include <backendsCommon/test/MergerTestImpl.hpp> |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 8 | |
| 9 | #include <boost/test/unit_test.hpp> |
| 10 | |
| 11 | BOOST_AUTO_TEST_SUITE(NeonEndToEnd) |
| 12 | |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 13 | std::vector<armnn::BackendId> defaultBackends = {armnn::Compute::CpuAcc}; |
| 14 | |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 15 | BOOST_AUTO_TEST_CASE(ConstantUsage_Neon_Float32) |
| 16 | { |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 17 | BOOST_TEST(ConstantUsageFloat32Test(defaultBackends)); |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | BOOST_AUTO_TEST_CASE(FallbackToCpuRef) |
| 21 | { |
| 22 | using namespace armnn; |
| 23 | |
| 24 | // Create runtime in which test will run and allow fallback to CpuRef. |
| 25 | IRuntime::CreationOptions options; |
| 26 | IRuntimePtr runtime(IRuntime::Create(options)); |
| 27 | |
| 28 | // Builds up the structure of the network. |
| 29 | INetworkPtr net(INetwork::Create()); |
| 30 | |
| 31 | IConnectableLayer* input = net->AddInputLayer(0); |
| 32 | |
| 33 | // This layer configuration isn't supported by CpuAcc but we allow fallback to CpuRef so it shoud pass. |
| 34 | NormalizationDescriptor descriptor; |
| 35 | IConnectableLayer* pooling = net->AddNormalizationLayer(descriptor); |
| 36 | |
| 37 | IConnectableLayer* output = net->AddOutputLayer(0); |
| 38 | |
| 39 | input->GetOutputSlot(0).Connect(pooling->GetInputSlot(0)); |
| 40 | pooling->GetOutputSlot(0).Connect(output->GetInputSlot(0)); |
| 41 | |
| 42 | input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32)); |
| 43 | pooling->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32)); |
| 44 | |
| 45 | // optimize the network |
| 46 | std::vector<BackendId> backends = {Compute::CpuAcc, Compute::CpuRef}; |
| 47 | IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec()); |
| 48 | |
| 49 | // Load it into the runtime. It should pass. |
| 50 | NetworkId netId; |
| 51 | BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success); |
| 52 | } |
| 53 | |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 54 | BOOST_AUTO_TEST_CASE(NeonMergerEndToEndDim0Test) |
| 55 | { |
| 56 | MergerDim0EndToEnd<float>(defaultBackends); |
| 57 | } |
| 58 | |
| 59 | BOOST_AUTO_TEST_CASE(NeonMergerEndToEndDim0Uint8Test) |
| 60 | { |
| 61 | MergerDim0EndToEnd<uint8_t>(defaultBackends); |
| 62 | } |
| 63 | |
| 64 | BOOST_AUTO_TEST_CASE(NeonMergerEndToEndDim1Test) |
| 65 | { |
| 66 | MergerDim1EndToEnd<float>(defaultBackends); |
| 67 | } |
| 68 | |
| 69 | BOOST_AUTO_TEST_CASE(NeonMergerEndToEndDim1Uint8Test) |
| 70 | { |
| 71 | MergerDim1EndToEnd<uint8_t>(defaultBackends); |
| 72 | } |
| 73 | |
| 74 | BOOST_AUTO_TEST_CASE(NeonMergerEndToEndDim3Test) |
| 75 | { |
| 76 | MergerDim3EndToEnd<float>(defaultBackends); |
| 77 | } |
| 78 | |
| 79 | BOOST_AUTO_TEST_CASE(NeonMergerEndToEndDim3Uint8Test) |
| 80 | { |
| 81 | MergerDim3EndToEnd<uint8_t>(defaultBackends); |
| 82 | } |
| 83 | |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 84 | BOOST_AUTO_TEST_SUITE_END() |