11 std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::MultiplicationQueueDescriptor>(
16 return workloadFactory.CreateMultiplication(descriptor, info);
22 const unsigned int width = 2u;
23 const unsigned int height = 2u;
24 const unsigned int channelCount = 2u;
25 const unsigned int batchSize = 2u;
27 unsigned int shape[] = { batchSize, channelCount, height, width };
29 std::vector<float> input0 =
31 1, 1, 1, 1, 2, 2, 2, 2,
32 3, 3, 3, 3, 4, 4, 4, 4
35 std::vector<float> input1 =
37 2, 2, 2, 2, 3, 3, 3, 3,
38 4, 4, 4, 4, 5, 5, 5, 5
41 std::vector<float> output =
43 2, 2, 2, 2, 6, 6, 6, 6,
44 12, 12, 12, 12, 20, 20, 20, 20
47 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::Float32>(
61 const unsigned int width = 3u;
62 const unsigned int height = 2u;
63 const unsigned int channelCount = 2u;
64 const unsigned int batchSize = 2u;;
65 const unsigned int depth = 2u;
67 unsigned int shape[] = { depth, batchSize, channelCount, height, width };
69 std::vector<float> input0 =
71 1.80f, 0.20f, 2.30f, 1.30f, 2.10f, 1.00f,
72 2.60f, 0.60f, 2.10f, 2.30f, 2.30f, 2.00f,
74 2.50f, 1.00f, 2.90f, 3.10f, 1.50f, 2.40f,
75 2.80f, 1.10f, 1.00f, 3.20f, 1.00f, 2.30f,
78 0.30f, 2.20f, 1.00f, 0.20f, 1.60f, 1.40f,
79 0.80f, 3.20f, 0.10f, 0.10f, 3.10f, 2.10f,
81 1.50f, 2.40f, 1.40f, 0.70f, 2.40f, 1.40f,
82 1.60f, 1.20f, 1.90f, 0.80f, 0.00f, 0.10f,
85 std::vector<float> input1 =
87 0.70f, 1.00f, 2.90f, 2.20f, 3.10f, 2.80f,
88 1.80f, 2.00f, 0.50f, 2.30f, 1.20f, 2.70f,
90 2.40f, 0.20f, 3.20f, 1.60f, 0.20f, 2.50f,
91 2.30f, 0.70f, 2.70f, 1.80f, 2.90f, 2.70f,
94 3.20f, 3.20f, 0.70f, 1.90f, 2.70f, 2.50f,
95 2.40f, 0.90f, 2.30f, 1.80f, 2.50f, 2.00f,
97 1.60f, 2.20f, 1.60f, 2.00f, 0.30f, 3.20f,
98 0.40f, 3.00f, 2.60f, 0.30f, 0.00f, 2.50f,
101 std::vector<float> output =
103 1.26f, 0.20f, 6.67f, 2.86f, 6.51f, 2.80f,
104 4.68f, 1.20f, 1.05f, 5.29f, 2.76f, 5.40f,
106 6.00f, 0.20f, 9.28f, 4.96f, 0.30f, 6.00f,
107 6.44f, 0.77f, 2.70f, 5.76f, 2.90f, 6.21f,
110 0.96f, 7.04f, 0.70f, 0.38f, 4.32f, 3.50f,
111 1.92f, 2.88f, 0.23f, 0.18f, 7.75f, 4.20f,
113 2.40f, 5.28f, 2.24f, 1.40f, 0.72f, 4.48f,
114 0.64f, 3.60f, 4.94f, 0.24f, 0.00f, 0.25f,
117 return ElementwiseTestHelper<5, armnn::MultiplicationQueueDescriptor, armnn::DataType::Float32>(
132 unsigned int shape0[] = { 1, 2, 2, 2 };
133 unsigned int shape1[] = { 1, 1, 1, 1 };
135 std::vector<float> input0 = { 1, 2, 3, 4, 5, 6, 7, 8};
137 std::vector<float> input1 = { 2 };
139 std::vector<float> output = { 2, 4, 6, 8, 10, 12, 14, 16};
141 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::Float32>(
156 unsigned int shape0[] = { 1, 3, 3, 2 };
157 unsigned int shape1[] = { 1, 1, 1, 2 };
159 std::vector<float> input0 =
163 13, 14, 15, 16, 17, 18
166 std::vector<float> input1 = { 1, 2 };
168 std::vector<float> output =
171 7, 16, 9, 20, 11, 24,
172 13, 28, 15, 32, 17, 36
175 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::Float32>(
190 constexpr
unsigned int batchSize = 1u;
191 constexpr
unsigned int channels = 2u;
192 constexpr
unsigned int height = 2u;
193 constexpr
unsigned int width = 3u;
195 const unsigned int shape[] = { batchSize, channels, height, width };
198 std::vector<uint8_t> input0 =
200 62, 37, 3, 172, 13, 111,
201 188, 20, 73, 31, 23, 31
205 std::vector<uint8_t> input1 =
207 126, 240, 252, 183, 121, 247,
208 48, 115, 151, 79, 78, 97
212 std::vector<uint8_t> output =
214 64, 72, 0, 255, 8, 236,
215 77, 15, 92, 16, 10, 21,
219 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::QAsymmU8>(
240 const unsigned int shape0[] = { 1, 2, 2, 3 };
241 const unsigned int shape1[] = { 1, 1, 1, 1 };
243 std::vector<uint8_t> input0 =
249 std::vector<uint8_t> input1 = { 2 };
251 std::vector<uint8_t> output =
254 14, 16, 18, 20, 22, 24
257 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::QAsymmU8>(
272 const unsigned int shape0[] = { 1, 2, 2, 3 };
273 const unsigned int shape1[] = { 1, 1, 1, 3 };
275 std::vector<uint8_t> input0 =
281 std::vector<uint8_t> input1 = { 1, 2, 3 };
283 std::vector<uint8_t> output =
286 7, 16, 27, 10, 22, 36
289 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::QAsymmU8>(
304 const unsigned int shape[] = { 1, 2, 2, 3 };
306 std::vector<int16_t> input0 =
309 12, 13, 14, 15, 16, 17
312 std::vector<int16_t> input1 =
318 std::vector<int16_t> output =
320 6, 14, 24, 36, 50, 66,
321 84, 104, 126, 150, 176, 204
324 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::QSymmS16>(
339 const unsigned int shape0[] = { 1, 2, 2, 3 };
340 const unsigned int shape1[] = { 1, 1, 1, 1 };
342 std::vector<int16_t> input0 =
348 std::vector<int16_t> input1 = { 2 };
350 std::vector<int16_t> output =
353 14, 16, 18, 20, 22, 24
356 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::QSymmS16>(
371 const unsigned int shape0[] = { 1, 2, 2, 3 };
372 const unsigned int shape1[] = { 1, 1, 1, 3 };
374 std::vector<int16_t> input0 =
380 std::vector<int16_t> input1 = { 1, 2, 3 };
382 std::vector<int16_t> output =
385 7, 16, 27, 10, 22, 36
388 return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::QSymmS16>(
405 const unsigned int width = 16;
406 const unsigned int height = 32;
407 const unsigned int channelCount = 2;
408 const unsigned int batchSize = 5;
414 constexpr
unsigned int shape[] = { batchSize, channelCount, height, width };
422 auto input0 = MakeRandomTensor<float, 4>(inputTensorInfo0, 803506992);
423 auto input1 = MakeRandomTensor<float, 4>(inputTensorInfo1, 54902257);
425 std::unique_ptr<armnn::ITensorHandle> inputHandle0 = workloadFactory.
CreateTensorHandle(inputTensorInfo0);
426 std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.
CreateTensorHandle(inputTensorInfo1);
427 std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.
CreateTensorHandle(outputTensorInfo);
429 std::unique_ptr<armnn::ITensorHandle> inputHandle0Ref = refWorkloadFactory.
CreateTensorHandle(inputTensorInfo0);
430 std::unique_ptr<armnn::ITensorHandle> inputHandle1Ref = refWorkloadFactory.
CreateTensorHandle(inputTensorInfo1);
431 std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refWorkloadFactory.
CreateTensorHandle(outputTensorInfo);
435 AddInputToWorkload(data, info, inputTensorInfo0, inputHandle0.get());
436 AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
437 AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
441 SetWorkloadInput(refData, refInfo, 0, inputTensorInfo0, inputHandle0Ref.get());
442 SetWorkloadInput(refData, refInfo, 1, inputTensorInfo1, inputHandle1Ref.get());
443 SetWorkloadOutput(refData, refInfo, 0, outputTensorInfo, outputHandleRef.get());
446 std::unique_ptr<armnn::IWorkload> workloadRef = refWorkloadFactory.
CreateMultiplication(refData, refInfo);
448 inputHandle0->Allocate();
449 inputHandle1->Allocate();
450 outputHandle->Allocate();
451 inputHandle0Ref->Allocate();
452 inputHandle1Ref->Allocate();
453 outputHandleRef->Allocate();
460 workload->PostAllocationConfigure();
462 workloadRef->PostAllocationConfigure();
463 workloadRef->Execute();
467 return comparisonResult;
LayerTestResult< float, 4 > MultiplicationBroadcast1DVectorTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< float, 4 > MultiplicationTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
virtual std::unique_ptr< IWorkload > CreateMultiplication(const MultiplicationQueueDescriptor &descriptor, const WorkloadInfo &info) const
LayerTestResult< float, 4 > CompareMultiplicationTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, armnn::IWorkloadFactory &refWorkloadFactory)
LayerTestResult< int16_t, 4 > MultiplicationBroadcast1DVectorInt16Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
boost::multi_array< T, n > outputExpected
void IgnoreUnused(Ts &&...)
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
LayerTestResult< int16_t, 4 > MultiplicationBroadcast1ElementInt16Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< int16_t, 4 > MultiplicationInt16Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
void CopyDataFromITensorHandle(void *memory, const armnn::ITensorHandle *tensorHandle)
virtual std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const =0
LayerTestResult< uint8_t, 4 > MultiplicationBroadcast1ElementUint8Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
boost::multi_array< T, n > output
LayerTestResult< float, 5 > Multiplication5dTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< float, 4 > MultiplicationBroadcast1ElementTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< uint8_t, 4 > MultiplicationBroadcast1DVectorUint8Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
LayerTestResult< uint8_t, 4 > MultiplicationUint8Test(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
Contains information about inputs and outputs to a layer.
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)