diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-08-27 18:14:26 +0100 |
---|---|---|
committer | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-08-27 18:16:18 +0100 |
commit | e89ebad9cd78096d9c18a28fa01337dd622f5081 (patch) | |
tree | 844acd0106e586261f52ab422f89832eb268c23d /src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp | |
parent | db16dd33fe124d25ef376b1bec41272d397b67cd (diff) | |
download | armnn-e89ebad9cd78096d9c18a28fa01337dd622f5081.tar.gz |
IVGCVSW-2325 Reduce duplication in LayerTests by reusing the ElementwiseTestHelper
* Refactored tests for element-wise operations to use ElementwiseTestHelper
* Moved the etasts for each operation in a separate file under backendsCommon/test/layerTests
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: Icefb6b35df78b9619f69378229789505bf92670e
Diffstat (limited to 'src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp')
-rw-r--r-- | src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp b/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp new file mode 100644 index 0000000000..c277d2d5e1 --- /dev/null +++ b/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp @@ -0,0 +1,44 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include <armnn/Tensor.hpp> + +#include <boost/multi_array.hpp> + +#include <cstddef> + +template <std::size_t n> +boost::array<unsigned int, n> GetTensorShapeAsArray(const armnn::TensorInfo& tensorInfo) +{ + BOOST_ASSERT_MSG(n == tensorInfo.GetNumDimensions(), + "Attempting to construct a shape array of mismatching size"); + + boost::array<unsigned int, n> shape; + for (unsigned int i = 0; i < n; i++) + { + shape[i] = tensorInfo.GetShape()[i]; + } + return shape; +} + +template <typename T, std::size_t n> +struct LayerTestResult +{ + LayerTestResult(const armnn::TensorInfo& outputInfo) + { + auto shape( GetTensorShapeAsArray<n>(outputInfo) ); + output.resize(shape); + outputExpected.resize(shape); + supported = true; + compareBoolean = false; + } + + boost::multi_array<T, n> output; + boost::multi_array<T, n> outputExpected; + bool supported; + bool compareBoolean; +}; |