2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
7 #include "TensorCopyUtils.hpp"
8 #include "WorkloadTestUtils.hpp"
10 #include <armnn/test/TensorHelpers.hpp>
12 #include <boost/numeric/conversion/cast.hpp>
13 #include <boost/multi_array.hpp>
15 struct ActivationFixture
19 auto boostArrayExtents = boost::extents
20 [boost::numeric_cast<boost::multi_array_types::extent_gen::index>(batchSize)]
21 [boost::numeric_cast<boost::multi_array_types::extent_gen::index>(channels)]
22 [boost::numeric_cast<boost::multi_array_types::extent_gen::index>(height)]
23 [boost::numeric_cast<boost::multi_array_types::extent_gen::index>(width)];
24 output.resize(boostArrayExtents);
25 outputExpected.resize(boostArrayExtents);
26 input.resize(boostArrayExtents);
28 unsigned int inputShape[] = { batchSize, channels, height, width };
29 unsigned int outputShape[] = { batchSize, channels, height, width };
31 inputTensorInfo = armnn::TensorInfo(4, inputShape, armnn::DataType::Float32);
32 outputTensorInfo = armnn::TensorInfo(4, outputShape, armnn::DataType::Float32);
34 input = MakeRandomTensor<float, 4>(inputTensorInfo, 21453);
37 unsigned int width = 17;
38 unsigned int height = 29;
39 unsigned int channels = 2;
40 unsigned int batchSize = 5;
42 boost::multi_array<float, 4> output;
43 boost::multi_array<float, 4> outputExpected;
44 boost::multi_array<float, 4> input;
46 armnn::TensorInfo inputTensorInfo;
47 armnn::TensorInfo outputTensorInfo;
49 // Parameters used by some of the activation functions.
55 struct PositiveActivationFixture : public ActivationFixture
57 PositiveActivationFixture()
59 input = MakeRandomTensor<float, 4>(inputTensorInfo, 2342423, 0.0f, 1.0f);