• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <armnn/utility/Assert.hpp>
10 
11 #include <boost/multi_array.hpp>
12 
13 #include <cstddef>
14 
15 template <std::size_t n>
GetTensorShapeAsArray(const armnn::TensorInfo & tensorInfo)16 boost::array<unsigned int, n> GetTensorShapeAsArray(const armnn::TensorInfo& tensorInfo)
17 {
18     ARMNN_ASSERT_MSG(n == tensorInfo.GetNumDimensions(),
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 {
LayerTestResultLayerTestResult32     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 };
46