ArmNN
 20.02
LayerTestResult.hpp
Go to the documentation of this file.
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>
30 {
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;
44 };
boost::array< unsigned int, n > GetTensorShapeAsArray(const armnn::TensorInfo &tensorInfo)
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
LayerTestResult(const armnn::TensorInfo &outputInfo)
boost::multi_array< T, n > outputExpected
boost::multi_array< T, n > output
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:92