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> |
Narumol Prangnawarat | 6d302bf | 2019-02-04 11:46:26 +0000 | [diff] [blame] | 7 | |
Aron Virginas-Tar | 8fccd86 | 2019-09-09 11:22:56 +0100 | [diff] [blame] | 8 | #include <backendsCommon/test/AbsEndToEndTestImpl.hpp> |
Narumol Prangnawarat | d1f5773 | 2019-10-31 14:24:02 +0000 | [diff] [blame] | 9 | #include <backendsCommon/test/ArgMinMaxEndToEndTestImpl.hpp> |
Francis Murtagh | e24e3cd | 2019-06-25 14:41:55 +0100 | [diff] [blame] | 10 | #include <backendsCommon/test/BatchToSpaceNdEndToEndTestImpl.hpp> |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 11 | #include <backendsCommon/test/ComparisonEndToEndTestImpl.hpp> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 12 | #include <backendsCommon/test/ConcatEndToEndTestImpl.hpp> |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 13 | #include <backendsCommon/test/DepthToSpaceEndToEndTestImpl.hpp> |
Narumol Prangnawarat | 8c7324d | 2019-05-31 16:42:11 +0100 | [diff] [blame] | 14 | #include <backendsCommon/test/DequantizeEndToEndTestImpl.hpp> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 15 | #include <backendsCommon/test/DetectionPostProcessEndToEndTestImpl.hpp> |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 16 | #include <backendsCommon/test/GatherEndToEndTestImpl.hpp> |
Sadik Armagan | 062e0e9 | 2019-10-14 10:31:43 +0100 | [diff] [blame] | 17 | #include <backendsCommon/test/InstanceNormalizationEndToEndTestImpl.hpp> |
Sadik Armagan | 20bea00 | 2019-10-16 09:29:38 +0100 | [diff] [blame] | 18 | #include <backendsCommon/test/LogSoftmaxEndToEndTestImpl.hpp> |
Nikhil Raj | 747f586 | 2019-07-19 15:15:23 +0100 | [diff] [blame] | 19 | #include <backendsCommon/test/PreluEndToEndTestImpl.hpp> |
Aron Virginas-Tar | fe15eff | 2019-07-01 16:12:58 +0100 | [diff] [blame] | 20 | #include <backendsCommon/test/ResizeEndToEndTestImpl.hpp> |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 21 | #include <backendsCommon/test/SpaceToDepthEndToEndTestImpl.hpp> |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 22 | #include <backendsCommon/test/SplitterEndToEndTestImpl.hpp> |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 23 | #include <backendsCommon/test/TransposeConvolution2dEndToEndTestImpl.hpp> |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 24 | |
| 25 | #include <boost/test/unit_test.hpp> |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 26 | #include <boost/test/execution_monitor.hpp> |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 27 | |
| 28 | BOOST_AUTO_TEST_SUITE(RefEndToEnd) |
| 29 | |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 30 | std::vector<armnn::BackendId> defaultBackends = {armnn::Compute::CpuRef}; |
| 31 | |
Aron Virginas-Tar | 8fccd86 | 2019-09-09 11:22:56 +0100 | [diff] [blame] | 32 | // Abs |
| 33 | BOOST_AUTO_TEST_CASE(RefAbsEndToEndTestFloat32) |
| 34 | { |
| 35 | AbsEndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 36 | } |
| 37 | |
| 38 | BOOST_AUTO_TEST_CASE(RefAbsEndToEndTestUint8) |
| 39 | { |
| 40 | AbsEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 41 | } |
| 42 | |
| 43 | BOOST_AUTO_TEST_CASE(RefAbsEndToEndTestInt16) |
| 44 | { |
| 45 | AbsEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends); |
| 46 | } |
| 47 | |
| 48 | // Constant |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 49 | BOOST_AUTO_TEST_CASE(ConstantUsage_Ref_Float32) |
| 50 | { |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 51 | BOOST_TEST(ConstantUsageFloat32Test(defaultBackends)); |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | BOOST_AUTO_TEST_CASE(ConstantUsage_Ref_Uint8) |
| 55 | { |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 56 | BOOST_TEST(ConstantUsageUint8Test(defaultBackends)); |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | BOOST_AUTO_TEST_CASE(Unsigned8) |
| 60 | { |
| 61 | using namespace armnn; |
| 62 | |
| 63 | // Create runtime in which test will run |
| 64 | armnn::IRuntime::CreationOptions options; |
| 65 | armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); |
| 66 | |
| 67 | // Builds up the structure of the network. |
| 68 | armnn::INetworkPtr net(INetwork::Create()); |
| 69 | |
| 70 | IConnectableLayer* input = net->AddInputLayer(0, "input"); |
| 71 | IConnectableLayer* softmax = net->AddSoftmaxLayer(SoftmaxDescriptor(), "softmax"); |
| 72 | IConnectableLayer* output = net->AddOutputLayer(0, "output"); |
| 73 | |
| 74 | input->GetOutputSlot(0).Connect(softmax->GetInputSlot(0)); |
| 75 | softmax->GetOutputSlot(0).Connect(output->GetInputSlot(0)); |
| 76 | |
| 77 | // Sets the tensors in the network. |
| 78 | TensorInfo inputTensorInfo(TensorShape({1, 5}), DataType::QuantisedAsymm8); |
| 79 | inputTensorInfo.SetQuantizationOffset(100); |
| 80 | inputTensorInfo.SetQuantizationScale(10000.0f); |
| 81 | input->GetOutputSlot(0).SetTensorInfo(inputTensorInfo); |
| 82 | |
| 83 | TensorInfo outputTensorInfo(TensorShape({1, 5}), DataType::QuantisedAsymm8); |
| 84 | outputTensorInfo.SetQuantizationOffset(0); |
| 85 | outputTensorInfo.SetQuantizationScale(1.0f/255.0f); |
| 86 | softmax->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); |
| 87 | |
| 88 | // optimize the network |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 89 | IOptimizedNetworkPtr optNet = Optimize(*net, defaultBackends, runtime->GetDeviceSpec()); |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 90 | |
| 91 | // Loads it into the runtime. |
| 92 | NetworkId netId; |
| 93 | auto error = runtime->LoadNetwork(netId, std::move(optNet)); |
| 94 | BOOST_TEST(error == Status::Success); |
| 95 | |
| 96 | // Creates structures for input & output. |
| 97 | std::vector<uint8_t> inputData |
| 98 | { |
| 99 | 1, 10, 3, 200, 5 // Some inputs - one of which is sufficiently larger than the others to saturate softmax. |
| 100 | }; |
| 101 | std::vector<uint8_t> outputData(5); |
| 102 | |
| 103 | armnn::InputTensors inputTensors |
| 104 | { |
| 105 | {0, armnn::ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())} |
| 106 | }; |
| 107 | armnn::OutputTensors outputTensors |
| 108 | { |
| 109 | {0, armnn::Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())} |
| 110 | }; |
| 111 | |
| 112 | // Does the inference. |
| 113 | runtime->EnqueueWorkload(netId, inputTensors, outputTensors); |
| 114 | |
| 115 | // Checks the results. |
| 116 | BOOST_TEST(outputData[0] == 0); |
| 117 | BOOST_TEST(outputData[1] == 0); |
| 118 | BOOST_TEST(outputData[2] == 0); |
| 119 | BOOST_TEST(outputData[3] == 255); // softmax has been saturated. |
| 120 | BOOST_TEST(outputData[4] == 0); |
| 121 | } |
| 122 | |
| 123 | BOOST_AUTO_TEST_CASE(TrivialAdd) |
| 124 | { |
| 125 | // This test was designed to match "AddTwo" in android nn/runtime/test/TestTrivialModel.cpp. |
| 126 | |
| 127 | using namespace armnn; |
| 128 | |
| 129 | // Create runtime in which test will run |
| 130 | armnn::IRuntime::CreationOptions options; |
| 131 | armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); |
| 132 | |
| 133 | // Builds up the structure of the network. |
| 134 | armnn::INetworkPtr net(INetwork::Create()); |
| 135 | |
| 136 | IConnectableLayer* input1 = net->AddInputLayer(0); |
| 137 | IConnectableLayer* input2 = net->AddInputLayer(1); |
| 138 | IConnectableLayer* add = net->AddAdditionLayer(); |
| 139 | IConnectableLayer* output = net->AddOutputLayer(0); |
| 140 | |
| 141 | input1->GetOutputSlot(0).Connect(add->GetInputSlot(0)); |
| 142 | input2->GetOutputSlot(0).Connect(add->GetInputSlot(1)); |
| 143 | add->GetOutputSlot(0).Connect(output->GetInputSlot(0)); |
| 144 | |
| 145 | // Sets the tensors in the network. |
| 146 | TensorInfo tensorInfo(TensorShape({3, 4}), DataType::Float32); |
| 147 | input1->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 148 | input2->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 149 | add->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 150 | |
| 151 | // optimize the network |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 152 | IOptimizedNetworkPtr optNet = Optimize(*net, defaultBackends, runtime->GetDeviceSpec()); |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 153 | |
| 154 | // Loads it into the runtime. |
| 155 | NetworkId netId; |
| 156 | runtime->LoadNetwork(netId, std::move(optNet)); |
| 157 | |
| 158 | // Creates structures for input & output - matching android nn test. |
| 159 | std::vector<float> input1Data |
| 160 | { |
| 161 | 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f |
| 162 | }; |
| 163 | std::vector<float> input2Data |
| 164 | { |
| 165 | 100.f, 200.f, 300.f, 400.f, 500.f, 600.f, 700.f, 800.f, 900.f, 1000.f, 1100.f, 1200.f |
| 166 | }; |
| 167 | std::vector<float> outputData(12); |
| 168 | |
| 169 | InputTensors inputTensors |
| 170 | { |
| 171 | {0,armnn::ConstTensor(runtime->GetInputTensorInfo(netId, 0), input1Data.data())}, |
| 172 | {1,armnn::ConstTensor(runtime->GetInputTensorInfo(netId, 0), input2Data.data())} |
| 173 | }; |
| 174 | OutputTensors outputTensors |
| 175 | { |
| 176 | {0,armnn::Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())} |
| 177 | }; |
| 178 | |
| 179 | // Does the inference. |
| 180 | runtime->EnqueueWorkload(netId, inputTensors, outputTensors); |
| 181 | |
| 182 | // Checks the results |
| 183 | BOOST_TEST(outputData[0] == 101); |
| 184 | BOOST_TEST(outputData[1] == 202); |
| 185 | BOOST_TEST(outputData[2] == 303); |
| 186 | BOOST_TEST(outputData[3] == 404); |
| 187 | BOOST_TEST(outputData[4] == 505); |
| 188 | BOOST_TEST(outputData[5] == 606); |
| 189 | BOOST_TEST(outputData[6] == 707); |
| 190 | BOOST_TEST(outputData[7] == 808); |
| 191 | BOOST_TEST(outputData[8] == 909); |
| 192 | BOOST_TEST(outputData[9] == 1010); |
| 193 | BOOST_TEST(outputData[10] == 1111); |
| 194 | BOOST_TEST(outputData[11] == 1212); |
| 195 | } |
| 196 | |
| 197 | BOOST_AUTO_TEST_CASE(MultipleOutputs) |
| 198 | { |
| 199 | using namespace armnn; |
| 200 | |
| 201 | // Create runtime in which test will run |
| 202 | armnn::IRuntime::CreationOptions options; |
| 203 | armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); |
| 204 | |
| 205 | // Builds up the structure of the network. |
| 206 | INetworkPtr net(INetwork::Create()); |
| 207 | |
| 208 | IConnectableLayer* input = net->AddInputLayer(0); |
| 209 | |
| 210 | // ReLu1 |
| 211 | ActivationDescriptor activation1Descriptor; |
| 212 | activation1Descriptor.m_Function = ActivationFunction::BoundedReLu; |
| 213 | activation1Descriptor.m_A = 1.f; |
| 214 | activation1Descriptor.m_B = -1.f; |
| 215 | IConnectableLayer* activation1 = net->AddActivationLayer(activation1Descriptor); |
| 216 | |
| 217 | // ReLu6 |
| 218 | ActivationDescriptor activation2Descriptor; |
| 219 | activation2Descriptor.m_Function = ActivationFunction::BoundedReLu; |
| 220 | activation2Descriptor.m_A = 6.0f; |
| 221 | IConnectableLayer* activation2 = net->AddActivationLayer(activation2Descriptor); |
| 222 | |
| 223 | // BoundedReLu(min=2, max=5) |
| 224 | ActivationDescriptor activation3Descriptor; |
| 225 | activation3Descriptor.m_Function = ActivationFunction::BoundedReLu; |
| 226 | activation3Descriptor.m_A = 5.0f; |
| 227 | activation3Descriptor.m_B = 2.0f; |
| 228 | IConnectableLayer* activation3 = net->AddActivationLayer(activation3Descriptor); |
| 229 | |
| 230 | IConnectableLayer* output1 = net->AddOutputLayer(0); |
| 231 | IConnectableLayer* output2 = net->AddOutputLayer(1); |
| 232 | IConnectableLayer* output3 = net->AddOutputLayer(2); |
| 233 | |
| 234 | input->GetOutputSlot(0).Connect(activation1->GetInputSlot(0)); |
| 235 | input->GetOutputSlot(0).Connect(activation2->GetInputSlot(0)); |
| 236 | input->GetOutputSlot(0).Connect(activation3->GetInputSlot(0)); |
| 237 | |
| 238 | activation1->GetOutputSlot(0).Connect(output1->GetInputSlot(0)); |
| 239 | activation2->GetOutputSlot(0).Connect(output2->GetInputSlot(0)); |
| 240 | activation3->GetOutputSlot(0).Connect(output3->GetInputSlot(0)); |
| 241 | |
| 242 | // Sets the tensors in the network. |
| 243 | TensorInfo tensorInfo(TensorShape({ 10 }), DataType::Float32); |
| 244 | input->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 245 | activation1->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 246 | activation2->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 247 | activation3->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 248 | |
| 249 | // optimize the network |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 250 | IOptimizedNetworkPtr optNet = Optimize(*net, defaultBackends, runtime->GetDeviceSpec()); |
Aron Virginas-Tar | 7010400 | 2018-10-24 15:33:28 +0100 | [diff] [blame] | 251 | |
| 252 | // Loads it into the runtime. |
| 253 | NetworkId netId; |
| 254 | runtime->LoadNetwork(netId, std::move(optNet)); |
| 255 | |
| 256 | // Creates structures for input & output. |
| 257 | const std::vector<float> inputData{ 3.f, 5.f, 2.f, 3.f, 7.f, 0.f, -2.f, -1.f, 3.f, 3.f }; |
| 258 | |
| 259 | std::vector<float> output1Data(inputData.size()); |
| 260 | std::vector<float> output2Data(inputData.size()); |
| 261 | std::vector<float> output3Data(inputData.size()); |
| 262 | |
| 263 | InputTensors inputTensors |
| 264 | { |
| 265 | {0,armnn::ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())} |
| 266 | }; |
| 267 | OutputTensors outputTensors |
| 268 | { |
| 269 | {0,armnn::Tensor(runtime->GetOutputTensorInfo(netId, 0), output1Data.data())}, |
| 270 | {1,armnn::Tensor(runtime->GetOutputTensorInfo(netId, 1), output2Data.data())}, |
| 271 | {2,armnn::Tensor(runtime->GetOutputTensorInfo(netId, 2), output3Data.data())} |
| 272 | }; |
| 273 | |
| 274 | // Does the inference. |
| 275 | runtime->EnqueueWorkload(netId, inputTensors, outputTensors); |
| 276 | |
| 277 | // Checks the results. |
| 278 | BOOST_TEST(output1Data == std::vector<float>({ 1.f, 1.f, 1.f, 1.f, 1.f, 0.f, -1.f, -1.f, 1.f, 1.f })); // ReLu1 |
| 279 | BOOST_TEST(output2Data == std::vector<float>({ 3.f, 5.f, 2.f, 3.f, 6.f, 0.f, 0.f, 0.f, 3.f, 3.f })); // ReLu6 |
| 280 | BOOST_TEST(output3Data == std::vector<float>({ 3.f, 5.f, 2.f, 3.f, 5.f, 2.f, 2.f, 2.f, 3.f, 3.f })); // [2, 5] |
| 281 | } |
| 282 | |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 283 | BOOST_AUTO_TEST_CASE(TrivialMin) |
| 284 | { |
| 285 | using namespace armnn; |
| 286 | |
| 287 | // Create runtime in which test will run |
| 288 | armnn::IRuntime::CreationOptions options; |
| 289 | armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); |
| 290 | |
| 291 | // Builds up the structure of the network. |
| 292 | armnn::INetworkPtr net(INetwork::Create()); |
| 293 | |
| 294 | IConnectableLayer* input1 = net->AddInputLayer(0); |
| 295 | IConnectableLayer* input2 = net->AddInputLayer(1); |
| 296 | IConnectableLayer* min = net->AddMinimumLayer(); |
| 297 | IConnectableLayer* output = net->AddOutputLayer(0); |
| 298 | |
| 299 | input1->GetOutputSlot(0).Connect(min->GetInputSlot(0)); |
| 300 | input2->GetOutputSlot(0).Connect(min->GetInputSlot(1)); |
| 301 | min->GetOutputSlot(0).Connect(output->GetInputSlot(0)); |
| 302 | |
| 303 | // Sets the tensors in the network. |
| 304 | TensorInfo tensorInfo(TensorShape({1, 1, 1, 4}), DataType::Float32); |
| 305 | input1->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 306 | input2->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 307 | min->GetOutputSlot(0).SetTensorInfo(tensorInfo); |
| 308 | |
| 309 | // optimize the network |
| 310 | IOptimizedNetworkPtr optNet = Optimize(*net, defaultBackends, runtime->GetDeviceSpec()); |
| 311 | |
| 312 | // Loads it into the runtime. |
| 313 | NetworkId netId; |
| 314 | runtime->LoadNetwork(netId, std::move(optNet)); |
| 315 | |
| 316 | // Creates structures for input & output - matching android nn test. |
| 317 | std::vector<float> input1Data |
| 318 | { |
| 319 | 1.0f, 2.0f, 3.0f, 4.0f |
| 320 | }; |
| 321 | std::vector<float> input2Data |
| 322 | { |
| 323 | 2.0f, 1.0f, 5.0f, 2.0f |
| 324 | }; |
| 325 | std::vector<float> outputData(4); |
| 326 | |
| 327 | InputTensors inputTensors |
| 328 | { |
| 329 | {0,armnn::ConstTensor(runtime->GetInputTensorInfo(netId, 0), input1Data.data())}, |
| 330 | {1,armnn::ConstTensor(runtime->GetInputTensorInfo(netId, 0), input2Data.data())} |
| 331 | }; |
| 332 | OutputTensors outputTensors |
| 333 | { |
| 334 | {0,armnn::Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())} |
| 335 | }; |
| 336 | |
| 337 | // Does the inference. |
| 338 | runtime->EnqueueWorkload(netId, inputTensors, outputTensors); |
| 339 | |
| 340 | // Checks the results |
| 341 | BOOST_TEST(outputData[0] == 1); |
| 342 | BOOST_TEST(outputData[1] == 1); |
| 343 | BOOST_TEST(outputData[2] == 3); |
| 344 | BOOST_TEST(outputData[3] == 2); |
| 345 | } |
| 346 | |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 347 | BOOST_AUTO_TEST_CASE(RefEqualSimpleEndToEndTest) |
| 348 | { |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 349 | const std::vector<uint8_t> expectedOutput({ 1, 1, 1, 1, 0, 0, 0, 0, |
| 350 | 0, 0, 0, 0, 1, 1, 1, 1 }); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 351 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 352 | ComparisonSimpleEndToEnd<armnn::DataType::Float32>(defaultBackends, |
| 353 | ComparisonOperation::Equal, |
| 354 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | BOOST_AUTO_TEST_CASE(RefGreaterSimpleEndToEndTest) |
| 358 | { |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 359 | const std::vector<uint8_t> expectedOutput({ 0, 0, 0, 0, 1, 1, 1, 1, |
| 360 | 0, 0, 0, 0, 0, 0, 0, 0 }); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 361 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 362 | ComparisonSimpleEndToEnd<armnn::DataType::Float32>(defaultBackends, |
| 363 | ComparisonOperation::Greater, |
| 364 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | BOOST_AUTO_TEST_CASE(RefEqualSimpleEndToEndUint8Test) |
| 368 | { |
| 369 | const std::vector<uint8_t> expectedOutput({ 1, 1, 1, 1, 0, 0, 0, 0, |
| 370 | 0, 0, 0, 0, 1, 1, 1, 1 }); |
| 371 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 372 | ComparisonSimpleEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, |
| 373 | ComparisonOperation::Equal, |
| 374 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | BOOST_AUTO_TEST_CASE(RefGreaterSimpleEndToEndUint8Test) |
| 378 | { |
| 379 | const std::vector<uint8_t> expectedOutput({ 0, 0, 0, 0, 1, 1, 1, 1, |
| 380 | 0, 0, 0, 0, 0, 0, 0, 0 }); |
| 381 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 382 | ComparisonSimpleEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, |
| 383 | ComparisonOperation::Greater, |
| 384 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | BOOST_AUTO_TEST_CASE(RefEqualBroadcastEndToEndTest) |
| 388 | { |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 389 | const std::vector<uint8_t> expectedOutput({ 1, 0, 1, 1, 0, 0, |
| 390 | 0, 0, 0, 0, 0, 0 }); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 391 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 392 | ComparisonBroadcastEndToEnd<armnn::DataType::Float32>(defaultBackends, |
| 393 | ComparisonOperation::Equal, |
| 394 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | BOOST_AUTO_TEST_CASE(RefGreaterBroadcastEndToEndTest) |
| 398 | { |
kevmay01 | 2b4d88e | 2019-01-24 14:05:09 +0000 | [diff] [blame] | 399 | const std::vector<uint8_t> expectedOutput({ 0, 1, 0, 0, 0, 1, |
| 400 | 1, 1, 1, 1, 1, 1 }); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 401 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 402 | ComparisonBroadcastEndToEnd<armnn::DataType::Float32>(defaultBackends, |
| 403 | ComparisonOperation::Greater, |
| 404 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | BOOST_AUTO_TEST_CASE(RefEqualBroadcastEndToEndUint8Test) |
| 408 | { |
| 409 | const std::vector<uint8_t > expectedOutput({ 1, 0, 1, 1, 0, 0, |
| 410 | 0, 0, 0, 0, 0, 0 }); |
| 411 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 412 | ComparisonBroadcastEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, |
| 413 | ComparisonOperation::Equal, |
| 414 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | BOOST_AUTO_TEST_CASE(RefGreaterBroadcastEndToEndUint8Test) |
| 418 | { |
| 419 | const std::vector<uint8_t> expectedOutput({ 0, 1, 0, 0, 0, 1, |
| 420 | 1, 1, 1, 1, 1, 1 }); |
| 421 | |
Aron Virginas-Tar | 77bfb5e | 2019-10-16 17:45:38 +0100 | [diff] [blame] | 422 | ComparisonBroadcastEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, |
| 423 | ComparisonOperation::Greater, |
| 424 | expectedOutput); |
FrancisMurtagh | 2262bbd | 2018-12-20 16:09:45 +0000 | [diff] [blame] | 425 | } |
Éanna Ó Catháin | 20e5880 | 2018-12-04 10:29:06 +0000 | [diff] [blame] | 426 | |
Francis Murtagh | e24e3cd | 2019-06-25 14:41:55 +0100 | [diff] [blame] | 427 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndFloat32NHWCTest) |
| 428 | { |
| 429 | BatchToSpaceNdEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NHWC); |
| 430 | } |
| 431 | |
| 432 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndUint8NHWCTest) |
| 433 | { |
| 434 | BatchToSpaceNdEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NHWC); |
| 435 | } |
| 436 | |
| 437 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndQSymm16NHWCTest) |
| 438 | { |
| 439 | BatchToSpaceNdEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NHWC); |
| 440 | } |
| 441 | |
| 442 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndFloat32NCHWTest) |
| 443 | { |
| 444 | BatchToSpaceNdEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NCHW); |
| 445 | } |
| 446 | |
| 447 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndUint8NCHWTest) |
| 448 | { |
| 449 | BatchToSpaceNdEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NCHW); |
| 450 | } |
| 451 | |
| 452 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndQSymm16NCHWTest) |
| 453 | { |
| 454 | BatchToSpaceNdEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NCHW); |
| 455 | } |
| 456 | |
| 457 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndComplexFloat32NHWCTest) |
| 458 | { |
| 459 | BatchToSpaceNdComplexEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NHWC); |
| 460 | } |
| 461 | |
| 462 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndComplexUint8NHWCTest) |
| 463 | { |
| 464 | BatchToSpaceNdComplexEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NHWC); |
| 465 | } |
| 466 | |
| 467 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndComplexQSymm16NHWCTest) |
| 468 | { |
| 469 | BatchToSpaceNdComplexEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NHWC); |
| 470 | } |
| 471 | |
| 472 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndComplexFloat32NCHWTest) |
| 473 | { |
| 474 | BatchToSpaceNdComplexEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NCHW); |
| 475 | } |
| 476 | |
| 477 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndComplexUint8NCHWTest) |
| 478 | { |
| 479 | BatchToSpaceNdComplexEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NCHW); |
| 480 | } |
| 481 | |
| 482 | BOOST_AUTO_TEST_CASE(RefBatchToSpaceNdEndToEndComplexQSymm16NCHWTest) |
| 483 | { |
| 484 | BatchToSpaceNdComplexEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NCHW); |
| 485 | } |
| 486 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 487 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim0Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 488 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 489 | ConcatDim0EndToEnd<armnn::DataType::Float32>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 490 | } |
| 491 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 492 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim0Uint8Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 493 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 494 | ConcatDim0EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 495 | } |
| 496 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 497 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim1Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 498 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 499 | ConcatDim1EndToEnd<armnn::DataType::Float32>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 500 | } |
| 501 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 502 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim1Uint8Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 503 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 504 | ConcatDim1EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 505 | } |
| 506 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 507 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim2Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 508 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 509 | ConcatDim2EndToEnd<armnn::DataType::Float32>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 510 | } |
| 511 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 512 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim2Uint8Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 513 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 514 | ConcatDim2EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 515 | } |
| 516 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 517 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim3Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 518 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 519 | ConcatDim3EndToEnd<armnn::DataType::Float32>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 520 | } |
| 521 | |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 522 | BOOST_AUTO_TEST_CASE(RefConcatEndToEndDim3Uint8Test) |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 523 | { |
Jim Flynn | e242f2d | 2019-05-22 14:24:13 +0100 | [diff] [blame] | 524 | ConcatDim3EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
narpra01 | b9546cf | 2018-11-20 15:21:28 +0000 | [diff] [blame] | 525 | } |
| 526 | |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 527 | BOOST_AUTO_TEST_CASE(RefGatherFloatTest) |
| 528 | { |
| 529 | GatherEndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 530 | } |
| 531 | |
| 532 | BOOST_AUTO_TEST_CASE(RefGatherUint8Test) |
| 533 | { |
| 534 | GatherEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 535 | } |
| 536 | |
Ellen Norris-Thompson | e0dbedf | 2019-06-24 09:23:38 +0100 | [diff] [blame] | 537 | BOOST_AUTO_TEST_CASE(RefGatherInt16Test) |
| 538 | { |
| 539 | GatherEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends); |
| 540 | } |
| 541 | |
narpra01 | db2b160 | 2019-01-23 15:23:11 +0000 | [diff] [blame] | 542 | BOOST_AUTO_TEST_CASE(RefGatherMultiDimFloatTest) |
| 543 | { |
| 544 | GatherMultiDimEndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 545 | } |
| 546 | |
| 547 | BOOST_AUTO_TEST_CASE(RefGatherMultiDimUint8Test) |
| 548 | { |
| 549 | GatherMultiDimEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 550 | } |
| 551 | |
Ellen Norris-Thompson | e0dbedf | 2019-06-24 09:23:38 +0100 | [diff] [blame] | 552 | BOOST_AUTO_TEST_CASE(RefGatherMultiDimInt16Test) |
| 553 | { |
| 554 | GatherMultiDimEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends); |
| 555 | } |
| 556 | |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 557 | // DepthToSpace |
| 558 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNchwFloat32) |
| 559 | { |
| 560 | DepthToSpaceEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NCHW); |
| 561 | } |
| 562 | |
| 563 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNchwFloat16) |
| 564 | { |
| 565 | DepthToSpaceEndToEnd<armnn::DataType::Float16>(defaultBackends, armnn::DataLayout::NCHW); |
| 566 | } |
| 567 | |
| 568 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNchwUint8) |
| 569 | { |
| 570 | DepthToSpaceEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NCHW); |
| 571 | } |
| 572 | |
| 573 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNchwInt16) |
| 574 | { |
| 575 | DepthToSpaceEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NCHW); |
| 576 | } |
| 577 | |
| 578 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNhwcFloat32) |
| 579 | { |
| 580 | DepthToSpaceEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NHWC); |
| 581 | } |
| 582 | |
| 583 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNhwcFloat16) |
| 584 | { |
| 585 | DepthToSpaceEndToEnd<armnn::DataType::Float16>(defaultBackends, armnn::DataLayout::NHWC); |
| 586 | } |
| 587 | |
| 588 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNhwcUint8) |
| 589 | { |
| 590 | DepthToSpaceEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NHWC); |
| 591 | } |
| 592 | |
| 593 | BOOST_AUTO_TEST_CASE(DephtToSpaceEndToEndNhwcInt16) |
| 594 | { |
| 595 | DepthToSpaceEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NHWC); |
| 596 | } |
| 597 | |
| 598 | // Dequantize |
Narumol Prangnawarat | 8c7324d | 2019-05-31 16:42:11 +0100 | [diff] [blame] | 599 | BOOST_AUTO_TEST_CASE(DequantizeEndToEndSimpleTest) |
| 600 | { |
| 601 | DequantizeEndToEndSimple<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 602 | } |
| 603 | |
| 604 | BOOST_AUTO_TEST_CASE(DequantizeEndToEndOffsetTest) |
| 605 | { |
| 606 | DequantizeEndToEndOffset<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 607 | } |
| 608 | |
Narumol Prangnawarat | b6441e4 | 2019-06-04 11:22:00 +0100 | [diff] [blame] | 609 | BOOST_AUTO_TEST_CASE(DequantizeEndToEndSimpleInt16Test) |
| 610 | { |
| 611 | DequantizeEndToEndSimple<armnn::DataType::QuantisedSymm16>(defaultBackends); |
| 612 | } |
| 613 | |
| 614 | BOOST_AUTO_TEST_CASE(DequantizeEndToEndOffsetInt16Test) |
| 615 | { |
| 616 | DequantizeEndToEndOffset<armnn::DataType::QuantisedSymm16>(defaultBackends); |
| 617 | } |
| 618 | |
Narumol Prangnawarat | 6d302bf | 2019-02-04 11:46:26 +0000 | [diff] [blame] | 619 | BOOST_AUTO_TEST_CASE(RefDetectionPostProcessRegularNmsTest) |
| 620 | { |
| 621 | std::vector<float> boxEncodings({ |
| 622 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 623 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 624 | 0.0f, -1.0f, 0.0f, 0.0f, |
| 625 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 626 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 627 | 0.0f, 0.0f, 0.0f, 0.0f |
| 628 | }); |
| 629 | std::vector<float> scores({ |
| 630 | 0.0f, 0.9f, 0.8f, |
| 631 | 0.0f, 0.75f, 0.72f, |
| 632 | 0.0f, 0.6f, 0.5f, |
| 633 | 0.0f, 0.93f, 0.95f, |
| 634 | 0.0f, 0.5f, 0.4f, |
| 635 | 0.0f, 0.3f, 0.2f |
| 636 | }); |
| 637 | std::vector<float> anchors({ |
| 638 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 639 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 640 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 641 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 642 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 643 | 0.5f, 100.5f, 1.0f, 1.0f |
| 644 | }); |
| 645 | DetectionPostProcessRegularNmsEndToEnd<armnn::DataType::Float32>(defaultBackends, boxEncodings, scores, anchors); |
| 646 | } |
| 647 | |
| 648 | inline void QuantizeData(uint8_t* quant, const float* dequant, const TensorInfo& info) |
| 649 | { |
| 650 | for (size_t i = 0; i < info.GetNumElements(); i++) |
| 651 | { |
| 652 | quant[i] = armnn::Quantize<uint8_t>(dequant[i], info.GetQuantizationScale(), info.GetQuantizationOffset()); |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | BOOST_AUTO_TEST_CASE(RefDetectionPostProcessRegularNmsUint8Test) |
| 657 | { |
| 658 | armnn::TensorInfo boxEncodingsInfo({ 1, 6, 4 }, armnn::DataType::Float32); |
| 659 | armnn::TensorInfo scoresInfo({ 1, 6, 3 }, armnn::DataType::Float32); |
| 660 | armnn::TensorInfo anchorsInfo({ 6, 4 }, armnn::DataType::Float32); |
| 661 | |
| 662 | boxEncodingsInfo.SetQuantizationScale(1.0f); |
| 663 | boxEncodingsInfo.SetQuantizationOffset(1); |
| 664 | scoresInfo.SetQuantizationScale(0.01f); |
| 665 | scoresInfo.SetQuantizationOffset(0); |
| 666 | anchorsInfo.SetQuantizationScale(0.5f); |
| 667 | anchorsInfo.SetQuantizationOffset(0); |
| 668 | |
| 669 | std::vector<float> boxEncodings({ |
| 670 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 671 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 672 | 0.0f, -1.0f, 0.0f, 0.0f, |
| 673 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 674 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 675 | 0.0f, 0.0f, 0.0f, 0.0f |
| 676 | }); |
| 677 | std::vector<float> scores({ |
| 678 | 0.0f, 0.9f, 0.8f, |
| 679 | 0.0f, 0.75f, 0.72f, |
| 680 | 0.0f, 0.6f, 0.5f, |
| 681 | 0.0f, 0.93f, 0.95f, |
| 682 | 0.0f, 0.5f, 0.4f, |
| 683 | 0.0f, 0.3f, 0.2f |
| 684 | }); |
| 685 | std::vector<float> anchors({ |
| 686 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 687 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 688 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 689 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 690 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 691 | 0.5f, 100.5f, 1.0f, 1.0f |
| 692 | }); |
| 693 | |
| 694 | std::vector<uint8_t> qBoxEncodings(boxEncodings.size(), 0); |
| 695 | std::vector<uint8_t> qScores(scores.size(), 0); |
| 696 | std::vector<uint8_t> qAnchors(anchors.size(), 0); |
| 697 | QuantizeData(qBoxEncodings.data(), boxEncodings.data(), boxEncodingsInfo); |
| 698 | QuantizeData(qScores.data(), scores.data(), scoresInfo); |
| 699 | QuantizeData(qAnchors.data(), anchors.data(), anchorsInfo); |
| 700 | DetectionPostProcessRegularNmsEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, qBoxEncodings, |
| 701 | qScores, qAnchors, |
| 702 | 1.0f, 1, 0.01f, 0, 0.5f, 0); |
| 703 | } |
| 704 | |
| 705 | BOOST_AUTO_TEST_CASE(RefDetectionPostProcessFastNmsTest) |
| 706 | { |
| 707 | std::vector<float> boxEncodings({ |
| 708 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 709 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 710 | 0.0f, -1.0f, 0.0f, 0.0f, |
| 711 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 712 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 713 | 0.0f, 0.0f, 0.0f, 0.0f |
| 714 | }); |
| 715 | std::vector<float> scores({ |
| 716 | 0.0f, 0.9f, 0.8f, |
| 717 | 0.0f, 0.75f, 0.72f, |
| 718 | 0.0f, 0.6f, 0.5f, |
| 719 | 0.0f, 0.93f, 0.95f, |
| 720 | 0.0f, 0.5f, 0.4f, |
| 721 | 0.0f, 0.3f, 0.2f |
| 722 | }); |
| 723 | std::vector<float> anchors({ |
| 724 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 725 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 726 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 727 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 728 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 729 | 0.5f, 100.5f, 1.0f, 1.0f |
| 730 | }); |
| 731 | DetectionPostProcessFastNmsEndToEnd<armnn::DataType::Float32>(defaultBackends, boxEncodings, scores, anchors); |
| 732 | } |
| 733 | |
| 734 | BOOST_AUTO_TEST_CASE(RefDetectionPostProcessFastNmsUint8Test) |
| 735 | { |
| 736 | armnn::TensorInfo boxEncodingsInfo({ 1, 6, 4 }, armnn::DataType::Float32); |
| 737 | armnn::TensorInfo scoresInfo({ 1, 6, 3 }, armnn::DataType::Float32); |
| 738 | armnn::TensorInfo anchorsInfo({ 6, 4 }, armnn::DataType::Float32); |
| 739 | |
| 740 | boxEncodingsInfo.SetQuantizationScale(1.0f); |
| 741 | boxEncodingsInfo.SetQuantizationOffset(1); |
| 742 | scoresInfo.SetQuantizationScale(0.01f); |
| 743 | scoresInfo.SetQuantizationOffset(0); |
| 744 | anchorsInfo.SetQuantizationScale(0.5f); |
| 745 | anchorsInfo.SetQuantizationOffset(0); |
| 746 | |
| 747 | std::vector<float> boxEncodings({ |
| 748 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 749 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 750 | 0.0f, -1.0f, 0.0f, 0.0f, |
| 751 | 0.0f, 0.0f, 0.0f, 0.0f, |
| 752 | 0.0f, 1.0f, 0.0f, 0.0f, |
| 753 | 0.0f, 0.0f, 0.0f, 0.0f |
| 754 | }); |
| 755 | std::vector<float> scores({ |
| 756 | 0.0f, 0.9f, 0.8f, |
| 757 | 0.0f, 0.75f, 0.72f, |
| 758 | 0.0f, 0.6f, 0.5f, |
| 759 | 0.0f, 0.93f, 0.95f, |
| 760 | 0.0f, 0.5f, 0.4f, |
| 761 | 0.0f, 0.3f, 0.2f |
| 762 | }); |
| 763 | std::vector<float> anchors({ |
| 764 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 765 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 766 | 0.5f, 0.5f, 1.0f, 1.0f, |
| 767 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 768 | 0.5f, 10.5f, 1.0f, 1.0f, |
| 769 | 0.5f, 100.5f, 1.0f, 1.0f |
| 770 | }); |
| 771 | |
| 772 | std::vector<uint8_t> qBoxEncodings(boxEncodings.size(), 0); |
| 773 | std::vector<uint8_t> qScores(scores.size(), 0); |
| 774 | std::vector<uint8_t> qAnchors(anchors.size(), 0); |
| 775 | QuantizeData(qBoxEncodings.data(), boxEncodings.data(), boxEncodingsInfo); |
| 776 | QuantizeData(qScores.data(), scores.data(), scoresInfo); |
| 777 | QuantizeData(qAnchors.data(), anchors.data(), anchorsInfo); |
| 778 | DetectionPostProcessFastNmsEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, qBoxEncodings, |
| 779 | qScores, qAnchors, |
| 780 | 1.0f, 1, 0.01f, 0, 0.5f, 0); |
| 781 | } |
| 782 | |
Sadik Armagan | 20bea00 | 2019-10-16 09:29:38 +0100 | [diff] [blame] | 783 | // LogSoftmax |
| 784 | BOOST_AUTO_TEST_CASE(RefLogSoftmaxEndToEndTest) |
| 785 | { |
| 786 | LogSoftmaxEndToEndTest(defaultBackends); |
| 787 | } |
| 788 | |
Nikhil Raj | 747f586 | 2019-07-19 15:15:23 +0100 | [diff] [blame] | 789 | BOOST_AUTO_TEST_CASE(RefPreluEndToEndTestFloat32) |
| 790 | { |
| 791 | PreluEndToEndNegativeTest<armnn::DataType::Float32>(defaultBackends); |
| 792 | } |
| 793 | |
| 794 | BOOST_AUTO_TEST_CASE(RefPreluEndToEndTestUint8) |
| 795 | { |
| 796 | PreluEndToEndPositiveTest<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 797 | } |
| 798 | |
| 799 | BOOST_AUTO_TEST_CASE(RefPreluEndToEndTestQSymm16) |
| 800 | { |
| 801 | PreluEndToEndPositiveTest<armnn::DataType::QuantisedSymm16>(defaultBackends); |
| 802 | } |
| 803 | |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 804 | BOOST_AUTO_TEST_CASE(RefSpaceToDepthNhwcEndToEndTest1) |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 805 | { |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 806 | SpaceToDepthNhwcEndToEndTest1(defaultBackends); |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 807 | } |
| 808 | |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 809 | BOOST_AUTO_TEST_CASE(RefSpaceToDepthNchwEndToEndTest1) |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 810 | { |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 811 | SpaceToDepthNchwEndToEndTest1(defaultBackends); |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 812 | |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 813 | } |
| 814 | |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 815 | BOOST_AUTO_TEST_CASE(RefSpaceToDepthNhwcEndToEndTest2) |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 816 | { |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 817 | SpaceToDepthNhwcEndToEndTest2(defaultBackends); |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 818 | } |
| 819 | |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 820 | BOOST_AUTO_TEST_CASE(RefSpaceToDepthNchwEndToEndTest2) |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 821 | { |
Aron Virginas-Tar | f97f6da | 2019-10-01 18:35:44 +0100 | [diff] [blame] | 822 | SpaceToDepthNchwEndToEndTest2(defaultBackends); |
Keith Davis | 9515c7e | 2019-06-21 09:33:59 +0100 | [diff] [blame] | 823 | } |
| 824 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 825 | BOOST_AUTO_TEST_CASE(RefSplitter1dEndToEndTest) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 826 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 827 | Splitter1dEndToEnd<armnn::DataType::Float32>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 828 | } |
| 829 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 830 | BOOST_AUTO_TEST_CASE(RefSplitter1dEndToEndUint8Test) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 831 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 832 | Splitter1dEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 833 | } |
| 834 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 835 | BOOST_AUTO_TEST_CASE(RefSplitter2dDim0EndToEndTest) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 836 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 837 | Splitter2dDim0EndToEnd<armnn::DataType::Float32>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 838 | } |
| 839 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 840 | BOOST_AUTO_TEST_CASE(RefSplitter2dDim1EndToEndTest) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 841 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 842 | Splitter2dDim1EndToEnd<armnn::DataType::Float32>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 843 | } |
| 844 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 845 | BOOST_AUTO_TEST_CASE(RefSplitter2dDim0EndToEndUint8Test) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 846 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 847 | Splitter2dDim0EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 848 | } |
| 849 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 850 | BOOST_AUTO_TEST_CASE(RefSplitter2dDim1EndToEndUint8Test) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 851 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 852 | Splitter2dDim1EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 853 | } |
| 854 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 855 | BOOST_AUTO_TEST_CASE(RefSplitter3dDim0EndToEndTest) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 856 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 857 | Splitter3dDim0EndToEnd<armnn::DataType::Float32>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 858 | } |
| 859 | |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 860 | BOOST_AUTO_TEST_CASE(RefSplitter3dDim1EndToEndTest) |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 861 | { |
Narumol Prangnawarat | 0f072ab | 2019-05-29 14:12:46 +0100 | [diff] [blame] | 862 | Splitter3dDim1EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 863 | } |
| 864 | |
| 865 | BOOST_AUTO_TEST_CASE(RefSplitter3dDim2EndToEndTest) |
| 866 | { |
| 867 | Splitter3dDim2EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 868 | } |
| 869 | |
| 870 | BOOST_AUTO_TEST_CASE(RefSplitter3dDim0EndToEndUint8Test) |
| 871 | { |
| 872 | Splitter3dDim0EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 873 | } |
| 874 | |
| 875 | BOOST_AUTO_TEST_CASE(RefSplitter3dDim1EndToEndUint8Test) |
| 876 | { |
| 877 | Splitter3dDim1EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 878 | } |
| 879 | |
| 880 | BOOST_AUTO_TEST_CASE(RefSplitter3dDim2EndToEndUint8Test) |
| 881 | { |
| 882 | Splitter3dDim2EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 883 | } |
| 884 | |
| 885 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim0EndToEndTest) |
| 886 | { |
| 887 | Splitter4dDim0EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 888 | } |
| 889 | |
| 890 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim1EndToEndTest) |
| 891 | { |
| 892 | Splitter4dDim1EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 893 | } |
| 894 | |
| 895 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim2EndToEndTest) |
| 896 | { |
| 897 | Splitter4dDim2EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 898 | } |
| 899 | |
| 900 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim3EndToEndTest) |
| 901 | { |
| 902 | Splitter4dDim3EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 903 | } |
| 904 | |
| 905 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim0EndToEndUint8Test) |
| 906 | { |
| 907 | Splitter4dDim0EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 908 | } |
| 909 | |
| 910 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim1EndToEndUint8Test) |
| 911 | { |
| 912 | Splitter4dDim1EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 913 | } |
| 914 | |
| 915 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim2EndToEndUint8Test) |
| 916 | { |
| 917 | Splitter4dDim2EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 918 | } |
| 919 | |
| 920 | BOOST_AUTO_TEST_CASE(RefSplitter4dDim3EndToEndUint8Test) |
| 921 | { |
| 922 | Splitter4dDim3EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
Narumol Prangnawarat | 0be4338 | 2019-05-27 11:29:59 +0100 | [diff] [blame] | 923 | } |
| 924 | |
Aron Virginas-Tar | 98180ef | 2019-06-26 15:02:47 +0100 | [diff] [blame] | 925 | // TransposeConvolution2d |
| 926 | BOOST_AUTO_TEST_CASE(RefTransposeConvolution2dEndToEndFloatNchwTest) |
| 927 | { |
| 928 | TransposeConvolution2dEndToEnd<armnn::DataType::Float32, armnn::DataType::Float32>( |
| 929 | defaultBackends, armnn::DataLayout::NCHW); |
| 930 | } |
| 931 | |
| 932 | BOOST_AUTO_TEST_CASE(RefTransposeConvolution2dEndToEndUint8NchwTest) |
| 933 | { |
| 934 | TransposeConvolution2dEndToEnd<armnn::DataType::QuantisedAsymm8, armnn::DataType::Signed32>( |
| 935 | defaultBackends, armnn::DataLayout::NCHW); |
| 936 | } |
| 937 | |
| 938 | BOOST_AUTO_TEST_CASE(RefTransposeConvolution2dEndToEndInt16NchwTest) |
| 939 | { |
| 940 | TransposeConvolution2dEndToEnd<armnn::DataType::QuantisedSymm16, armnn::DataType::Signed32>( |
| 941 | defaultBackends, armnn::DataLayout::NCHW); |
| 942 | } |
| 943 | |
| 944 | BOOST_AUTO_TEST_CASE(RefTransposeConvolution2dEndToEndFloatNhwcTest) |
| 945 | { |
| 946 | TransposeConvolution2dEndToEnd<armnn::DataType::Float32, armnn::DataType::Float32>( |
| 947 | defaultBackends, armnn::DataLayout::NHWC); |
| 948 | } |
| 949 | |
| 950 | BOOST_AUTO_TEST_CASE(RefTransposeConvolution2dEndToEndUint8NhwcTest) |
| 951 | { |
| 952 | TransposeConvolution2dEndToEnd<armnn::DataType::QuantisedAsymm8, armnn::DataType::Signed32>( |
| 953 | defaultBackends, armnn::DataLayout::NHWC); |
| 954 | } |
| 955 | |
| 956 | BOOST_AUTO_TEST_CASE(RefTransposeConvolution2dEndToEndInt16NhwcTest) |
| 957 | { |
| 958 | TransposeConvolution2dEndToEnd<armnn::DataType::QuantisedSymm16, armnn::DataType::Signed32>( |
| 959 | defaultBackends, armnn::DataLayout::NHWC); |
| 960 | } |
| 961 | |
Aron Virginas-Tar | fe15eff | 2019-07-01 16:12:58 +0100 | [diff] [blame] | 962 | // Resize Bilinear |
| 963 | BOOST_AUTO_TEST_CASE(RefResizeBilinearEndToEndFloatNchwTest) |
| 964 | { |
| 965 | ResizeBilinearEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NCHW); |
| 966 | } |
| 967 | |
| 968 | BOOST_AUTO_TEST_CASE(RefResizeBilinearEndToEndUint8NchwTest) |
| 969 | { |
| 970 | ResizeBilinearEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NCHW); |
| 971 | } |
| 972 | |
| 973 | BOOST_AUTO_TEST_CASE(RefResizeBilinearEndToEndInt16NchwTest) |
| 974 | { |
| 975 | ResizeBilinearEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NCHW); |
| 976 | } |
| 977 | |
| 978 | BOOST_AUTO_TEST_CASE(RefResizeBilinearEndToEndFloatNhwcTest) |
| 979 | { |
| 980 | ResizeBilinearEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NHWC); |
| 981 | } |
| 982 | |
| 983 | BOOST_AUTO_TEST_CASE(RefResizeBilinearEndToEndUint8NhwcTest) |
| 984 | { |
| 985 | ResizeBilinearEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NHWC); |
| 986 | } |
| 987 | |
| 988 | BOOST_AUTO_TEST_CASE(RefResizeBilinearEndToEndInt16NhwcTest) |
| 989 | { |
| 990 | ResizeBilinearEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NHWC); |
| 991 | } |
| 992 | |
| 993 | // Resize NearestNeighbor |
| 994 | BOOST_AUTO_TEST_CASE(RefResizeNearestNeighborEndToEndFloatNchwTest) |
| 995 | { |
| 996 | ResizeNearestNeighborEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NCHW); |
| 997 | } |
| 998 | |
| 999 | BOOST_AUTO_TEST_CASE(RefResizeNearestNeighborEndToEndUint8NchwTest) |
| 1000 | { |
| 1001 | ResizeNearestNeighborEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NCHW); |
| 1002 | } |
| 1003 | |
| 1004 | BOOST_AUTO_TEST_CASE(RefResizeNearestNeighborEndToEndInt16NchwTest) |
| 1005 | { |
| 1006 | ResizeNearestNeighborEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NCHW); |
| 1007 | } |
| 1008 | |
| 1009 | BOOST_AUTO_TEST_CASE(RefResizeNearestNeighborEndToEndFloatNhwcTest) |
| 1010 | { |
| 1011 | ResizeNearestNeighborEndToEnd<armnn::DataType::Float32>(defaultBackends, armnn::DataLayout::NHWC); |
| 1012 | } |
| 1013 | |
| 1014 | BOOST_AUTO_TEST_CASE(RefResizeNearestNeighborEndToEndUint8NhwcTest) |
| 1015 | { |
| 1016 | ResizeNearestNeighborEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends, armnn::DataLayout::NHWC); |
| 1017 | } |
| 1018 | |
| 1019 | BOOST_AUTO_TEST_CASE(RefResizeNearestNeighborEndToEndInt16NhwcTest) |
| 1020 | { |
| 1021 | ResizeNearestNeighborEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends, armnn::DataLayout::NHWC); |
| 1022 | } |
| 1023 | |
Sadik Armagan | 062e0e9 | 2019-10-14 10:31:43 +0100 | [diff] [blame] | 1024 | // InstanceNormalization |
| 1025 | BOOST_AUTO_TEST_CASE(RefInstanceNormalizationNhwcEndToEndTest1) |
| 1026 | { |
| 1027 | InstanceNormalizationNhwcEndToEndTest1(defaultBackends); |
| 1028 | } |
| 1029 | |
| 1030 | BOOST_AUTO_TEST_CASE(RefInstanceNormalizationNchwEndToEndTest1) |
| 1031 | { |
| 1032 | InstanceNormalizationNchwEndToEndTest1(defaultBackends); |
| 1033 | } |
| 1034 | |
| 1035 | BOOST_AUTO_TEST_CASE(RefInstanceNormalizationNhwcEndToEndTest2) |
| 1036 | { |
| 1037 | InstanceNormalizationNhwcEndToEndTest2(defaultBackends); |
| 1038 | } |
| 1039 | |
| 1040 | BOOST_AUTO_TEST_CASE(RefInstanceNormalizationNchwEndToEndTest2) |
| 1041 | { |
| 1042 | InstanceNormalizationNchwEndToEndTest2(defaultBackends); |
| 1043 | } |
| 1044 | |
Narumol Prangnawarat | d1f5773 | 2019-10-31 14:24:02 +0000 | [diff] [blame] | 1045 | // ArgMinMax |
| 1046 | BOOST_AUTO_TEST_CASE(RefArgMaxSimpleTest) |
| 1047 | { |
| 1048 | ArgMaxEndToEndSimple<armnn::DataType::Float32>(defaultBackends); |
| 1049 | } |
| 1050 | |
| 1051 | BOOST_AUTO_TEST_CASE(RefArgMaxSimpleUint8Test) |
| 1052 | { |
| 1053 | ArgMaxEndToEndSimple<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1054 | } |
| 1055 | |
| 1056 | BOOST_AUTO_TEST_CASE(RefArgMinSimpleTest) |
| 1057 | { |
| 1058 | ArgMinEndToEndSimple<armnn::DataType::Float32>(defaultBackends); |
| 1059 | } |
| 1060 | |
| 1061 | BOOST_AUTO_TEST_CASE(RefArgMinSimpleUint8Test) |
| 1062 | { |
| 1063 | ArgMinEndToEndSimple<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1064 | } |
| 1065 | |
| 1066 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis0Test) |
| 1067 | { |
| 1068 | ArgMaxAxis0EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1069 | } |
| 1070 | |
| 1071 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis0Uint8Test) |
| 1072 | { |
| 1073 | ArgMaxAxis0EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1074 | } |
| 1075 | |
| 1076 | BOOST_AUTO_TEST_CASE(RefArgMinAxis0Test) |
| 1077 | { |
| 1078 | ArgMinAxis0EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1079 | } |
| 1080 | |
| 1081 | BOOST_AUTO_TEST_CASE(RefArgMinAxis0Uint8Test) |
| 1082 | { |
| 1083 | |
| 1084 | ArgMinAxis0EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1085 | } |
| 1086 | |
| 1087 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis1Test) |
| 1088 | { |
| 1089 | ArgMaxAxis1EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1090 | } |
| 1091 | |
| 1092 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis1Uint8Test) |
| 1093 | { |
| 1094 | ArgMaxAxis1EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1095 | } |
| 1096 | |
| 1097 | BOOST_AUTO_TEST_CASE(RefArgMinAxis1Test) |
| 1098 | { |
| 1099 | ArgMinAxis1EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1100 | } |
| 1101 | |
| 1102 | BOOST_AUTO_TEST_CASE(RefArgMinAxis1Uint8Test) |
| 1103 | { |
| 1104 | |
| 1105 | ArgMinAxis1EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1106 | } |
| 1107 | |
| 1108 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis2Test) |
| 1109 | { |
| 1110 | ArgMaxAxis2EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1111 | } |
| 1112 | |
| 1113 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis2Uint8Test) |
| 1114 | { |
| 1115 | ArgMaxAxis2EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1116 | } |
| 1117 | |
| 1118 | BOOST_AUTO_TEST_CASE(RefArgMinAxis2Test) |
| 1119 | { |
| 1120 | ArgMinAxis2EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1121 | } |
| 1122 | |
| 1123 | BOOST_AUTO_TEST_CASE(RefArgMinAxis2Uint8Test) |
| 1124 | { |
| 1125 | |
| 1126 | ArgMinAxis2EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1127 | } |
| 1128 | |
| 1129 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis3Test) |
| 1130 | { |
| 1131 | ArgMaxAxis3EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1132 | } |
| 1133 | |
| 1134 | BOOST_AUTO_TEST_CASE(RefArgMaxAxis3Uint8Test) |
| 1135 | { |
| 1136 | ArgMaxAxis3EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1137 | } |
| 1138 | |
| 1139 | BOOST_AUTO_TEST_CASE(RefArgMinAxis3Test) |
| 1140 | { |
| 1141 | ArgMinAxis3EndToEnd<armnn::DataType::Float32>(defaultBackends); |
| 1142 | } |
| 1143 | |
| 1144 | BOOST_AUTO_TEST_CASE(RefArgMinAxis3Uint8Test) |
| 1145 | { |
| 1146 | |
| 1147 | ArgMinAxis3EndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); |
| 1148 | } |
| 1149 | |
Ferran Balaguer | dcaa610 | 2019-08-21 13:28:38 +0100 | [diff] [blame] | 1150 | #if !defined(__ANDROID__) |
| 1151 | // Only run these tests on non Android platforms |
| 1152 | BOOST_AUTO_TEST_CASE(RefImportNonAlignedPointerTest) |
| 1153 | { |
David Monahan | 4f1e8e4 | 2019-09-04 09:22:10 +0100 | [diff] [blame] | 1154 | ImportNonAlignedInputPointerTest(defaultBackends); |
| 1155 | } |
| 1156 | |
| 1157 | BOOST_AUTO_TEST_CASE(RefExportNonAlignedPointerTest) |
| 1158 | { |
Ferran Balaguer | 83239f9 | 2019-09-19 11:49:25 +0100 | [diff] [blame] | 1159 | ExportNonAlignedOutputPointerTest(defaultBackends); |
Ferran Balaguer | dcaa610 | 2019-08-21 13:28:38 +0100 | [diff] [blame] | 1160 | } |
| 1161 | |
| 1162 | BOOST_AUTO_TEST_CASE(RefImportAlignedPointerTest) |
| 1163 | { |
| 1164 | ImportAlignedPointerTest(defaultBackends); |
| 1165 | } |
| 1166 | |
Ferran Balaguer | 83239f9 | 2019-09-19 11:49:25 +0100 | [diff] [blame] | 1167 | BOOST_AUTO_TEST_CASE(RefImportOnlyWorkload) |
| 1168 | { |
| 1169 | ImportOnlyWorkload(defaultBackends); |
| 1170 | } |
| 1171 | |
| 1172 | BOOST_AUTO_TEST_CASE(RefExportOnlyWorkload) |
| 1173 | { |
| 1174 | ExportOnlyWorkload(defaultBackends); |
| 1175 | } |
| 1176 | |
| 1177 | BOOST_AUTO_TEST_CASE(RefImportAndExportWorkload) |
| 1178 | { |
| 1179 | ImportAndExportWorkload(defaultBackends); |
| 1180 | } |
| 1181 | |
| 1182 | BOOST_AUTO_TEST_CASE(RefExportOutputWithSeveralOutputSlotConnectionsTest) |
| 1183 | { |
| 1184 | ExportOutputWithSeveralOutputSlotConnectionsTest(defaultBackends); |
| 1185 | } |
| 1186 | |
Ferran Balaguer | dcaa610 | 2019-08-21 13:28:38 +0100 | [diff] [blame] | 1187 | #endif |
| 1188 | |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1189 | BOOST_AUTO_TEST_SUITE_END() |