Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 5 | |
| 6 | #include "StridedSliceTestImpl.hpp" |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 7 | |
Aron Virginas-Tar | 48623a0 | 2019-10-22 10:00:28 +0100 | [diff] [blame] | 8 | #include <QuantizeHelper.hpp> |
Aron Virginas-Tar | d4f0fea | 2019-04-09 14:08:06 +0100 | [diff] [blame] | 9 | #include <ResolveType.hpp> |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 10 | |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 11 | |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 12 | #include <backendsCommon/test/TensorCopyUtils.hpp> |
| 13 | #include <backendsCommon/test/WorkloadTestUtils.hpp> |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 14 | |
| 15 | #include <test/TensorHelpers.hpp> |
| 16 | |
| 17 | namespace |
| 18 | { |
| 19 | |
| 20 | template<typename T, std::size_t InDim, std::size_t OutDim> |
| 21 | LayerTestResult<T, OutDim> StridedSliceTestImpl( |
| 22 | armnn::IWorkloadFactory& workloadFactory, |
| 23 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, |
| 24 | armnn::TensorInfo& inputTensorInfo, |
| 25 | armnn::TensorInfo& outputTensorInfo, |
| 26 | std::vector<float>& inputData, |
| 27 | std::vector<float>& outputExpectedData, |
| 28 | armnn::StridedSliceQueueDescriptor descriptor, |
| 29 | const float qScale = 1.0f, |
| 30 | const int32_t qOffset = 0) |
| 31 | { |
Derek Lamberti | c374ff0 | 2019-12-10 21:57:35 +0000 | [diff] [blame] | 32 | boost::ignore_unused(memoryManager); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 33 | if(armnn::IsQuantizedType<T>()) |
| 34 | { |
| 35 | inputTensorInfo.SetQuantizationScale(qScale); |
| 36 | inputTensorInfo.SetQuantizationOffset(qOffset); |
| 37 | |
| 38 | outputTensorInfo.SetQuantizationScale(qScale); |
| 39 | outputTensorInfo.SetQuantizationOffset(qOffset); |
| 40 | } |
| 41 | |
| 42 | boost::multi_array<T, InDim> input = |
Aron Virginas-Tar | 48623a0 | 2019-10-22 10:00:28 +0100 | [diff] [blame] | 43 | MakeTensor<T, InDim>(inputTensorInfo, armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset)); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 44 | |
| 45 | LayerTestResult<T, OutDim> ret(outputTensorInfo); |
| 46 | ret.outputExpected = |
Aron Virginas-Tar | 48623a0 | 2019-10-22 10:00:28 +0100 | [diff] [blame] | 47 | MakeTensor<T, OutDim>(outputTensorInfo, armnnUtils::QuantizedVector<T>(outputExpectedData, qScale, qOffset)); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 48 | |
| 49 | std::unique_ptr<armnn::ITensorHandle> inputHandle = |
| 50 | workloadFactory.CreateTensorHandle(inputTensorInfo); |
| 51 | |
| 52 | std::unique_ptr<armnn::ITensorHandle> outputHandle = |
| 53 | workloadFactory.CreateTensorHandle(outputTensorInfo); |
| 54 | |
| 55 | armnn::WorkloadInfo info; |
| 56 | AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); |
| 57 | AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); |
| 58 | |
| 59 | std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateStridedSlice(descriptor, info); |
| 60 | |
| 61 | inputHandle->Allocate(); |
| 62 | outputHandle->Allocate(); |
| 63 | |
| 64 | CopyDataToITensorHandle(inputHandle.get(), input.data()); |
| 65 | |
| 66 | ExecuteWorkload(*workload, memoryManager); |
| 67 | |
| 68 | CopyDataFromITensorHandle(ret.output.data(), outputHandle.get()); |
| 69 | |
| 70 | return ret; |
| 71 | } |
| 72 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 73 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 74 | LayerTestResult<T, 4> StridedSlice4dTest( |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 75 | armnn::IWorkloadFactory& workloadFactory, |
| 76 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 77 | { |
| 78 | armnn::TensorInfo inputTensorInfo; |
| 79 | armnn::TensorInfo outputTensorInfo; |
| 80 | |
| 81 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 82 | unsigned int outputShape[] = {1, 2, 3, 1}; |
| 83 | |
| 84 | armnn::StridedSliceQueueDescriptor desc; |
| 85 | desc.m_Parameters.m_Begin = {1, 0, 0, 0}; |
| 86 | desc.m_Parameters.m_End = {2, 2, 3, 1}; |
| 87 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 88 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 89 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 90 | outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 91 | |
| 92 | std::vector<float> input = std::vector<float>( |
| 93 | { |
| 94 | 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f, |
| 95 | |
| 96 | 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f, |
| 97 | |
| 98 | 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f |
| 99 | }); |
| 100 | |
| 101 | std::vector<float> outputExpected = std::vector<float>( |
| 102 | { |
| 103 | 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f |
| 104 | }); |
| 105 | |
| 106 | return StridedSliceTestImpl<T, 4, 4>( |
| 107 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 108 | } |
| 109 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 110 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 111 | LayerTestResult<T, 4> StridedSlice4dReverseTest( |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 112 | armnn::IWorkloadFactory& workloadFactory, |
| 113 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 114 | { |
| 115 | armnn::TensorInfo inputTensorInfo; |
| 116 | armnn::TensorInfo outputTensorInfo; |
| 117 | |
| 118 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 119 | unsigned int outputShape[] = {1, 2, 3, 1}; |
| 120 | |
| 121 | armnn::StridedSliceQueueDescriptor desc; |
| 122 | desc.m_Parameters.m_Begin = {1, -1, 0, 0}; |
| 123 | desc.m_Parameters.m_End = {2, -3, 3, 1}; |
| 124 | desc.m_Parameters.m_Stride = {1, -1, 1, 1}; |
| 125 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 126 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 127 | outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 128 | |
| 129 | std::vector<float> input = std::vector<float>( |
| 130 | { |
| 131 | 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f, |
| 132 | |
| 133 | 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f, |
| 134 | |
| 135 | 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f |
| 136 | }); |
| 137 | |
| 138 | std::vector<float> outputExpected = std::vector<float>( |
| 139 | { |
| 140 | 4.0f, 4.0f, 4.0f, 3.0f, 3.0f, 3.0f |
| 141 | }); |
| 142 | |
| 143 | return StridedSliceTestImpl<T, 4, 4>( |
| 144 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 145 | } |
| 146 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 147 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 148 | LayerTestResult<T, 4> StridedSliceSimpleStrideTest( |
| 149 | armnn::IWorkloadFactory& workloadFactory, |
| 150 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 151 | { |
| 152 | armnn::TensorInfo inputTensorInfo; |
| 153 | armnn::TensorInfo outputTensorInfo; |
| 154 | |
| 155 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 156 | unsigned int outputShape[] = {2, 1, 2, 1}; |
| 157 | |
| 158 | armnn::StridedSliceQueueDescriptor desc; |
| 159 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 160 | desc.m_Parameters.m_End = {3, 2, 3, 1}; |
| 161 | desc.m_Parameters.m_Stride = {2, 2, 2, 1}; |
| 162 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 163 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 164 | outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 165 | |
| 166 | std::vector<float> input = std::vector<float>( |
| 167 | { |
| 168 | 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f, |
| 169 | |
| 170 | 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f, |
| 171 | |
| 172 | 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f |
| 173 | }); |
| 174 | |
| 175 | std::vector<float> outputExpected = std::vector<float>( |
| 176 | { |
| 177 | 1.0f, 1.0f, |
| 178 | |
| 179 | 5.0f, 5.0f |
| 180 | }); |
| 181 | |
| 182 | return StridedSliceTestImpl<T, 4, 4>( |
| 183 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 184 | } |
| 185 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 186 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 187 | LayerTestResult<T, 4> StridedSliceSimpleRangeMaskTest( |
| 188 | armnn::IWorkloadFactory& workloadFactory, |
| 189 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 190 | { |
| 191 | armnn::TensorInfo inputTensorInfo; |
| 192 | armnn::TensorInfo outputTensorInfo; |
| 193 | |
| 194 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 195 | unsigned int outputShape[] = {3, 2, 3, 1}; |
| 196 | |
| 197 | armnn::StridedSliceQueueDescriptor desc; |
| 198 | desc.m_Parameters.m_Begin = {1, 1, 1, 1}; |
| 199 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 200 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 201 | desc.m_Parameters.m_BeginMask = (1 << 4) - 1; |
| 202 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 203 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 204 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 205 | outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 206 | |
| 207 | std::vector<float> input = std::vector<float>( |
| 208 | { |
| 209 | 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f, |
| 210 | |
| 211 | 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f, |
| 212 | |
| 213 | 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f |
| 214 | }); |
| 215 | |
| 216 | std::vector<float> outputExpected = std::vector<float>( |
| 217 | { |
| 218 | 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f, |
| 219 | |
| 220 | 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f, |
| 221 | |
| 222 | 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f |
| 223 | }); |
| 224 | |
| 225 | return StridedSliceTestImpl<T, 4, 4>( |
| 226 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 227 | } |
| 228 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 229 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 230 | LayerTestResult<T, 2> StridedSliceShrinkAxisMaskTest( |
| 231 | armnn::IWorkloadFactory& workloadFactory, |
| 232 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 233 | { |
| 234 | armnn::TensorInfo inputTensorInfo; |
| 235 | armnn::TensorInfo outputTensorInfo; |
| 236 | |
| 237 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 238 | unsigned int outputShape[] = {3, 1}; |
| 239 | |
| 240 | armnn::StridedSliceQueueDescriptor desc; |
| 241 | desc.m_Parameters.m_Begin = {0, 0, 1, 0}; |
| 242 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 243 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 244 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 245 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 1) | (1 << 2); |
| 246 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 247 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 248 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 249 | |
| 250 | std::vector<float> input = std::vector<float>( |
| 251 | { |
| 252 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 253 | |
| 254 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 255 | |
| 256 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 257 | }); |
| 258 | |
| 259 | std::vector<float> outputExpected = std::vector<float>( |
| 260 | { |
| 261 | 2.0f, 8.0f, 14.0f |
| 262 | }); |
| 263 | |
| 264 | return StridedSliceTestImpl<T, 4, 2>( |
| 265 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 266 | } |
| 267 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 268 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 269 | LayerTestResult<T, 3> StridedSliceShrinkAxisMaskBitPosition0Test( |
| 270 | armnn::IWorkloadFactory& workloadFactory, |
| 271 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 272 | { |
| 273 | armnn::TensorInfo inputTensorInfo; |
| 274 | armnn::TensorInfo outputTensorInfo; |
| 275 | |
| 276 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 277 | unsigned int outputShape[] = {2, 3, 1}; |
| 278 | |
| 279 | armnn::StridedSliceQueueDescriptor desc; |
| 280 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 281 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 282 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 283 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 284 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 0); |
| 285 | |
| 286 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 287 | outputTensorInfo = armnn::TensorInfo(3, outputShape, ArmnnType); |
| 288 | |
| 289 | std::vector<float> input = std::vector<float>( |
| 290 | { |
| 291 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 292 | |
| 293 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 294 | |
| 295 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 296 | }); |
| 297 | |
| 298 | std::vector<float> outputExpected = std::vector<float>( |
| 299 | { |
| 300 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f |
| 301 | }); |
| 302 | |
| 303 | return StridedSliceTestImpl<T, 4, 3>( |
| 304 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 305 | } |
| 306 | |
| 307 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 308 | LayerTestResult<T, 3> StridedSliceShrinkAxisMaskBitPosition1Test( |
| 309 | armnn::IWorkloadFactory& workloadFactory, |
| 310 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 311 | { |
| 312 | armnn::TensorInfo inputTensorInfo; |
| 313 | armnn::TensorInfo outputTensorInfo; |
| 314 | |
| 315 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 316 | unsigned int outputShape[] = {3, 3, 1}; |
| 317 | |
| 318 | armnn::StridedSliceQueueDescriptor desc; |
| 319 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 320 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 321 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 322 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 323 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 1); |
| 324 | |
| 325 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 326 | outputTensorInfo = armnn::TensorInfo(3, outputShape, ArmnnType); |
| 327 | |
| 328 | std::vector<float> input = std::vector<float>( |
| 329 | { |
| 330 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 331 | |
| 332 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 333 | |
| 334 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 335 | }); |
| 336 | |
| 337 | std::vector<float> outputExpected = std::vector<float>( |
| 338 | { |
| 339 | 1.0f, 2.0f, 3.0f, 7.0f, 8.0f, 9.0f, 13.0f, 14.0f, 15.0f |
| 340 | }); |
| 341 | |
| 342 | return StridedSliceTestImpl<T, 4, 3>( |
| 343 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 344 | } |
| 345 | |
| 346 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 347 | LayerTestResult<T, 3> StridedSliceShrinkAxisMaskBitPosition2Test( |
| 348 | armnn::IWorkloadFactory& workloadFactory, |
| 349 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 350 | { |
| 351 | armnn::TensorInfo inputTensorInfo; |
| 352 | armnn::TensorInfo outputTensorInfo; |
| 353 | |
| 354 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 355 | unsigned int outputShape[] = {3, 2, 1}; |
| 356 | |
| 357 | armnn::StridedSliceQueueDescriptor desc; |
| 358 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 359 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 360 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 361 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 362 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 2); |
| 363 | |
| 364 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 365 | outputTensorInfo = armnn::TensorInfo(3, outputShape, ArmnnType); |
| 366 | |
| 367 | std::vector<float> input = std::vector<float>( |
| 368 | { |
| 369 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 370 | |
| 371 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 372 | |
| 373 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 374 | }); |
| 375 | |
| 376 | std::vector<float> outputExpected = std::vector<float>( |
| 377 | { |
| 378 | 1.0f, 4.0f, 7.0f, 10.0f, 13.0f, 16.0f |
| 379 | }); |
| 380 | |
| 381 | return StridedSliceTestImpl<T, 4, 3>( |
| 382 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 383 | } |
| 384 | |
| 385 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 386 | LayerTestResult<T, 3> StridedSliceShrinkAxisMaskBitPosition3Test( |
| 387 | armnn::IWorkloadFactory& workloadFactory, |
| 388 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 389 | { |
| 390 | armnn::TensorInfo inputTensorInfo; |
| 391 | armnn::TensorInfo outputTensorInfo; |
| 392 | |
| 393 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 394 | unsigned int outputShape[] = {3, 2, 3}; |
| 395 | |
| 396 | armnn::StridedSliceQueueDescriptor desc; |
| 397 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 398 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 399 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 400 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 401 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 3); |
| 402 | |
| 403 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 404 | outputTensorInfo = armnn::TensorInfo(3, outputShape, ArmnnType); |
| 405 | |
| 406 | std::vector<float> input = std::vector<float>( |
| 407 | { |
| 408 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 409 | |
| 410 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 411 | |
| 412 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 413 | }); |
| 414 | |
| 415 | std::vector<float> outputExpected = std::vector<float>( |
| 416 | { |
| 417 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 418 | |
| 419 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 420 | |
| 421 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 422 | }); |
| 423 | |
| 424 | return StridedSliceTestImpl<T, 4, 3>( |
| 425 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 426 | } |
| 427 | |
| 428 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 429 | LayerTestResult<T, 2> StridedSliceShrinkAxisMaskBitPosition0And1Test( |
| 430 | armnn::IWorkloadFactory& workloadFactory, |
| 431 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 432 | { |
| 433 | armnn::TensorInfo inputTensorInfo; |
| 434 | armnn::TensorInfo outputTensorInfo; |
| 435 | |
| 436 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 437 | unsigned int outputShape[] = {3, 1}; |
| 438 | |
| 439 | armnn::StridedSliceQueueDescriptor desc; |
| 440 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 441 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 442 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 443 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 444 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 0) | (1 << 1); |
| 445 | |
| 446 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 447 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
| 448 | |
| 449 | std::vector<float> input = std::vector<float>( |
| 450 | { |
| 451 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 452 | |
| 453 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 454 | |
| 455 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 456 | }); |
| 457 | |
| 458 | std::vector<float> outputExpected = std::vector<float>( |
| 459 | { |
| 460 | 1.0f, 2.0f, 3.0f |
| 461 | }); |
| 462 | |
| 463 | return StridedSliceTestImpl<T, 4, 2>( |
| 464 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 465 | } |
| 466 | |
| 467 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 468 | LayerTestResult<T, 2> StridedSliceShrinkAxisMaskBitPosition0Dim3Test( |
| 469 | armnn::IWorkloadFactory& workloadFactory, |
| 470 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 471 | { |
| 472 | armnn::TensorInfo inputTensorInfo; |
| 473 | armnn::TensorInfo outputTensorInfo; |
| 474 | |
| 475 | unsigned int inputShape[] = {2, 3, 1}; |
| 476 | unsigned int outputShape[] = {3, 1}; |
| 477 | |
| 478 | armnn::StridedSliceQueueDescriptor desc; |
| 479 | desc.m_Parameters.m_Begin = {0, 0, 0}; |
| 480 | desc.m_Parameters.m_End = {0, 0, 0}; |
| 481 | desc.m_Parameters.m_Stride = {1, 1, 1}; |
| 482 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 483 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 0); |
| 484 | |
| 485 | inputTensorInfo = armnn::TensorInfo(3, inputShape, ArmnnType); |
| 486 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
| 487 | |
| 488 | std::vector<float> input = std::vector<float>( |
| 489 | { |
| 490 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f |
| 491 | }); |
| 492 | |
| 493 | std::vector<float> outputExpected = std::vector<float>( |
| 494 | { |
| 495 | 1.0f, 2.0f, 3.0f |
| 496 | }); |
| 497 | |
| 498 | return StridedSliceTestImpl<T, 3, 2>( |
| 499 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 500 | } |
| 501 | |
| 502 | void FillVector(std::vector<float>& inputArray, float start, float step) |
| 503 | { |
| 504 | for (uint32_t i = 0; i < inputArray.size(); ++i) |
| 505 | { |
| 506 | inputArray[i] = start; |
| 507 | start += step; |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 512 | LayerTestResult<T, 4> StridedSliceShrinkAxisMaskCTSTest( |
| 513 | armnn::IWorkloadFactory& workloadFactory, |
| 514 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 515 | { |
| 516 | armnn::TensorInfo inputTensorInfo; |
| 517 | armnn::TensorInfo outputTensorInfo; |
| 518 | |
| 519 | unsigned int inputShape[] = {1, 1, 8, 942}; |
| 520 | unsigned int outputShape[] = {1, 1, 1, 279}; |
| 521 | |
| 522 | armnn::StridedSliceQueueDescriptor desc; |
| 523 | desc.m_Parameters.m_Begin = {0, 0, 1, 229}; |
| 524 | desc.m_Parameters.m_End = {1, 1, 2, 787}; |
| 525 | desc.m_Parameters.m_Stride = {2, 3, 3, 2}; |
| 526 | desc.m_Parameters.m_BeginMask = 2; |
| 527 | desc.m_Parameters.m_EndMask = 0; |
| 528 | desc.m_Parameters.m_ShrinkAxisMask = 0; |
| 529 | |
| 530 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 531 | outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType); |
| 532 | |
| 533 | // Array from 1 to 7535 |
| 534 | std::vector<float> input(7536); |
| 535 | FillVector(input, 1.0f, 1.0f); |
| 536 | |
| 537 | // Array from 1171 to 1727 in steps of 2 |
| 538 | std::vector<float> outputExpected(279); |
| 539 | FillVector(outputExpected, 1171.0, 2.0f); |
| 540 | |
| 541 | return StridedSliceTestImpl<T, 4, 4>( |
| 542 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 543 | } |
| 544 | |
| 545 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 546 | LayerTestResult<T, 2> StridedSliceShrinkAxisMaskBitPosition0And2Test( |
| 547 | armnn::IWorkloadFactory& workloadFactory, |
| 548 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 549 | { |
| 550 | armnn::TensorInfo inputTensorInfo; |
| 551 | armnn::TensorInfo outputTensorInfo; |
| 552 | |
| 553 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 554 | unsigned int outputShape[] = {2, 1}; |
| 555 | |
| 556 | armnn::StridedSliceQueueDescriptor desc; |
| 557 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 558 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 559 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 560 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 561 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 0) | (1 << 2); |
| 562 | |
| 563 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 564 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
| 565 | |
| 566 | std::vector<float> input = std::vector<float>( |
| 567 | { |
| 568 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 569 | |
| 570 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 571 | |
| 572 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 573 | }); |
| 574 | |
| 575 | std::vector<float> outputExpected = std::vector<float>( |
| 576 | { |
| 577 | 1.0f, 4.0f |
| 578 | }); |
| 579 | |
| 580 | return StridedSliceTestImpl<T, 4, 2>( |
| 581 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 582 | } |
| 583 | |
| 584 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 585 | LayerTestResult<T, 2> StridedSliceShrinkAxisMaskBitPosition0And3Test( |
| 586 | armnn::IWorkloadFactory& workloadFactory, |
| 587 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 588 | { |
| 589 | armnn::TensorInfo inputTensorInfo; |
| 590 | armnn::TensorInfo outputTensorInfo; |
| 591 | |
| 592 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 593 | unsigned int outputShape[] = {2, 3}; |
| 594 | |
| 595 | armnn::StridedSliceQueueDescriptor desc; |
| 596 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 597 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 598 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 599 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 600 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 0) | (1 << 3); |
| 601 | |
| 602 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 603 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
| 604 | |
| 605 | std::vector<float> input = std::vector<float>( |
| 606 | { |
| 607 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 608 | |
| 609 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 610 | |
| 611 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 612 | }); |
| 613 | |
| 614 | std::vector<float> outputExpected = std::vector<float>( |
| 615 | { |
| 616 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f |
| 617 | }); |
| 618 | |
| 619 | return StridedSliceTestImpl<T, 4, 2>( |
| 620 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 621 | } |
| 622 | |
| 623 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
| 624 | LayerTestResult<T, 1> StridedSliceShrinkAxisMaskBitPosition0And1And3Test( |
| 625 | armnn::IWorkloadFactory& workloadFactory, |
| 626 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 627 | { |
| 628 | armnn::TensorInfo inputTensorInfo; |
| 629 | armnn::TensorInfo outputTensorInfo; |
| 630 | |
| 631 | unsigned int inputShape[] = {3, 2, 3, 1}; |
| 632 | unsigned int outputShape[] = {3}; |
| 633 | |
| 634 | armnn::StridedSliceQueueDescriptor desc; |
| 635 | desc.m_Parameters.m_Begin = {0, 0, 0, 0}; |
| 636 | desc.m_Parameters.m_End = {1, 1, 1, 1}; |
| 637 | desc.m_Parameters.m_Stride = {1, 1, 1, 1}; |
| 638 | desc.m_Parameters.m_EndMask = (1 << 4) - 1; |
| 639 | desc.m_Parameters.m_ShrinkAxisMask = (1 << 0) | (1 << 1) | (1 << 3); |
| 640 | |
| 641 | inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); |
| 642 | outputTensorInfo = armnn::TensorInfo(1, outputShape, ArmnnType); |
| 643 | |
| 644 | std::vector<float> input = std::vector<float>( |
| 645 | { |
| 646 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, |
| 647 | |
| 648 | 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, |
| 649 | |
| 650 | 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f |
| 651 | }); |
| 652 | |
| 653 | std::vector<float> outputExpected = std::vector<float>( |
| 654 | { |
| 655 | 1.0f, 2.0f, 3.0f |
| 656 | }); |
| 657 | |
| 658 | return StridedSliceTestImpl<T, 4, 1>( |
| 659 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 660 | } |
| 661 | |
| 662 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 663 | LayerTestResult<T, 3> StridedSlice3dTest( |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 664 | armnn::IWorkloadFactory& workloadFactory, |
| 665 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 666 | { |
| 667 | armnn::TensorInfo inputTensorInfo; |
| 668 | armnn::TensorInfo outputTensorInfo; |
| 669 | |
| 670 | unsigned int inputShape[] = {3, 3, 3}; |
| 671 | unsigned int outputShape[] = {2, 2, 2}; |
| 672 | |
| 673 | armnn::StridedSliceQueueDescriptor desc; |
| 674 | desc.m_Parameters.m_Begin = {0, 0, 0}; |
| 675 | desc.m_Parameters.m_End = {1, 1, 1}; |
| 676 | desc.m_Parameters.m_Stride = {2, 2, 2}; |
| 677 | desc.m_Parameters.m_EndMask = (1 << 3) - 1; |
| 678 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 679 | inputTensorInfo = armnn::TensorInfo(3, inputShape, ArmnnType); |
| 680 | outputTensorInfo = armnn::TensorInfo(3, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 681 | |
| 682 | std::vector<float> input = std::vector<float>( |
| 683 | { |
| 684 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, |
| 685 | |
| 686 | 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, |
| 687 | |
| 688 | 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f, 25.0f, 26.0f, 27.0f |
| 689 | }); |
| 690 | |
| 691 | std::vector<float> outputExpected = std::vector<float>( |
| 692 | { |
| 693 | 1.0f, 3.0f, 7.0f, 9.0f, |
| 694 | |
| 695 | 19.0f, 21.0f, 25.0f, 27.0f |
| 696 | }); |
| 697 | |
| 698 | return StridedSliceTestImpl<T, 3, 3>( |
| 699 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 700 | } |
| 701 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 702 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 703 | LayerTestResult<T, 3> StridedSlice3dReverseTest( |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 704 | armnn::IWorkloadFactory& workloadFactory, |
| 705 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 706 | { |
| 707 | armnn::TensorInfo inputTensorInfo; |
| 708 | armnn::TensorInfo outputTensorInfo; |
| 709 | |
| 710 | unsigned int inputShape[] = {3, 3, 3}; |
| 711 | unsigned int outputShape[] = {2, 2, 2}; |
| 712 | |
| 713 | armnn::StridedSliceQueueDescriptor desc; |
| 714 | desc.m_Parameters.m_Begin = {-1, -1, -1}; |
| 715 | desc.m_Parameters.m_End = {-4, -4, -4}; |
| 716 | desc.m_Parameters.m_Stride = {-2, -2, -2}; |
| 717 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 718 | inputTensorInfo = armnn::TensorInfo(3, inputShape, ArmnnType); |
| 719 | outputTensorInfo = armnn::TensorInfo(3, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 720 | |
| 721 | std::vector<float> input = std::vector<float>( |
| 722 | { |
| 723 | 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, |
| 724 | |
| 725 | 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, |
| 726 | |
| 727 | 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f, 25.0f, 26.0f, 27.0f |
| 728 | }); |
| 729 | |
| 730 | std::vector<float> outputExpected = std::vector<float>( |
| 731 | { |
| 732 | 27.0f, 25.0f, 21.0f, 19.0f, |
| 733 | |
| 734 | 9.0f, 7.0f, 3.0f, 1.0f |
| 735 | }); |
| 736 | |
| 737 | return StridedSliceTestImpl<T, 3, 3>( |
| 738 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 739 | } |
| 740 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 741 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 742 | LayerTestResult<T, 2> StridedSlice2dTest( |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 743 | armnn::IWorkloadFactory& workloadFactory, |
| 744 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 745 | { |
| 746 | armnn::TensorInfo inputTensorInfo; |
| 747 | armnn::TensorInfo outputTensorInfo; |
| 748 | |
| 749 | unsigned int inputShape[] = {3, 3}; |
| 750 | unsigned int outputShape[] = {2, 2}; |
| 751 | |
| 752 | armnn::StridedSliceQueueDescriptor desc; |
| 753 | desc.m_Parameters.m_Begin = {0, 0}; |
| 754 | desc.m_Parameters.m_End = {1, 1}; |
| 755 | desc.m_Parameters.m_Stride = {2, 2}; |
| 756 | desc.m_Parameters.m_EndMask = (1 << 2) - 1; |
| 757 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 758 | inputTensorInfo = armnn::TensorInfo(2, inputShape, ArmnnType); |
| 759 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 760 | |
| 761 | std::vector<float> input = std::vector<float>( |
| 762 | { |
| 763 | 1.0f, 2.0f, 3.0f, |
| 764 | |
| 765 | 4.0f, 5.0f, 6.0f, |
| 766 | |
| 767 | 7.0f, 8.0f, 9.0f |
| 768 | }); |
| 769 | |
| 770 | std::vector<float> outputExpected = std::vector<float>( |
| 771 | { |
| 772 | 1.0f, 3.0f, |
| 773 | |
| 774 | 7.0f, 9.0f |
| 775 | }); |
| 776 | |
| 777 | return StridedSliceTestImpl<T, 2, 2>( |
| 778 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 779 | } |
| 780 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 781 | template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 782 | LayerTestResult<T, 2> StridedSlice2dReverseTest( |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 783 | armnn::IWorkloadFactory& workloadFactory, |
| 784 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 785 | { |
| 786 | armnn::TensorInfo inputTensorInfo; |
| 787 | armnn::TensorInfo outputTensorInfo; |
| 788 | |
| 789 | unsigned int inputShape[] = {3, 3}; |
| 790 | unsigned int outputShape[] = {2, 2}; |
| 791 | |
| 792 | armnn::StridedSliceQueueDescriptor desc; |
| 793 | desc.m_Parameters.m_Begin = {0, 0}; |
| 794 | desc.m_Parameters.m_End = {1, 1}; |
| 795 | desc.m_Parameters.m_Stride = {-2, -2}; |
| 796 | desc.m_Parameters.m_BeginMask = (1 << 2) - 1; |
| 797 | desc.m_Parameters.m_EndMask = (1 << 2) - 1; |
| 798 | |
Nattapat Chaimanowong | 649dd95 | 2019-01-22 16:10:44 +0000 | [diff] [blame] | 799 | inputTensorInfo = armnn::TensorInfo(2, inputShape, ArmnnType); |
| 800 | outputTensorInfo = armnn::TensorInfo(2, outputShape, ArmnnType); |
Nattapat Chaimanowong | 1216b58 | 2018-11-23 15:33:41 +0000 | [diff] [blame] | 801 | |
| 802 | std::vector<float> input = std::vector<float>( |
| 803 | { |
| 804 | 1.0f, 2.0f, 3.0f, |
| 805 | |
| 806 | 4.0f, 5.0f, 6.0f, |
| 807 | |
| 808 | 7.0f, 8.0f, 9.0f |
| 809 | }); |
| 810 | |
| 811 | std::vector<float> outputExpected = std::vector<float>( |
| 812 | { |
| 813 | 9.0f, 7.0f, |
| 814 | |
| 815 | 3.0f, 1.0f |
| 816 | }); |
| 817 | |
| 818 | return StridedSliceTestImpl<T, 2, 2>( |
| 819 | workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected, desc); |
| 820 | } |
| 821 | |
| 822 | } // anonymous namespace |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 823 | |
| 824 | LayerTestResult<float, 4> StridedSlice4dFloat32Test( |
| 825 | armnn::IWorkloadFactory& workloadFactory, |
| 826 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 827 | { |
| 828 | return StridedSlice4dTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 829 | } |
| 830 | |
| 831 | LayerTestResult<float, 4> StridedSlice4dReverseFloat32Test( |
| 832 | armnn::IWorkloadFactory& workloadFactory, |
| 833 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 834 | { |
| 835 | return StridedSlice4dReverseTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 836 | } |
| 837 | |
| 838 | LayerTestResult<float, 4> StridedSliceSimpleStrideFloat32Test( |
| 839 | armnn::IWorkloadFactory& workloadFactory, |
| 840 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 841 | { |
| 842 | return StridedSliceSimpleStrideTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 843 | } |
| 844 | |
| 845 | LayerTestResult<float, 4> StridedSliceSimpleRangeMaskFloat32Test( |
| 846 | armnn::IWorkloadFactory& workloadFactory, |
| 847 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 848 | { |
| 849 | return StridedSliceSimpleRangeMaskTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 850 | } |
| 851 | |
| 852 | LayerTestResult<float, 2> StridedSliceShrinkAxisMaskFloat32Test( |
| 853 | armnn::IWorkloadFactory& workloadFactory, |
| 854 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 855 | { |
| 856 | return StridedSliceShrinkAxisMaskTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 857 | } |
| 858 | |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 859 | LayerTestResult<float, 4> StridedSliceShrinkAxisMaskCTSFloat32Test( |
| 860 | armnn::IWorkloadFactory& workloadFactory, |
| 861 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 862 | { |
| 863 | return StridedSliceShrinkAxisMaskCTSTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 864 | } |
| 865 | |
| 866 | LayerTestResult<float, 2> StridedSliceShrinkAxisMaskBitPosition0Dim3Float32Test( |
| 867 | armnn::IWorkloadFactory& workloadFactory, |
| 868 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 869 | { |
| 870 | return StridedSliceShrinkAxisMaskBitPosition0Dim3Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 871 | } |
| 872 | |
| 873 | LayerTestResult<float, 3> StridedSliceShrinkAxisMaskBitPosition0Float32Test( |
| 874 | armnn::IWorkloadFactory& workloadFactory, |
| 875 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 876 | { |
| 877 | return StridedSliceShrinkAxisMaskBitPosition0Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 878 | } |
| 879 | |
| 880 | LayerTestResult<float, 3> StridedSliceShrinkAxisMaskBitPosition1Float32Test( |
| 881 | armnn::IWorkloadFactory& workloadFactory, |
| 882 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 883 | { |
| 884 | return StridedSliceShrinkAxisMaskBitPosition1Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 885 | } |
| 886 | |
| 887 | LayerTestResult<float, 3> StridedSliceShrinkAxisMaskBitPosition2Float32Test( |
| 888 | armnn::IWorkloadFactory& workloadFactory, |
| 889 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 890 | { |
| 891 | return StridedSliceShrinkAxisMaskBitPosition2Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 892 | } |
| 893 | |
| 894 | LayerTestResult<float, 3> StridedSliceShrinkAxisMaskBitPosition3Float32Test( |
| 895 | armnn::IWorkloadFactory& workloadFactory, |
| 896 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 897 | { |
| 898 | return StridedSliceShrinkAxisMaskBitPosition3Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 899 | } |
| 900 | |
| 901 | LayerTestResult<float, 2> StridedSliceShrinkAxisMaskBitPosition0And1Float32Test( |
| 902 | armnn::IWorkloadFactory& workloadFactory, |
| 903 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 904 | { |
| 905 | return StridedSliceShrinkAxisMaskBitPosition0And1Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 906 | } |
| 907 | |
| 908 | LayerTestResult<float, 2> StridedSliceShrinkAxisMaskBitPosition0And2Float32Test( |
| 909 | armnn::IWorkloadFactory& workloadFactory, |
| 910 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 911 | { |
| 912 | return StridedSliceShrinkAxisMaskBitPosition0And2Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 913 | } |
| 914 | |
| 915 | LayerTestResult<float, 2> StridedSliceShrinkAxisMaskBitPosition0And3Float32Test( |
| 916 | armnn::IWorkloadFactory& workloadFactory, |
| 917 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 918 | { |
| 919 | return StridedSliceShrinkAxisMaskBitPosition0And3Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 920 | } |
| 921 | |
| 922 | LayerTestResult<float, 1> StridedSliceShrinkAxisMaskBitPosition0And1And3Float32Test( |
| 923 | armnn::IWorkloadFactory& workloadFactory, |
| 924 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 925 | { |
| 926 | return StridedSliceShrinkAxisMaskBitPosition0And1And3Test<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 927 | } |
| 928 | |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 929 | LayerTestResult<float, 3> StridedSlice3dFloat32Test( |
| 930 | armnn::IWorkloadFactory& workloadFactory, |
| 931 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 932 | { |
| 933 | return StridedSlice3dTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 934 | } |
| 935 | |
| 936 | LayerTestResult<float, 3> StridedSlice3dReverseFloat32Test( |
| 937 | armnn::IWorkloadFactory& workloadFactory, |
| 938 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 939 | { |
| 940 | return StridedSlice3dReverseTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 941 | } |
| 942 | |
| 943 | LayerTestResult<float, 2> StridedSlice2dFloat32Test( |
| 944 | armnn::IWorkloadFactory& workloadFactory, |
| 945 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 946 | { |
| 947 | return StridedSlice2dTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 948 | } |
| 949 | |
| 950 | LayerTestResult<float, 2> StridedSlice2dReverseFloat32Test( |
| 951 | armnn::IWorkloadFactory& workloadFactory, |
| 952 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 953 | { |
| 954 | return StridedSlice2dReverseTest<armnn::DataType::Float32>(workloadFactory, memoryManager); |
| 955 | } |
| 956 | |
| 957 | LayerTestResult<uint8_t, 4> StridedSlice4dUint8Test( |
| 958 | armnn::IWorkloadFactory& workloadFactory, |
| 959 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 960 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 961 | return StridedSlice4dTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 962 | } |
| 963 | |
| 964 | LayerTestResult<uint8_t, 4> StridedSlice4dReverseUint8Test( |
| 965 | armnn::IWorkloadFactory& workloadFactory, |
| 966 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 967 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 968 | return StridedSlice4dReverseTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 969 | } |
| 970 | |
| 971 | LayerTestResult<uint8_t, 4> StridedSliceSimpleStrideUint8Test( |
| 972 | armnn::IWorkloadFactory& workloadFactory, |
| 973 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 974 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 975 | return StridedSliceSimpleStrideTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 976 | } |
| 977 | |
| 978 | LayerTestResult<uint8_t, 4> StridedSliceSimpleRangeMaskUint8Test( |
| 979 | armnn::IWorkloadFactory& workloadFactory, |
| 980 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 981 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 982 | return StridedSliceSimpleRangeMaskTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 983 | } |
| 984 | |
| 985 | LayerTestResult<uint8_t, 2> StridedSliceShrinkAxisMaskUint8Test( |
| 986 | armnn::IWorkloadFactory& workloadFactory, |
| 987 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 988 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 989 | return StridedSliceShrinkAxisMaskTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 990 | } |
| 991 | |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 992 | LayerTestResult<uint8_t, 2> StridedSliceShrinkAxisMaskBitPosition0Dim3Uint8Test( |
| 993 | armnn::IWorkloadFactory& workloadFactory, |
| 994 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 995 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 996 | return StridedSliceShrinkAxisMaskBitPosition0Dim3Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 997 | memoryManager); |
| 998 | } |
| 999 | |
| 1000 | LayerTestResult<uint8_t, 3> StridedSliceShrinkAxisMaskBitPosition0Uint8Test( |
| 1001 | armnn::IWorkloadFactory& workloadFactory, |
| 1002 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1003 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1004 | return StridedSliceShrinkAxisMaskBitPosition0Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1005 | memoryManager); |
| 1006 | } |
| 1007 | |
| 1008 | LayerTestResult<uint8_t, 3> StridedSliceShrinkAxisMaskBitPosition1Uint8Test( |
| 1009 | armnn::IWorkloadFactory& workloadFactory, |
| 1010 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1011 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1012 | return StridedSliceShrinkAxisMaskBitPosition1Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1013 | memoryManager); |
| 1014 | } |
| 1015 | |
| 1016 | LayerTestResult<uint8_t, 3> StridedSliceShrinkAxisMaskBitPosition2Uint8Test( |
| 1017 | armnn::IWorkloadFactory& workloadFactory, |
| 1018 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1019 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1020 | return StridedSliceShrinkAxisMaskBitPosition2Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1021 | memoryManager); |
| 1022 | } |
| 1023 | |
| 1024 | LayerTestResult<uint8_t, 3> StridedSliceShrinkAxisMaskBitPosition3Uint8Test( |
| 1025 | armnn::IWorkloadFactory& workloadFactory, |
| 1026 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1027 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1028 | return StridedSliceShrinkAxisMaskBitPosition3Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1029 | memoryManager); |
| 1030 | } |
| 1031 | |
| 1032 | LayerTestResult<uint8_t, 2> StridedSliceShrinkAxisMaskBitPosition0And1Uint8Test( |
| 1033 | armnn::IWorkloadFactory& workloadFactory, |
| 1034 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1035 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1036 | return StridedSliceShrinkAxisMaskBitPosition0And1Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1037 | memoryManager); |
| 1038 | } |
| 1039 | |
| 1040 | LayerTestResult<uint8_t, 2> StridedSliceShrinkAxisMaskBitPosition0And2Uint8Test( |
| 1041 | armnn::IWorkloadFactory& workloadFactory, |
| 1042 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1043 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1044 | return StridedSliceShrinkAxisMaskBitPosition0And2Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1045 | memoryManager); |
| 1046 | } |
| 1047 | |
| 1048 | LayerTestResult<uint8_t, 2> StridedSliceShrinkAxisMaskBitPosition0And3Uint8Test( |
| 1049 | armnn::IWorkloadFactory& workloadFactory, |
| 1050 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1051 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1052 | return StridedSliceShrinkAxisMaskBitPosition0And3Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1053 | memoryManager); |
| 1054 | } |
| 1055 | |
| 1056 | LayerTestResult<uint8_t, 1> StridedSliceShrinkAxisMaskBitPosition0And1And3Uint8Test( |
| 1057 | armnn::IWorkloadFactory& workloadFactory, |
| 1058 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1059 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1060 | return StridedSliceShrinkAxisMaskBitPosition0And1And3Test<armnn::DataType::QAsymmU8>(workloadFactory, |
Francis Murtagh | ec33a91 | 2019-11-05 14:26:23 +0000 | [diff] [blame] | 1061 | memoryManager); |
| 1062 | } |
| 1063 | |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1064 | LayerTestResult<uint8_t, 3> StridedSlice3dUint8Test( |
| 1065 | armnn::IWorkloadFactory& workloadFactory, |
| 1066 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1067 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1068 | return StridedSlice3dTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1069 | } |
| 1070 | |
| 1071 | LayerTestResult<uint8_t, 3> StridedSlice3dReverseUint8Test( |
| 1072 | armnn::IWorkloadFactory& workloadFactory, |
| 1073 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1074 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1075 | return StridedSlice3dReverseTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1076 | } |
| 1077 | |
| 1078 | LayerTestResult<uint8_t, 2> StridedSlice2dUint8Test( |
| 1079 | armnn::IWorkloadFactory& workloadFactory, |
| 1080 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1081 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1082 | return StridedSlice2dTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1083 | } |
| 1084 | |
| 1085 | LayerTestResult<uint8_t, 2> StridedSlice2dReverseUint8Test( |
| 1086 | armnn::IWorkloadFactory& workloadFactory, |
| 1087 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1088 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1089 | return StridedSlice2dReverseTest<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1090 | } |
| 1091 | |
| 1092 | LayerTestResult<int16_t, 4> StridedSlice4dInt16Test( |
| 1093 | armnn::IWorkloadFactory& workloadFactory, |
| 1094 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1095 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1096 | return StridedSlice4dTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1097 | } |
| 1098 | |
| 1099 | LayerTestResult<int16_t, 4> StridedSlice4dReverseInt16Test( |
| 1100 | armnn::IWorkloadFactory& workloadFactory, |
| 1101 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1102 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1103 | return StridedSlice4dReverseTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1104 | } |
| 1105 | |
| 1106 | LayerTestResult<int16_t, 4> StridedSliceSimpleStrideInt16Test( |
| 1107 | armnn::IWorkloadFactory& workloadFactory, |
| 1108 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1109 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1110 | return StridedSliceSimpleStrideTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1111 | } |
| 1112 | |
| 1113 | LayerTestResult<int16_t, 4> StridedSliceSimpleRangeMaskInt16Test( |
| 1114 | armnn::IWorkloadFactory& workloadFactory, |
| 1115 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1116 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1117 | return StridedSliceSimpleRangeMaskTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1118 | } |
| 1119 | |
| 1120 | LayerTestResult<int16_t, 2> StridedSliceShrinkAxisMaskInt16Test( |
| 1121 | armnn::IWorkloadFactory& workloadFactory, |
| 1122 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1123 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1124 | return StridedSliceShrinkAxisMaskTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1125 | } |
| 1126 | |
| 1127 | LayerTestResult<int16_t, 3> StridedSlice3dInt16Test( |
| 1128 | armnn::IWorkloadFactory& workloadFactory, |
| 1129 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1130 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1131 | return StridedSlice3dTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1132 | } |
| 1133 | |
| 1134 | LayerTestResult<int16_t, 3> StridedSlice3dReverseInt16Test( |
| 1135 | armnn::IWorkloadFactory& workloadFactory, |
| 1136 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1137 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1138 | return StridedSlice3dReverseTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1139 | } |
| 1140 | |
| 1141 | LayerTestResult<int16_t, 2> StridedSlice2dInt16Test( |
| 1142 | armnn::IWorkloadFactory& workloadFactory, |
| 1143 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1144 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1145 | return StridedSlice2dTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1146 | } |
| 1147 | |
| 1148 | LayerTestResult<int16_t, 2> StridedSlice2dReverseInt16Test( |
| 1149 | armnn::IWorkloadFactory& workloadFactory, |
| 1150 | const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |
| 1151 | { |
Derek Lamberti | f90c56d | 2020-01-10 17:14:08 +0000 | [diff] [blame] | 1152 | return StridedSlice2dReverseTest<armnn::DataType::QSymmS16>(workloadFactory, memoryManager); |
Aron Virginas-Tar | 00d306e | 2019-08-28 18:08:46 +0100 | [diff] [blame] | 1153 | } |