Matthew Sloyan | 2e5d0b2 | 2021-10-21 14:05:31 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2021 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "MirrorPadTestImpl.hpp" |
| 7 | |
| 8 | #include <QuantizeHelper.hpp> |
| 9 | |
Sadik Armagan | a097d2a | 2021-11-24 15:47:28 +0000 | [diff] [blame] | 10 | #include <armnnTestUtils/TensorCopyUtils.hpp> |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 11 | #include <armnnTestUtils/WorkloadTestUtils.hpp> |
Matthew Sloyan | 2e5d0b2 | 2021-10-21 14:05:31 +0100 | [diff] [blame] | 12 | |
Sadik Armagan | a097d2a | 2021-11-24 15:47:28 +0000 | [diff] [blame] | 13 | #include <TensorHelpers.hpp> |
Matthew Sloyan | 2e5d0b2 | 2021-10-21 14:05:31 +0100 | [diff] [blame] | 14 | |
| 15 | // |
| 16 | // Implementation templates |
| 17 | // |
| 18 | |
| 19 | template<typename T> |
| 20 | LayerTestResult<T, 2> MirrorPad2dTestCommon( |
| 21 | armnn::IWorkloadFactory& workloadFactory, |
| 22 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 23 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 24 | const armnn::TensorInfo& inputTensorInfo, |
| 25 | const armnn::TensorInfo& outputTensorInfo, |
| 26 | const std::vector<T>& inputValues, |
| 27 | const std::vector<T>& expectedOutputValues, |
| 28 | const std::vector<std::pair<unsigned int, unsigned int>>& padList, |
| 29 | const armnn::PaddingMode paddingMode) |
| 30 | { |
| 31 | IgnoreUnused(memoryManager); |
| 32 | std::vector<T> actualOutput(outputTensorInfo.GetNumElements()); |
| 33 | |
| 34 | std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); |
| 35 | std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); |
| 36 | |
| 37 | armnn::PadQueueDescriptor descriptor; |
| 38 | |
| 39 | descriptor.m_Parameters.m_PadList = padList; |
| 40 | descriptor.m_Parameters.m_PaddingMode = paddingMode; |
| 41 | armnn::WorkloadInfo info; |
| 42 | |
| 43 | AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); |
| 44 | AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); |
| 45 | |
| 46 | std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreatePad(descriptor, info); |
| 47 | |
| 48 | inputHandle->Allocate(); |
| 49 | outputHandle->Allocate(); |
| 50 | |
| 51 | CopyDataToITensorHandle(inputHandle.get(), inputValues.data()); |
| 52 | |
| 53 | ExecuteWorkload(*workload, memoryManager); |
| 54 | |
| 55 | CopyDataFromITensorHandle(actualOutput.data(), outputHandle.get()); |
| 56 | |
| 57 | return LayerTestResult<T, 2>(actualOutput, |
| 58 | expectedOutputValues, |
| 59 | outputHandle->GetShape(), |
| 60 | outputTensorInfo.GetShape()); |
| 61 | } |
| 62 | |
| 63 | template<typename T> |
| 64 | LayerTestResult<T, 3> MirrorPad3dTestCommon( |
| 65 | armnn::IWorkloadFactory& workloadFactory, |
| 66 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 67 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 68 | const armnn::TensorInfo& inputTensorInfo, |
| 69 | const armnn::TensorInfo& outputTensorInfo, |
| 70 | const std::vector<T>& inputValues, |
| 71 | const std::vector<T>& expectedOutputValues, |
| 72 | const std::vector<std::pair<unsigned int, unsigned int>>& padList, |
| 73 | const armnn::PaddingMode paddingMode) |
| 74 | { |
| 75 | IgnoreUnused(memoryManager); |
| 76 | std::vector<T> actualOutput(outputTensorInfo.GetNumElements()); |
| 77 | |
| 78 | std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); |
| 79 | std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); |
| 80 | |
| 81 | armnn::PadQueueDescriptor descriptor; |
| 82 | descriptor.m_Parameters.m_PadList = padList; |
| 83 | descriptor.m_Parameters.m_PaddingMode = paddingMode; |
| 84 | |
| 85 | armnn::WorkloadInfo info; |
| 86 | AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); |
| 87 | AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); |
| 88 | |
| 89 | std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreatePad(descriptor, info); |
| 90 | |
| 91 | inputHandle->Allocate(); |
| 92 | outputHandle->Allocate(); |
| 93 | |
| 94 | CopyDataToITensorHandle(inputHandle.get(), inputValues.data()); |
| 95 | |
| 96 | ExecuteWorkload(*workload, memoryManager); |
| 97 | |
| 98 | CopyDataFromITensorHandle(actualOutput.data(), outputHandle.get()); |
| 99 | |
| 100 | return LayerTestResult<T, 3>(actualOutput, |
| 101 | expectedOutputValues, |
| 102 | outputHandle->GetShape(), |
| 103 | outputTensorInfo.GetShape()); |
| 104 | } |
| 105 | |
| 106 | template<typename T> |
| 107 | LayerTestResult<T, 4> MirrorPad4dTestCommon( |
| 108 | armnn::IWorkloadFactory& workloadFactory, |
| 109 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 110 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 111 | const armnn::TensorInfo& inputTensorInfo, |
| 112 | const armnn::TensorInfo& outputTensorInfo, |
| 113 | const std::vector<T>& inputValues, |
| 114 | const std::vector<T>& expectedOutputValues, |
| 115 | const std::vector<std::pair<unsigned int, unsigned int>>& padList, |
| 116 | const armnn::PaddingMode paddingMode) |
| 117 | { |
| 118 | IgnoreUnused(memoryManager); |
| 119 | std::vector<T> actualOutput(outputTensorInfo.GetNumElements()); |
| 120 | |
| 121 | std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); |
| 122 | std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); |
| 123 | |
| 124 | armnn::PadQueueDescriptor descriptor; |
| 125 | descriptor.m_Parameters.m_PadList = padList; |
| 126 | descriptor.m_Parameters.m_PaddingMode = paddingMode; |
| 127 | |
| 128 | armnn::WorkloadInfo info; |
| 129 | AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); |
| 130 | AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); |
| 131 | |
| 132 | std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreatePad(descriptor, info); |
| 133 | |
| 134 | inputHandle->Allocate(); |
| 135 | outputHandle->Allocate(); |
| 136 | |
| 137 | CopyDataToITensorHandle(inputHandle.get(), inputValues.data()); |
| 138 | |
| 139 | ExecuteWorkload(*workload, memoryManager); |
| 140 | |
| 141 | CopyDataFromITensorHandle(actualOutput.data(), outputHandle.get()); |
| 142 | |
| 143 | return LayerTestResult<T, 4>(actualOutput, |
| 144 | expectedOutputValues, |
| 145 | outputHandle->GetShape(), |
| 146 | outputTensorInfo.GetShape()); |
| 147 | } |
| 148 | |
| 149 | template<armnn::DataType ArmnnType, |
| 150 | typename T = armnn::ResolveType<ArmnnType>> |
| 151 | LayerTestResult<T, 2> PadSymmetric2dTest( |
| 152 | armnn::IWorkloadFactory& workloadFactory, |
| 153 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 154 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 155 | float qScale, |
| 156 | int32_t qOffset) |
| 157 | { |
| 158 | const armnn::TensorShape inputShape{ 3, 3 }; |
| 159 | const armnn::TensorShape outputShape{ 7, 7 }; |
| 160 | |
| 161 | const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset); |
| 162 | const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset); |
| 163 | |
| 164 | std::vector<T> inputValues = armnnUtils::QuantizedVector<T>( |
| 165 | { |
| 166 | // Height (3) x Width (3) |
| 167 | 1, 2, 3, |
| 168 | 4, 5, 6, |
| 169 | 7, 8, 9 |
| 170 | }, |
| 171 | qScale, qOffset); |
| 172 | |
| 173 | std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>( |
| 174 | { |
| 175 | 5, 4, 4, 5, 6, 6, 5, |
| 176 | 2, 1, 1, 2, 3, 3, 2, |
| 177 | 2, 1, 1, 2, 3, 3, 2, |
| 178 | 5, 4, 4, 5, 6, 6, 5, |
| 179 | 8, 7, 7, 8, 9, 9, 8, |
| 180 | 8, 7, 7, 8, 9, 9, 8, |
| 181 | 5, 4, 4, 5, 6, 6, 5 |
| 182 | }, |
| 183 | qScale, qOffset); |
| 184 | |
| 185 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 186 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 187 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 188 | |
| 189 | return MirrorPad2dTestCommon<T>(workloadFactory, |
| 190 | memoryManager, |
| 191 | tensorHandleFactory, |
| 192 | inputTensorInfo, |
| 193 | outputTensorInfo, |
| 194 | inputValues, |
| 195 | expectedOutputValues, |
| 196 | padList, |
| 197 | armnn::PaddingMode::Symmetric); |
| 198 | } |
| 199 | |
| 200 | template<armnn::DataType ArmnnType, |
| 201 | typename T = armnn::ResolveType<ArmnnType>> |
| 202 | LayerTestResult<T, 2> PadReflect2dTest( |
| 203 | armnn::IWorkloadFactory& workloadFactory, |
| 204 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 205 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 206 | float qScale, |
| 207 | int32_t qOffset) |
| 208 | { |
| 209 | const armnn::TensorShape inputShape{ 3, 3 }; |
| 210 | const armnn::TensorShape outputShape{ 7, 7 }; |
| 211 | |
| 212 | const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset); |
| 213 | const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset); |
| 214 | |
| 215 | std::vector<T> inputValues = armnnUtils::QuantizedVector<T>( |
| 216 | { |
| 217 | // Height (3) x Width (3) |
| 218 | 1, 2, 3, |
| 219 | 4, 5, 6, |
| 220 | 7, 8, 9 |
| 221 | }, |
| 222 | qScale, qOffset); |
| 223 | |
| 224 | std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>( |
| 225 | { |
| 226 | 9, 8, 7, 8, 9, 8, 7, |
| 227 | 6, 5, 4, 5, 6, 5, 4, |
| 228 | 3, 2, 1, 2, 3, 2, 1, |
| 229 | 6, 5, 4, 5, 6, 5, 4, |
| 230 | 9, 8, 7, 8, 9, 8, 7, |
| 231 | 6, 5, 4, 5, 6, 5, 4, |
| 232 | 3, 2, 1, 2, 3, 2, 1 |
| 233 | }, |
| 234 | qScale, qOffset); |
| 235 | |
| 236 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 237 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 238 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 239 | |
| 240 | return MirrorPad2dTestCommon<T>(workloadFactory, |
| 241 | memoryManager, |
| 242 | tensorHandleFactory, |
| 243 | inputTensorInfo, |
| 244 | outputTensorInfo, |
| 245 | inputValues, |
| 246 | expectedOutputValues, |
| 247 | padList, |
| 248 | armnn::PaddingMode::Reflect); |
| 249 | } |
| 250 | |
| 251 | template<armnn::DataType ArmnnType, |
| 252 | typename T = armnn::ResolveType<ArmnnType>> |
| 253 | LayerTestResult<T, 3> PadSymmetric3dTest( |
| 254 | armnn::IWorkloadFactory& workloadFactory, |
| 255 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 256 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 257 | float qScale, |
| 258 | int32_t qOffset) |
| 259 | { |
| 260 | const armnn::TensorShape inputShape{ 2, 2, 2 }; |
| 261 | const armnn::TensorShape outputShape{ 4, 4, 4 }; |
| 262 | |
| 263 | const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset); |
| 264 | const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset); |
| 265 | |
| 266 | std::vector<T> inputValues = armnnUtils::QuantizedVector<T>( |
| 267 | { |
| 268 | // Channel 0, Height (2) x Width (2) |
| 269 | 1, 2, |
| 270 | 3, 4, |
| 271 | |
| 272 | // Channel 1, Height (2) x Width (2) |
| 273 | 5, 6, |
| 274 | 7, 8 |
| 275 | }, |
| 276 | qScale, qOffset); |
| 277 | |
| 278 | std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>( |
| 279 | { |
| 280 | 1, 1, 2, 2, |
| 281 | 1, 1, 2, 2, |
| 282 | 3, 3, 4, 4, |
| 283 | 3, 3, 4, 4, |
| 284 | |
| 285 | 1, 1, 2, 2, |
| 286 | 1, 1, 2, 2, |
| 287 | 3, 3, 4, 4, |
| 288 | 3, 3, 4, 4, |
| 289 | |
| 290 | 5, 5, 6, 6, |
| 291 | 5, 5, 6, 6, |
| 292 | 7, 7, 8, 8, |
| 293 | 7, 7, 8, 8, |
| 294 | |
| 295 | 5, 5, 6, 6, |
| 296 | 5, 5, 6, 6, |
| 297 | 7, 7, 8, 8, |
| 298 | 7, 7, 8, 8 |
| 299 | }, |
| 300 | qScale, qOffset); |
| 301 | |
| 302 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 303 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 304 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 305 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 306 | |
| 307 | return MirrorPad3dTestCommon<T>(workloadFactory, |
| 308 | memoryManager, |
| 309 | tensorHandleFactory, |
| 310 | inputTensorInfo, |
| 311 | outputTensorInfo, |
| 312 | inputValues, |
| 313 | expectedOutputValues, |
| 314 | padList, |
| 315 | armnn::PaddingMode::Symmetric); |
| 316 | } |
| 317 | |
| 318 | template<armnn::DataType ArmnnType, |
| 319 | typename T = armnn::ResolveType<ArmnnType>> |
| 320 | LayerTestResult<T, 3> PadReflect3dTest( |
| 321 | armnn::IWorkloadFactory& workloadFactory, |
| 322 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 323 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 324 | float qScale, |
| 325 | int32_t qOffset) |
| 326 | { |
| 327 | const armnn::TensorShape inputShape{ 2, 2, 2 }; |
| 328 | const armnn::TensorShape outputShape{ 4, 4, 4 }; |
| 329 | |
| 330 | const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset); |
| 331 | const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset); |
| 332 | |
| 333 | std::vector<T> inputValues = armnnUtils::QuantizedVector<T>( |
| 334 | { |
| 335 | // Channel 0, Height (2) x Width (2) |
| 336 | 1, 2, |
| 337 | 3, 4, |
| 338 | |
| 339 | // Channel 1, Height (2) x Width (2) |
| 340 | 5, 6, |
| 341 | 7, 8 |
| 342 | }, |
| 343 | qScale, qOffset); |
| 344 | |
| 345 | std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>( |
| 346 | { |
| 347 | 8, 7, 8, 7, |
| 348 | 6, 5, 6, 5, |
| 349 | 8, 7, 8, 7, |
| 350 | 6, 5, 6, 5, |
| 351 | |
| 352 | 4, 3, 4, 3, |
| 353 | 2, 1, 2, 1, |
| 354 | 4, 3, 4, 3, |
| 355 | 2, 1, 2, 1, |
| 356 | |
| 357 | 8, 7, 8, 7, |
| 358 | 6, 5, 6, 5, |
| 359 | 8, 7, 8, 7, |
| 360 | 6, 5, 6, 5, |
| 361 | |
| 362 | 4, 3, 4, 3, |
| 363 | 2, 1, 2, 1, |
| 364 | 4, 3, 4, 3, |
| 365 | 2, 1, 2, 1 |
| 366 | }, |
| 367 | qScale, qOffset); |
| 368 | |
| 369 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 370 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 371 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 372 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 373 | |
| 374 | return MirrorPad3dTestCommon<T>(workloadFactory, |
| 375 | memoryManager, |
| 376 | tensorHandleFactory, |
| 377 | inputTensorInfo, |
| 378 | outputTensorInfo, |
| 379 | inputValues, |
| 380 | expectedOutputValues, |
| 381 | padList, |
| 382 | armnn::PaddingMode::Reflect); |
| 383 | } |
| 384 | |
| 385 | template<armnn::DataType ArmnnType, |
| 386 | typename T = armnn::ResolveType<ArmnnType>> |
| 387 | LayerTestResult<T, 4> PadSymmetric4dTest( |
| 388 | armnn::IWorkloadFactory& workloadFactory, |
| 389 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 390 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 391 | float qScale, |
| 392 | int32_t qOffset) |
| 393 | { |
| 394 | const armnn::TensorShape inputShape{ 2, 2, 2, 2 }; |
| 395 | const armnn::TensorShape outputShape{ 6, 6, 6, 6 }; |
| 396 | |
| 397 | const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset); |
| 398 | const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset); |
| 399 | |
| 400 | std::vector<T> inputValues = armnnUtils::QuantizedVector<T>( |
| 401 | { |
| 402 | // Batch 0, Channel 0, Height (2) x Width (2) |
| 403 | 1, 2, |
| 404 | 3, 4, |
| 405 | |
| 406 | // Batch 0, Channel 1, Height (2) x Width (2) |
| 407 | 5, 6, |
| 408 | 7, 8, |
| 409 | |
| 410 | // Batch 1, Channel 0, Height (2) x Width (2) |
| 411 | 9, 10, |
| 412 | 11, 12, |
| 413 | |
| 414 | // Batch 1, Channel 1, Height (2) x Width (2) |
| 415 | 13, 14, |
| 416 | 15, 16, |
| 417 | }, |
| 418 | qScale, qOffset); |
| 419 | |
| 420 | std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>( |
| 421 | { |
| 422 | 16, 15, 15, 16, 16, 15, |
| 423 | 14, 13, 13, 14, 14, 13, |
| 424 | 14, 13, 13, 14, 14, 13, |
| 425 | 16, 15, 15, 16, 16, 15, |
| 426 | 16, 15, 15, 16, 16, 15, |
| 427 | 14, 13, 13, 14, 14, 13, |
| 428 | |
| 429 | 12, 11, 11, 12, 12, 11, |
| 430 | 10, 9, 9, 10, 10, 9, |
| 431 | 10, 9, 9, 10, 10, 9, |
| 432 | 12, 11, 11, 12, 12, 11, |
| 433 | 12, 11, 11, 12, 12, 11, |
| 434 | 10, 9, 9, 10, 10, 9, |
| 435 | |
| 436 | 12, 11, 11, 12, 12, 11, |
| 437 | 10, 9, 9, 10, 10, 9, |
| 438 | 10, 9, 9, 10, 10, 9, |
| 439 | 12, 11, 11, 12, 12, 11, |
| 440 | 12, 11, 11, 12, 12, 11, |
| 441 | 10, 9, 9, 10, 10, 9, |
| 442 | |
| 443 | 16, 15, 15, 16, 16, 15, |
| 444 | 14, 13, 13, 14, 14, 13, |
| 445 | 14, 13, 13, 14, 14, 13, |
| 446 | 16, 15, 15, 16, 16, 15, |
| 447 | 16, 15, 15, 16, 16, 15, |
| 448 | 14, 13, 13, 14, 14, 13, |
| 449 | |
| 450 | 16, 15, 15, 16, 16, 15, |
| 451 | 14, 13, 13, 14, 14, 13, |
| 452 | 14, 13, 13, 14, 14, 13, |
| 453 | 16, 15, 15, 16, 16, 15, |
| 454 | 16, 15, 15, 16, 16, 15, |
| 455 | 14, 13, 13, 14, 14, 13, |
| 456 | |
| 457 | 12, 11, 11, 12, 12, 11, |
| 458 | 10, 9, 9, 10, 10, 9, |
| 459 | 10, 9, 9, 10, 10, 9, |
| 460 | 12, 11, 11, 12, 12, 11, |
| 461 | 12, 11, 11, 12, 12, 11, |
| 462 | 10, 9, 9, 10, 10, 9, |
| 463 | |
| 464 | |
| 465 | 8, 7, 7, 8, 8, 7, |
| 466 | 6, 5, 5, 6, 6, 5, |
| 467 | 6, 5, 5, 6, 6, 5, |
| 468 | 8, 7, 7, 8, 8, 7, |
| 469 | 8, 7, 7, 8, 8, 7, |
| 470 | 6, 5, 5, 6, 6, 5, |
| 471 | |
| 472 | 4, 3, 3, 4, 4, 3, |
| 473 | 2, 1, 1, 2, 2, 1, |
| 474 | 2, 1, 1, 2, 2, 1, |
| 475 | 4, 3, 3, 4, 4, 3, |
| 476 | 4, 3, 3, 4, 4, 3, |
| 477 | 2, 1, 1, 2, 2, 1, |
| 478 | |
| 479 | 4, 3, 3, 4, 4, 3, |
| 480 | 2, 1, 1, 2, 2, 1, |
| 481 | 2, 1, 1, 2, 2, 1, |
| 482 | 4, 3, 3, 4, 4, 3, |
| 483 | 4, 3, 3, 4, 4, 3, |
| 484 | 2, 1, 1, 2, 2, 1, |
| 485 | |
| 486 | 8, 7, 7, 8, 8, 7, |
| 487 | 6, 5, 5, 6, 6, 5, |
| 488 | 6, 5, 5, 6, 6, 5, |
| 489 | 8, 7, 7, 8, 8, 7, |
| 490 | 8, 7, 7, 8, 8, 7, |
| 491 | 6, 5, 5, 6, 6, 5, |
| 492 | |
| 493 | 8, 7, 7, 8, 8, 7, |
| 494 | 6, 5, 5, 6, 6, 5, |
| 495 | 6, 5, 5, 6, 6, 5, |
| 496 | 8, 7, 7, 8, 8, 7, |
| 497 | 8, 7, 7, 8, 8, 7, |
| 498 | 6, 5, 5, 6, 6, 5, |
| 499 | |
| 500 | 4, 3, 3, 4, 4, 3, |
| 501 | 2, 1, 1, 2, 2, 1, |
| 502 | 2, 1, 1, 2, 2, 1, |
| 503 | 4, 3, 3, 4, 4, 3, |
| 504 | 4, 3, 3, 4, 4, 3, |
| 505 | 2, 1, 1, 2, 2, 1, |
| 506 | |
| 507 | |
| 508 | 8, 7, 7, 8, 8, 7, |
| 509 | 6, 5, 5, 6, 6, 5, |
| 510 | 6, 5, 5, 6, 6, 5, |
| 511 | 8, 7, 7, 8, 8, 7, |
| 512 | 8, 7, 7, 8, 8, 7, |
| 513 | 6, 5, 5, 6, 6, 5, |
| 514 | |
| 515 | 4, 3, 3, 4, 4, 3, |
| 516 | 2, 1, 1, 2, 2, 1, |
| 517 | 2, 1, 1, 2, 2, 1, |
| 518 | 4, 3, 3, 4, 4, 3, |
| 519 | 4, 3, 3, 4, 4, 3, |
| 520 | 2, 1, 1, 2, 2, 1, |
| 521 | |
| 522 | 4, 3, 3, 4, 4, 3, |
| 523 | 2, 1, 1, 2, 2, 1, |
| 524 | 2, 1, 1, 2, 2, 1, |
| 525 | 4, 3, 3, 4, 4, 3, |
| 526 | 4, 3, 3, 4, 4, 3, |
| 527 | 2, 1, 1, 2, 2, 1, |
| 528 | |
| 529 | 8, 7, 7, 8, 8, 7, |
| 530 | 6, 5, 5, 6, 6, 5, |
| 531 | 6, 5, 5, 6, 6, 5, |
| 532 | 8, 7, 7, 8, 8, 7, |
| 533 | 8, 7, 7, 8, 8, 7, |
| 534 | 6, 5, 5, 6, 6, 5, |
| 535 | |
| 536 | 8, 7, 7, 8, 8, 7, |
| 537 | 6, 5, 5, 6, 6, 5, |
| 538 | 6, 5, 5, 6, 6, 5, |
| 539 | 8, 7, 7, 8, 8, 7, |
| 540 | 8, 7, 7, 8, 8, 7, |
| 541 | 6, 5, 5, 6, 6, 5, |
| 542 | |
| 543 | 4, 3, 3, 4, 4, 3, |
| 544 | 2, 1, 1, 2, 2, 1, |
| 545 | 2, 1, 1, 2, 2, 1, |
| 546 | 4, 3, 3, 4, 4, 3, |
| 547 | 4, 3, 3, 4, 4, 3, |
| 548 | 2, 1, 1, 2, 2, 1, |
| 549 | |
| 550 | |
| 551 | 16, 15, 15, 16, 16, 15, |
| 552 | 14, 13, 13, 14, 14, 13, |
| 553 | 14, 13, 13, 14, 14, 13, |
| 554 | 16, 15, 15, 16, 16, 15, |
| 555 | 16, 15, 15, 16, 16, 15, |
| 556 | 14, 13, 13, 14, 14, 13, |
| 557 | |
| 558 | 12, 11, 11, 12, 12, 11, |
| 559 | 10, 9, 9, 10, 10, 9, |
| 560 | 10, 9, 9, 10, 10, 9, |
| 561 | 12, 11, 11, 12, 12, 11, |
| 562 | 12, 11, 11, 12, 12, 11, |
| 563 | 10, 9, 9, 10, 10, 9, |
| 564 | |
| 565 | 12, 11, 11, 12, 12, 11, |
| 566 | 10, 9, 9, 10, 10, 9, |
| 567 | 10, 9, 9, 10, 10, 9, |
| 568 | 12, 11, 11, 12, 12, 11, |
| 569 | 12, 11, 11, 12, 12, 11, |
| 570 | 10, 9, 9, 10, 10, 9, |
| 571 | |
| 572 | 16, 15, 15, 16, 16, 15, |
| 573 | 14, 13, 13, 14, 14, 13, |
| 574 | 14, 13, 13, 14, 14, 13, |
| 575 | 16, 15, 15, 16, 16, 15, |
| 576 | 16, 15, 15, 16, 16, 15, |
| 577 | 14, 13, 13, 14, 14, 13, |
| 578 | |
| 579 | 16, 15, 15, 16, 16, 15, |
| 580 | 14, 13, 13, 14, 14, 13, |
| 581 | 14, 13, 13, 14, 14, 13, |
| 582 | 16, 15, 15, 16, 16, 15, |
| 583 | 16, 15, 15, 16, 16, 15, |
| 584 | 14, 13, 13, 14, 14, 13, |
| 585 | |
| 586 | 12, 11, 11, 12, 12, 11, |
| 587 | 10, 9, 9, 10, 10, 9, |
| 588 | 10, 9, 9, 10, 10, 9, |
| 589 | 12, 11, 11, 12, 12, 11, |
| 590 | 12, 11, 11, 12, 12, 11, |
| 591 | 10, 9, 9, 10, 10, 9, |
| 592 | |
| 593 | |
| 594 | 16, 15, 15, 16, 16, 15, |
| 595 | 14, 13, 13, 14, 14, 13, |
| 596 | 14, 13, 13, 14, 14, 13, |
| 597 | 16, 15, 15, 16, 16, 15, |
| 598 | 16, 15, 15, 16, 16, 15, |
| 599 | 14, 13, 13, 14, 14, 13, |
| 600 | |
| 601 | 12, 11, 11, 12, 12, 11, |
| 602 | 10, 9, 9, 10, 10, 9, |
| 603 | 10, 9, 9, 10, 10, 9, |
| 604 | 12, 11, 11, 12, 12, 11, |
| 605 | 12, 11, 11, 12, 12, 11, |
| 606 | 10, 9, 9, 10, 10, 9, |
| 607 | |
| 608 | 12, 11, 11, 12, 12, 11, |
| 609 | 10, 9, 9, 10, 10, 9, |
| 610 | 10, 9, 9, 10, 10, 9, |
| 611 | 12, 11, 11, 12, 12, 11, |
| 612 | 12, 11, 11, 12, 12, 11, |
| 613 | 10, 9, 9, 10, 10, 9, |
| 614 | |
| 615 | 16, 15, 15, 16, 16, 15, |
| 616 | 14, 13, 13, 14, 14, 13, |
| 617 | 14, 13, 13, 14, 14, 13, |
| 618 | 16, 15, 15, 16, 16, 15, |
| 619 | 16, 15, 15, 16, 16, 15, |
| 620 | 14, 13, 13, 14, 14, 13, |
| 621 | |
| 622 | 16, 15, 15, 16, 16, 15, |
| 623 | 14, 13, 13, 14, 14, 13, |
| 624 | 14, 13, 13, 14, 14, 13, |
| 625 | 16, 15, 15, 16, 16, 15, |
| 626 | 16, 15, 15, 16, 16, 15, |
| 627 | 14, 13, 13, 14, 14, 13, |
| 628 | |
| 629 | 12, 11, 11, 12, 12, 11, |
| 630 | 10, 9, 9, 10, 10, 9, |
| 631 | 10, 9, 9, 10, 10, 9, |
| 632 | 12, 11, 11, 12, 12, 11, |
| 633 | 12, 11, 11, 12, 12, 11, |
| 634 | 10, 9, 9, 10, 10, 9, |
| 635 | |
| 636 | |
| 637 | 8, 7, 7, 8, 8, 7, |
| 638 | 6, 5, 5, 6, 6, 5, |
| 639 | 6, 5, 5, 6, 6, 5, |
| 640 | 8, 7, 7, 8, 8, 7, |
| 641 | 8, 7, 7, 8, 8, 7, |
| 642 | 6, 5, 5, 6, 6, 5, |
| 643 | |
| 644 | 4, 3, 3, 4, 4, 3, |
| 645 | 2, 1, 1, 2, 2, 1, |
| 646 | 2, 1, 1, 2, 2, 1, |
| 647 | 4, 3, 3, 4, 4, 3, |
| 648 | 4, 3, 3, 4, 4, 3, |
| 649 | 2, 1, 1, 2, 2, 1, |
| 650 | |
| 651 | 4, 3, 3, 4, 4, 3, |
| 652 | 2, 1, 1, 2, 2, 1, |
| 653 | 2, 1, 1, 2, 2, 1, |
| 654 | 4, 3, 3, 4, 4, 3, |
| 655 | 4, 3, 3, 4, 4, 3, |
| 656 | 2, 1, 1, 2, 2, 1, |
| 657 | |
| 658 | 8, 7, 7, 8, 8, 7, |
| 659 | 6, 5, 5, 6, 6, 5, |
| 660 | 6, 5, 5, 6, 6, 5, |
| 661 | 8, 7, 7, 8, 8, 7, |
| 662 | 8, 7, 7, 8, 8, 7, |
| 663 | 6, 5, 5, 6, 6, 5, |
| 664 | |
| 665 | 8, 7, 7, 8, 8, 7, |
| 666 | 6, 5, 5, 6, 6, 5, |
| 667 | 6, 5, 5, 6, 6, 5, |
| 668 | 8, 7, 7, 8, 8, 7, |
| 669 | 8, 7, 7, 8, 8, 7, |
| 670 | 6, 5, 5, 6, 6, 5, |
| 671 | |
| 672 | 4, 3, 3, 4, 4, 3, |
| 673 | 2, 1, 1, 2, 2, 1, |
| 674 | 2, 1, 1, 2, 2, 1, |
| 675 | 4, 3, 3, 4, 4, 3, |
| 676 | 4, 3, 3, 4, 4, 3, |
| 677 | 2, 1, 1, 2, 2, 1 |
| 678 | }, |
| 679 | qScale, qOffset); |
| 680 | |
| 681 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 682 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 683 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 684 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 685 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 686 | |
| 687 | return MirrorPad4dTestCommon<T>(workloadFactory, |
| 688 | memoryManager, |
| 689 | tensorHandleFactory, |
| 690 | inputTensorInfo, |
| 691 | outputTensorInfo, |
| 692 | inputValues, |
| 693 | expectedOutputValues, |
| 694 | padList, |
| 695 | armnn::PaddingMode::Symmetric); |
| 696 | } |
| 697 | |
| 698 | template<armnn::DataType ArmnnType, |
| 699 | typename T = armnn::ResolveType<ArmnnType>> |
| 700 | LayerTestResult<T, 4> PadReflect4dTest( |
| 701 | armnn::IWorkloadFactory& workloadFactory, |
| 702 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 703 | const armnn::ITensorHandleFactory& tensorHandleFactory, |
| 704 | float qScale, |
| 705 | int32_t qOffset) |
| 706 | { |
| 707 | const armnn::TensorShape inputShape{ 2, 2, 2, 2 }; |
| 708 | const armnn::TensorShape outputShape{ 4, 4, 4, 4 }; |
| 709 | |
| 710 | const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset); |
| 711 | const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset); |
| 712 | |
| 713 | std::vector<T> inputValues = armnnUtils::QuantizedVector<T>( |
| 714 | { |
| 715 | // Batch 0, Channel 0, Height (2) x Width (2) |
| 716 | 1, 2, |
| 717 | 3, 4, |
| 718 | |
| 719 | // Batch 0, Channel 1, Height (2) x Width (2) |
| 720 | 5, 6, |
| 721 | 7, 8, |
| 722 | |
| 723 | // Batch 1, Channel 0, Height (2) x Width (2) |
| 724 | 9, 10, |
| 725 | 11, 12, |
| 726 | |
| 727 | // Batch 1, Channel 1, Height (2) x Width (2) |
| 728 | 13, 14, |
| 729 | 15, 16, |
| 730 | }, |
| 731 | qScale, qOffset); |
| 732 | |
| 733 | std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>( |
| 734 | { |
| 735 | 16, 15, 16, 15, |
| 736 | 14, 13, 14, 13, |
| 737 | 16, 15, 16, 15, |
| 738 | 14, 13, 14, 13, |
| 739 | |
| 740 | 12, 11, 12, 11, |
| 741 | 10, 9, 10, 9, |
| 742 | 12, 11, 12, 11, |
| 743 | 10, 9, 10, 9, |
| 744 | |
| 745 | 16, 15, 16, 15, |
| 746 | 14, 13, 14, 13, |
| 747 | 16, 15, 16, 15, |
| 748 | 14, 13, 14, 13, |
| 749 | |
| 750 | 12, 11, 12, 11, |
| 751 | 10, 9, 10, 9, |
| 752 | 12, 11, 12, 11, |
| 753 | 10, 9, 10, 9, |
| 754 | |
| 755 | |
| 756 | 8, 7, 8, 7, |
| 757 | 6, 5, 6, 5, |
| 758 | 8, 7, 8, 7, |
| 759 | 6, 5, 6, 5, |
| 760 | |
| 761 | 4, 3, 4, 3, |
| 762 | 2, 1, 2, 1, |
| 763 | 4, 3, 4, 3, |
| 764 | 2, 1, 2, 1, |
| 765 | |
| 766 | 8, 7, 8, 7, |
| 767 | 6, 5, 6, 5, |
| 768 | 8, 7, 8, 7, |
| 769 | 6, 5, 6, 5, |
| 770 | |
| 771 | 4, 3, 4, 3, |
| 772 | 2, 1, 2, 1, |
| 773 | 4, 3, 4, 3, |
| 774 | 2, 1, 2, 1, |
| 775 | |
| 776 | |
| 777 | 16, 15, 16, 15, |
| 778 | 14, 13, 14, 13, |
| 779 | 16, 15, 16, 15, |
| 780 | 14, 13, 14, 13, |
| 781 | |
| 782 | 12, 11, 12, 11, |
| 783 | 10, 9, 10, 9, |
| 784 | 12, 11, 12, 11, |
| 785 | 10, 9, 10, 9, |
| 786 | |
| 787 | 16, 15, 16, 15, |
| 788 | 14, 13, 14, 13, |
| 789 | 16, 15, 16, 15, |
| 790 | 14, 13, 14, 13, |
| 791 | |
| 792 | 12, 11, 12, 11, |
| 793 | 10, 9, 10, 9, |
| 794 | 12, 11, 12, 11, |
| 795 | 10, 9, 10, 9, |
| 796 | |
| 797 | |
| 798 | 8, 7, 8, 7, |
| 799 | 6, 5, 6, 5, |
| 800 | 8, 7, 8, 7, |
| 801 | 6, 5, 6, 5, |
| 802 | |
| 803 | 4, 3, 4, 3, |
| 804 | 2, 1, 2, 1, |
| 805 | 4, 3, 4, 3, |
| 806 | 2, 1, 2, 1, |
| 807 | |
| 808 | 8, 7, 8, 7, |
| 809 | 6, 5, 6, 5, |
| 810 | 8, 7, 8, 7, |
| 811 | 6, 5, 6, 5, |
| 812 | |
| 813 | 4, 3, 4, 3, |
| 814 | 2, 1, 2, 1, |
| 815 | 4, 3, 4, 3, |
| 816 | 2, 1, 2, 1 |
| 817 | }, |
| 818 | qScale, qOffset); |
| 819 | |
| 820 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 821 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 822 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 823 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 824 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 825 | |
| 826 | return MirrorPad4dTestCommon<T>(workloadFactory, |
| 827 | memoryManager, |
| 828 | tensorHandleFactory, |
| 829 | inputTensorInfo, |
| 830 | outputTensorInfo, |
| 831 | inputValues, |
| 832 | expectedOutputValues, |
| 833 | padList, |
| 834 | armnn::PaddingMode::Reflect); |
| 835 | } |
| 836 | |
| 837 | LayerTestResult<armnn::Half, 2> PadSymmetricFloat16( |
| 838 | armnn::IWorkloadFactory& workloadFactory, |
| 839 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 840 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 841 | { |
| 842 | using namespace half_float::literal; |
| 843 | |
| 844 | const armnn::TensorShape inputShape{ 3, 3 }; |
| 845 | const armnn::TensorShape outputShape{ 5, 7 }; |
| 846 | |
| 847 | const armnn::TensorInfo inputTensorInfo(inputShape, armnn::DataType::Float16); |
| 848 | const armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Float16); |
| 849 | |
| 850 | const std::vector<armnn::Half> inputValues = |
| 851 | { |
| 852 | 1._h, 2._h, 3._h, |
| 853 | 4._h, 5._h, 6._h, |
| 854 | 7._h, 8._h, 9._h |
| 855 | }; |
| 856 | |
| 857 | std::vector<armnn::Half> expectedOutputValues = |
| 858 | { |
| 859 | 2._h, 1._h, 1._h, 2._h, 3._h, 3._h, 2._h, |
| 860 | 2._h, 1._h, 1._h, 2._h, 3._h, 3._h, 2._h, |
| 861 | 5._h, 4._h, 4._h, 5._h, 6._h, 6._h, 5._h, |
| 862 | 8._h, 7._h, 7._h, 8._h, 9._h, 9._h, 8._h, |
| 863 | 8._h, 7._h, 7._h, 8._h, 9._h, 9._h, 8._h, |
| 864 | }; |
| 865 | |
| 866 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 867 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 868 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 869 | |
| 870 | return MirrorPad2dTestCommon<armnn::Half>(workloadFactory, |
| 871 | memoryManager, |
| 872 | tensorHandleFactory, |
| 873 | inputTensorInfo, |
| 874 | outputTensorInfo, |
| 875 | inputValues, |
| 876 | expectedOutputValues, |
| 877 | padList, |
| 878 | armnn::PaddingMode::Symmetric); |
| 879 | } |
| 880 | |
| 881 | LayerTestResult<armnn::Half, 2> PadReflectFloat16( |
| 882 | armnn::IWorkloadFactory& workloadFactory, |
| 883 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 884 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 885 | { |
| 886 | using namespace half_float::literal; |
| 887 | |
| 888 | const armnn::TensorShape inputShape{ 3, 3 }; |
| 889 | const armnn::TensorShape outputShape{ 7, 5 }; |
| 890 | |
| 891 | const armnn::TensorInfo inputTensorInfo(inputShape, armnn::DataType::Float16); |
| 892 | const armnn::TensorInfo outputTensorInfo(outputShape, armnn::DataType::Float16); |
| 893 | |
| 894 | const std::vector<armnn::Half> inputValues = |
| 895 | { |
| 896 | 1._h, 2._h, 3._h, |
| 897 | 4._h, 5._h, 6._h, |
| 898 | 7._h, 8._h, 9._h |
| 899 | }; |
| 900 | |
| 901 | std::vector<armnn::Half> expectedOutputValues = |
| 902 | { |
| 903 | 8._h, 7._h, 8._h, 9._h, 8._h, |
| 904 | 5._h, 4._h, 5._h, 6._h, 5._h, |
| 905 | 2._h, 1._h, 2._h, 3._h, 2._h, |
| 906 | 5._h, 4._h, 5._h, 6._h, 5._h, |
| 907 | 8._h, 7._h, 8._h, 9._h, 8._h, |
| 908 | 5._h, 4._h, 5._h, 6._h, 5._h, |
| 909 | 2._h, 1._h, 2._h, 3._h, 2._h, |
| 910 | }; |
| 911 | |
| 912 | std::vector<std::pair<unsigned int, unsigned int>> padList; |
| 913 | padList.push_back(std::pair<unsigned int, unsigned int>(2,2)); |
| 914 | padList.push_back(std::pair<unsigned int, unsigned int>(1,1)); |
| 915 | |
| 916 | return MirrorPad2dTestCommon<armnn::Half>(workloadFactory, |
| 917 | memoryManager, |
| 918 | tensorHandleFactory, |
| 919 | inputTensorInfo, |
| 920 | outputTensorInfo, |
| 921 | inputValues, |
| 922 | expectedOutputValues, |
| 923 | padList, |
| 924 | armnn::PaddingMode::Reflect); |
| 925 | } |
| 926 | |
| 927 | // |
| 928 | // Implementation functions |
| 929 | // |
| 930 | |
| 931 | LayerTestResult<float, 2> PadSymmetric2dFloat32Test( |
| 932 | armnn::IWorkloadFactory& workloadFactory, |
| 933 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 934 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 935 | { |
| 936 | return PadSymmetric2dTest<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 937 | } |
| 938 | |
| 939 | LayerTestResult<float, 2> PadReflect2dFloat32Test( |
| 940 | armnn::IWorkloadFactory& workloadFactory, |
| 941 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 942 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 943 | { |
| 944 | return PadReflect2dTest<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 945 | } |
| 946 | |
| 947 | LayerTestResult<float, 3> PadSymmetric3dFloat32Test( |
| 948 | armnn::IWorkloadFactory& workloadFactory, |
| 949 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 950 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 951 | { |
| 952 | return PadSymmetric3dTest<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 953 | } |
| 954 | |
| 955 | LayerTestResult<float, 3> PadReflect3dFloat32Test( |
| 956 | armnn::IWorkloadFactory& workloadFactory, |
| 957 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 958 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 959 | { |
| 960 | return PadReflect3dTest<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 961 | } |
| 962 | |
| 963 | LayerTestResult<uint8_t, 3> PadSymmetric3dUint8Test( |
| 964 | armnn::IWorkloadFactory& workloadFactory, |
| 965 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 966 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 967 | { |
| 968 | return PadSymmetric3dTest<armnn::DataType::QAsymmU8>( |
| 969 | workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 128); |
| 970 | } |
| 971 | |
| 972 | LayerTestResult<uint8_t, 3> PadReflect3dUint8Test( |
| 973 | armnn::IWorkloadFactory& workloadFactory, |
| 974 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 975 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 976 | { |
| 977 | return PadReflect3dTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 128); |
| 978 | } |
| 979 | |
| 980 | LayerTestResult<int8_t, 3> PadSymmetric3dInt8Test( |
| 981 | armnn::IWorkloadFactory& workloadFactory, |
| 982 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 983 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 984 | { |
| 985 | return PadSymmetric3dTest<armnn::DataType::QAsymmS8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 64); |
| 986 | } |
| 987 | |
| 988 | LayerTestResult<int8_t, 3> PadReflect3dInt8Test( |
| 989 | armnn::IWorkloadFactory& workloadFactory, |
| 990 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 991 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 992 | { |
| 993 | return PadReflect3dTest<armnn::DataType::QAsymmS8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 64); |
| 994 | } |
| 995 | |
| 996 | LayerTestResult<float, 4> PadSymmetric4dFloat32Test( |
| 997 | armnn::IWorkloadFactory& workloadFactory, |
| 998 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 999 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1000 | { |
| 1001 | return PadSymmetric4dTest<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 1002 | } |
| 1003 | |
| 1004 | LayerTestResult<float, 4> PadReflect4dFloat32Test( |
| 1005 | armnn::IWorkloadFactory& workloadFactory, |
| 1006 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1007 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1008 | { |
| 1009 | return PadReflect4dTest<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 1010 | } |
| 1011 | |
| 1012 | LayerTestResult<armnn::BFloat16, 4> PadSymmetric4dBFloat16Test( |
| 1013 | armnn::IWorkloadFactory& workloadFactory, |
| 1014 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1015 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1016 | { |
| 1017 | return PadSymmetric4dTest<armnn::DataType::BFloat16>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 1018 | } |
| 1019 | |
| 1020 | LayerTestResult<armnn::BFloat16, 4> PadReflect4dBFloat16Test( |
| 1021 | armnn::IWorkloadFactory& workloadFactory, |
| 1022 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1023 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1024 | { |
| 1025 | return PadReflect4dTest<armnn::DataType::BFloat16>(workloadFactory, memoryManager, tensorHandleFactory, 0.0f, 0); |
| 1026 | } |
| 1027 | |
| 1028 | LayerTestResult<uint8_t, 4> PadSymmetric4dUint8Test( |
| 1029 | armnn::IWorkloadFactory& workloadFactory, |
| 1030 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1031 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1032 | { |
| 1033 | return PadSymmetric4dTest<armnn::DataType::QAsymmU8>( |
| 1034 | workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 128); |
| 1035 | } |
| 1036 | |
| 1037 | LayerTestResult<uint8_t, 4> PadReflect4dUint8Test( |
| 1038 | armnn::IWorkloadFactory& workloadFactory, |
| 1039 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1040 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1041 | { |
| 1042 | return PadReflect4dTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 128); |
| 1043 | } |
| 1044 | |
| 1045 | LayerTestResult<int8_t, 4> PadSymmetric4dInt8Test( |
| 1046 | armnn::IWorkloadFactory& workloadFactory, |
| 1047 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1048 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1049 | { |
| 1050 | return PadSymmetric4dTest<armnn::DataType::QAsymmS8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 64); |
| 1051 | } |
| 1052 | |
| 1053 | LayerTestResult<int8_t, 4> PadReflect4dInt8Test( |
| 1054 | armnn::IWorkloadFactory& workloadFactory, |
| 1055 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1056 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1057 | { |
| 1058 | return PadReflect4dTest<armnn::DataType::QAsymmS8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 64); |
| 1059 | } |
| 1060 | |
| 1061 | LayerTestResult<int16_t, 4> PadSymmetric4dInt16Test( |
| 1062 | armnn::IWorkloadFactory& workloadFactory, |
| 1063 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1064 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1065 | { |
| 1066 | return PadSymmetric4dTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 2.0f, 0); |
| 1067 | } |
| 1068 | |
| 1069 | LayerTestResult<int16_t, 4> PadReflect4dInt16Test( |
| 1070 | armnn::IWorkloadFactory& workloadFactory, |
| 1071 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1072 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1073 | { |
| 1074 | return PadReflect4dTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 2.0f, 0); |
| 1075 | } |
| 1076 | |
| 1077 | LayerTestResult<armnn::Half, 2> PadSymmetricFloat16Test( |
| 1078 | armnn::IWorkloadFactory& workloadFactory, |
| 1079 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1080 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1081 | { |
| 1082 | return PadSymmetricFloat16(workloadFactory, memoryManager, tensorHandleFactory); |
| 1083 | } |
| 1084 | |
| 1085 | LayerTestResult<armnn::Half, 2> PadReflectFloat16Test( |
| 1086 | armnn::IWorkloadFactory& workloadFactory, |
| 1087 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 1088 | const armnn::ITensorHandleFactory& tensorHandleFactory) |
| 1089 | { |
| 1090 | return PadReflectFloat16(workloadFactory, memoryManager, tensorHandleFactory); |
| 1091 | } |