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> |
| 9 | |
| 10 | #include <boost/multi_array.hpp> |
| 11 | |
| 12 | #include <cstddef> |
| 13 | |
| 14 | template <std::size_t n> |
| 15 | boost::array<unsigned int, n> GetTensorShapeAsArray(const armnn::TensorInfo& tensorInfo) |
| 16 | { |
| 17 | BOOST_ASSERT_MSG(n == tensorInfo.GetNumDimensions(), |
| 18 | "Attempting to construct a shape array of mismatching size"); |
| 19 | |
| 20 | boost::array<unsigned int, n> shape; |
| 21 | for (unsigned int i = 0; i < n; i++) |
| 22 | { |
| 23 | shape[i] = tensorInfo.GetShape()[i]; |
| 24 | } |
| 25 | return shape; |
| 26 | } |
| 27 | |
| 28 | template <typename T, std::size_t n> |
| 29 | struct LayerTestResult |
| 30 | { |
| 31 | LayerTestResult(const armnn::TensorInfo& outputInfo) |
| 32 | { |
| 33 | auto shape( GetTensorShapeAsArray<n>(outputInfo) ); |
| 34 | output.resize(shape); |
| 35 | outputExpected.resize(shape); |
| 36 | supported = true; |
| 37 | compareBoolean = false; |
| 38 | } |
| 39 | |
| 40 | boost::multi_array<T, n> output; |
| 41 | boost::multi_array<T, n> outputExpected; |
| 42 | bool supported; |
| 43 | bool compareBoolean; |
| 44 | }; |