diff options
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; +}; |