blob: f9aa8a5df575deb99287d5b0b1a38665d2fcb934 [file] [log] [blame]
Aron Virginas-Tar70104002018-10-24 15:33:28 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include <backends/test/EndToEndTestImpl.hpp>
7
8#include <boost/test/unit_test.hpp>
9
10BOOST_AUTO_TEST_SUITE(NeonEndToEnd)
11
12BOOST_AUTO_TEST_CASE(ConstantUsage_Neon_Float32)
13{
14 std::vector<armnn::BackendId> backends = {armnn::Compute::CpuAcc};
15 BOOST_TEST(ConstantUsageFloat32Test(backends));
16}
17
18BOOST_AUTO_TEST_CASE(FallbackToCpuRef)
19{
20 using namespace armnn;
21
22 // Create runtime in which test will run and allow fallback to CpuRef.
23 IRuntime::CreationOptions options;
24 IRuntimePtr runtime(IRuntime::Create(options));
25
26 // Builds up the structure of the network.
27 INetworkPtr net(INetwork::Create());
28
29 IConnectableLayer* input = net->AddInputLayer(0);
30
31 // This layer configuration isn't supported by CpuAcc but we allow fallback to CpuRef so it shoud pass.
32 NormalizationDescriptor descriptor;
33 IConnectableLayer* pooling = net->AddNormalizationLayer(descriptor);
34
35 IConnectableLayer* output = net->AddOutputLayer(0);
36
37 input->GetOutputSlot(0).Connect(pooling->GetInputSlot(0));
38 pooling->GetOutputSlot(0).Connect(output->GetInputSlot(0));
39
40 input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
41 pooling->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
42
43 // optimize the network
44 std::vector<BackendId> backends = {Compute::CpuAcc, Compute::CpuRef};
45 IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
46
47 // Load it into the runtime. It should pass.
48 NetworkId netId;
49 BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
50}
51
52BOOST_AUTO_TEST_SUITE_END()