telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | #pragma once |
| 6 | |
Sadik Armagan | a097d2a | 2021-11-24 15:47:28 +0000 | [diff] [blame] | 7 | #include <armnnTestUtils/TensorCopyUtils.hpp> |
Colm Donelan | 0c47974 | 2021-12-10 12:43:54 +0000 | [diff] [blame] | 8 | #include <armnnTestUtils/WorkloadTestUtils.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 9 | |
Matthew Sloyan | 171214c | 2020-09-09 09:07:37 +0100 | [diff] [blame] | 10 | #include <armnn/utility/NumericCast.hpp> |
| 11 | |
Colm Donelan | c42a987 | 2022-02-02 16:35:09 +0000 | [diff] [blame] | 12 | #include <armnnTestUtils/TensorHelpers.hpp> |
arovir01 | 43095f3 | 2018-10-09 18:04:24 +0100 | [diff] [blame] | 13 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 14 | struct ActivationFixture |
| 15 | { |
| 16 | ActivationFixture() |
| 17 | { |
Sadik Armagan | 483c811 | 2021-06-01 09:24:52 +0100 | [diff] [blame] | 18 | output.resize(batchSize * channels * height * width); |
| 19 | outputExpected.resize(batchSize * channels * height * width); |
| 20 | input.resize(batchSize * channels * height * width); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 21 | |
| 22 | unsigned int inputShape[] = { batchSize, channels, height, width }; |
| 23 | unsigned int outputShape[] = { batchSize, channels, height, width }; |
| 24 | |
| 25 | inputTensorInfo = armnn::TensorInfo(4, inputShape, armnn::DataType::Float32); |
| 26 | outputTensorInfo = armnn::TensorInfo(4, outputShape, armnn::DataType::Float32); |
| 27 | |
Sadik Armagan | 483c811 | 2021-06-01 09:24:52 +0100 | [diff] [blame] | 28 | input = MakeRandomTensor<float>(inputTensorInfo, 21453); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | unsigned int width = 17; |
| 32 | unsigned int height = 29; |
| 33 | unsigned int channels = 2; |
| 34 | unsigned int batchSize = 5; |
| 35 | |
Sadik Armagan | 483c811 | 2021-06-01 09:24:52 +0100 | [diff] [blame] | 36 | std::vector<float> output; |
| 37 | std::vector<float> outputExpected; |
| 38 | std::vector<float> input; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 39 | |
| 40 | armnn::TensorInfo inputTensorInfo; |
| 41 | armnn::TensorInfo outputTensorInfo; |
| 42 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 43 | // Parameters used by some of the activation functions. |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 44 | float a = 0.234f; |
| 45 | float b = -12.345f; |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | struct PositiveActivationFixture : public ActivationFixture |
| 50 | { |
| 51 | PositiveActivationFixture() |
| 52 | { |
Sadik Armagan | 483c811 | 2021-06-01 09:24:52 +0100 | [diff] [blame] | 53 | input = MakeRandomTensor<float>(inputTensorInfo, 2342423, 0.0f, 1.0f); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 54 | } |
| 55 | }; |