Aron Virginas-Tar | e89ebad | 2019-08-27 18:14:26 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/Tensor.hpp> |
Narumol Prangnawarat | ac2770a | 2020-04-01 16:51:23 +0100 | [diff] [blame] | 9 | #include <armnn/utility/Assert.hpp> |
Aron Virginas-Tar | e89ebad | 2019-08-27 18:14:26 +0100 | [diff] [blame] | 10 | |
| 11 | #include <boost/multi_array.hpp> |
| 12 | |
| 13 | #include <cstddef> |
| 14 | |
| 15 | template <std::size_t n> |
| 16 | boost::array<unsigned int, n> GetTensorShapeAsArray(const armnn::TensorInfo& tensorInfo) |
| 17 | { |
Narumol Prangnawarat | ac2770a | 2020-04-01 16:51:23 +0100 | [diff] [blame] | 18 | ARMNN_ASSERT_MSG(n == tensorInfo.GetNumDimensions(), |
Aron Virginas-Tar | e89ebad | 2019-08-27 18:14:26 +0100 | [diff] [blame] | 19 | "Attempting to construct a shape array of mismatching size"); |
| 20 | |
| 21 | boost::array<unsigned int, n> shape; |
| 22 | for (unsigned int i = 0; i < n; i++) |
| 23 | { |
| 24 | shape[i] = tensorInfo.GetShape()[i]; |
| 25 | } |
| 26 | return shape; |
| 27 | } |
| 28 | |
| 29 | template <typename T, std::size_t n> |
| 30 | struct LayerTestResult |
| 31 | { |
| 32 | LayerTestResult(const armnn::TensorInfo& outputInfo) |
| 33 | { |
| 34 | auto shape( GetTensorShapeAsArray<n>(outputInfo) ); |
| 35 | output.resize(shape); |
| 36 | outputExpected.resize(shape); |
| 37 | supported = true; |
| 38 | compareBoolean = false; |
| 39 | } |
| 40 | |
| 41 | boost::multi_array<T, n> output; |
| 42 | boost::multi_array<T, n> outputExpected; |
| 43 | bool supported; |
| 44 | bool compareBoolean; |
| 45 | }; |