ArmNN
 20.08
TensorTest.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <armnn/Tensor.hpp>
#include <armnn/utility/IgnoreUnused.hpp>

Go to the source code of this file.

Namespaces

 armnn
 Copyright (c) 2020 ARM Limited.
 

Functions

std::ostream & boost_test_print_type (std::ostream &ostr, const TensorInfo &right)
 
std::ostream & boost_test_print_type (std::ostream &ostr, const TensorShape &shape)
 
 BOOST_FIXTURE_TEST_CASE (ConstructShapeUsingListInitialization, TensorInfoFixture)
 
 BOOST_FIXTURE_TEST_CASE (ConstructTensorInfo, TensorInfoFixture)
 
 BOOST_FIXTURE_TEST_CASE (CopyConstructTensorInfo, TensorInfoFixture)
 
 BOOST_FIXTURE_TEST_CASE (TensorInfoEquality, TensorInfoFixture)
 
 BOOST_FIXTURE_TEST_CASE (TensorInfoInequality, TensorInfoFixture)
 
 BOOST_FIXTURE_TEST_CASE (TensorInfoAssignmentOperator, TensorInfoFixture)
 
void CheckTensor (const ConstTensor &t)
 
 BOOST_AUTO_TEST_CASE (TensorVsConstTensor)
 
 BOOST_AUTO_TEST_CASE (ModifyTensorInfo)
 
 BOOST_AUTO_TEST_CASE (TensorShapeOperatorBrackets)
 
 BOOST_AUTO_TEST_CASE (TensorInfoPerAxisQuantization)
 
 BOOST_AUTO_TEST_CASE (TensorShape_scalar)
 
 BOOST_AUTO_TEST_CASE (TensorShape_DynamicTensorType1_unknownNumberDimensions)
 
 BOOST_AUTO_TEST_CASE (TensorShape_DynamicTensorType1_unknownAllDimensionsSizes)
 
 BOOST_AUTO_TEST_CASE (TensorShape_DynamicTensorType1_unknownSomeDimensionsSizes)
 
 BOOST_AUTO_TEST_CASE (TensorShape_DynamicTensorType1_transitionFromUnknownToKnownDimensionsSizes)
 
 BOOST_AUTO_TEST_CASE (Tensor_emptyConstructors)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/10]

BOOST_AUTO_TEST_CASE ( TensorVsConstTensor  )

Definition at line 107 of file TensorTest.cpp.

References CheckTensor().

108 {
109  int mutableDatum = 2;
110  const int immutableDatum = 3;
111 
112  armnn::Tensor uninitializedTensor;
113  armnn::ConstTensor uninitializedTensor2;
114 
115  uninitializedTensor2 = uninitializedTensor;
116 
117  armnn::Tensor t(TensorInfo(), &mutableDatum);
118  armnn::ConstTensor ct(TensorInfo(), &immutableDatum);
119 
120  // Checks that both Tensor and ConstTensor can be passed as a ConstTensor.
121  CheckTensor(t);
122  CheckTensor(ct);
123 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290
void CheckTensor(const ConstTensor &t)
Definition: TensorTest.cpp:102
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:298

◆ BOOST_AUTO_TEST_CASE() [2/10]

BOOST_AUTO_TEST_CASE ( ModifyTensorInfo  )

Definition at line 125 of file TensorTest.cpp.

References TensorInfo::GetDataType(), TensorInfo::GetQuantizationOffset(), TensorInfo::GetQuantizationScale(), TensorInfo::GetShape(), armnn::info, armnn::QAsymmU8, TensorInfo::SetDataType(), TensorInfo::SetQuantizationOffset(), TensorInfo::SetQuantizationScale(), and TensorInfo::SetShape().

126 {
128  info.SetShape({ 5, 6, 7, 8 });
129  BOOST_TEST((info.GetShape() == TensorShape({ 5, 6, 7, 8 })));
130  info.SetDataType(DataType::QAsymmU8);
131  BOOST_TEST((info.GetDataType() == DataType::QAsymmU8));
132  info.SetQuantizationScale(10.0f);
133  BOOST_TEST(info.GetQuantizationScale() == 10.0f);
134  info.SetQuantizationOffset(5);
135  BOOST_TEST(info.GetQuantizationOffset() == 5);
136 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
void SetShape(const TensorShape &newShape)
Definition: Tensor.hpp:189
int32_t GetQuantizationOffset() const
Definition: Tensor.cpp:470
float GetQuantizationScale() const
Definition: Tensor.cpp:453
DataType GetDataType() const
Definition: Tensor.hpp:194
void SetQuantizationScale(float scale)
Definition: Tensor.cpp:465
void SetDataType(DataType type)
Definition: Tensor.hpp:195
void SetQuantizationOffset(int32_t offset)
Definition: Tensor.cpp:481

◆ BOOST_AUTO_TEST_CASE() [3/10]

BOOST_AUTO_TEST_CASE ( TensorShapeOperatorBrackets  )

Definition at line 138 of file TensorTest.cpp.

139 {
140  const TensorShape constShape({0,1,2,3});
141  TensorShape shape({0,1,2,3});
142 
143  // Checks version of operator[] which returns an unsigned int.
144  BOOST_TEST(shape[2] == 2);
145  shape[2] = 20;
146  BOOST_TEST(shape[2] == 20);
147 
148  // Checks the version of operator[] which returns a reference.
149  BOOST_TEST(constShape[2] == 2);
150 }

◆ BOOST_AUTO_TEST_CASE() [4/10]

BOOST_AUTO_TEST_CASE ( TensorInfoPerAxisQuantization  )

Definition at line 152 of file TensorTest.cpp.

References armnn::Float32, and TensorInfo::SetQuantizationScales().

153 {
154  // Old constructor
155  TensorInfo tensorInfo0({ 1, 1 }, DataType::Float32, 2.0f, 1);
156  BOOST_CHECK(!tensorInfo0.HasMultipleQuantizationScales());
157  BOOST_CHECK(tensorInfo0.GetQuantizationScale() == 2.0f);
158  BOOST_CHECK(tensorInfo0.GetQuantizationOffset() == 1);
159  BOOST_CHECK(tensorInfo0.GetQuantizationScales()[0] == 2.0f);
160  BOOST_CHECK(!tensorInfo0.GetQuantizationDim().has_value());
161 
162  // Set per-axis quantization scales
163  std::vector<float> perAxisScales{ 3.0f, 4.0f };
164  tensorInfo0.SetQuantizationScales(perAxisScales);
165  BOOST_CHECK(tensorInfo0.HasMultipleQuantizationScales());
166  BOOST_CHECK(tensorInfo0.GetQuantizationScales() == perAxisScales);
167 
168  // Set per-tensor quantization scale
169  tensorInfo0.SetQuantizationScale(5.0f);
170  BOOST_CHECK(!tensorInfo0.HasMultipleQuantizationScales());
171  BOOST_CHECK(tensorInfo0.GetQuantizationScales()[0] == 5.0f);
172 
173  // Set quantization offset
174  tensorInfo0.SetQuantizationDim(Optional<unsigned int>(1));
175  BOOST_CHECK(tensorInfo0.GetQuantizationDim().value() == 1);
176 
177  // New constructor
178  perAxisScales = { 6.0f, 7.0f };
179  TensorInfo tensorInfo1({ 1, 1 }, DataType::Float32, perAxisScales, 1);
180  BOOST_CHECK(tensorInfo1.HasMultipleQuantizationScales());
181  BOOST_CHECK(tensorInfo1.GetQuantizationOffset() == 0);
182  BOOST_CHECK(tensorInfo1.GetQuantizationScales() == perAxisScales);
183  BOOST_CHECK(tensorInfo1.GetQuantizationDim().value() == 1);
184 }
void SetQuantizationScales(const std::vector< float > &scales)
Definition: Tensor.cpp:448

◆ BOOST_AUTO_TEST_CASE() [5/10]

BOOST_AUTO_TEST_CASE ( TensorShape_scalar  )

Definition at line 186 of file TensorTest.cpp.

References TensorShape::AreAllDimensionsSpecified(), armnn::Float32, TensorShape::GetDimensionality(), TensorShape::GetDimensionSpecificity(), BaseTensor< MemoryType >::GetInfo(), BaseTensor< MemoryType >::GetMemoryArea(), TensorShape::GetNumDimensions(), TensorShape::GetNumElements(), TensorInfo::GetShape(), BaseTensor< MemoryType >::GetShape(), armnn::info, TensorShape::IsAtLeastOneDimensionSpecified(), and armnn::Scalar.

187 {
188  float mutableDatum = 3.1416f;
189 
191  armnn::TensorInfo info ( shape, DataType::Float32 );
192  const armnn::Tensor tensor ( info, &mutableDatum );
193 
194  BOOST_CHECK(armnn::Dimensionality::Scalar == shape.GetDimensionality());
195  float scalarValue = *reinterpret_cast<float*>(tensor.GetMemoryArea());
196  BOOST_CHECK_MESSAGE(mutableDatum == scalarValue, "Scalar value is " << scalarValue);
197 
198  armnn::TensorShape shape_equal;
199  armnn::TensorShape shape_different;
200  shape_equal = shape;
201  BOOST_TEST(shape_equal == shape);
202  BOOST_TEST(shape_different != shape);
203  BOOST_CHECK_MESSAGE(1 == shape.GetNumElements(), "Number of elements is " << shape.GetNumElements());
204  BOOST_CHECK_MESSAGE(1 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
205  BOOST_CHECK(true == shape.GetDimensionSpecificity(0));
206  BOOST_CHECK(shape.AreAllDimensionsSpecified());
207  BOOST_CHECK(shape.IsAtLeastOneDimensionSpecified());
208 
209  BOOST_TEST(1 == shape[0]);
210  BOOST_TEST(1 == tensor.GetShape()[0]);
211  BOOST_TEST(1 == tensor.GetInfo().GetShape()[0]);
212  BOOST_CHECK_THROW( shape[1], InvalidArgumentException );
213 
214  float newMutableDatum = 42.f;
215  std::memcpy(tensor.GetMemoryArea(), &newMutableDatum, sizeof(float));
216  scalarValue = *reinterpret_cast<float*>(tensor.GetMemoryArea());
217  BOOST_CHECK_MESSAGE(newMutableDatum == scalarValue, "Scalar value is " << scalarValue);
218 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290

◆ BOOST_AUTO_TEST_CASE() [6/10]

BOOST_AUTO_TEST_CASE ( TensorShape_DynamicTensorType1_unknownNumberDimensions  )

Definition at line 220 of file TensorTest.cpp.

References armnn::Float32, TensorShape::GetDimensionality(), TensorShape::GetNumDimensions(), TensorShape::GetNumElements(), armnn::info, and armnn::NotSpecified.

221 {
222  float mutableDatum = 3.1416f;
223 
225  armnn::TensorInfo info ( shape, DataType::Float32 );
226  armnn::Tensor tensor ( info, &mutableDatum );
227 
228  BOOST_CHECK(armnn::Dimensionality::NotSpecified == shape.GetDimensionality());
229  BOOST_CHECK_THROW( shape[0], InvalidArgumentException );
230  BOOST_CHECK_THROW( shape.GetNumElements(), InvalidArgumentException );
231  BOOST_CHECK_THROW( shape.GetNumDimensions(), InvalidArgumentException );
232 
233  armnn::TensorShape shape_equal;
234  armnn::TensorShape shape_different;
235  shape_equal = shape;
236  BOOST_TEST(shape_equal == shape);
237  BOOST_TEST(shape_different != shape);
238 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290

◆ BOOST_AUTO_TEST_CASE() [7/10]

BOOST_AUTO_TEST_CASE ( TensorShape_DynamicTensorType1_unknownAllDimensionsSizes  )

Definition at line 240 of file TensorTest.cpp.

References TensorShape::AreAllDimensionsSpecified(), armnn::Float32, TensorShape::GetDimensionality(), TensorShape::GetDimensionSpecificity(), TensorShape::GetNumDimensions(), TensorShape::GetNumElements(), armnn::info, TensorShape::IsAtLeastOneDimensionSpecified(), and armnn::Specified.

241 {
242  float mutableDatum = 3.1416f;
243 
244  armnn::TensorShape shape ( 3, false );
245  armnn::TensorInfo info ( shape, DataType::Float32 );
246  armnn::Tensor tensor ( info, &mutableDatum );
247 
248  BOOST_CHECK(armnn::Dimensionality::Specified == shape.GetDimensionality());
249  BOOST_CHECK_MESSAGE(0 == shape.GetNumElements(), "Number of elements is " << shape.GetNumElements());
250  BOOST_CHECK_MESSAGE(3 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
251  BOOST_CHECK(false == shape.GetDimensionSpecificity(0));
252  BOOST_CHECK(false == shape.GetDimensionSpecificity(1));
253  BOOST_CHECK(false == shape.GetDimensionSpecificity(2));
254  BOOST_CHECK(!shape.AreAllDimensionsSpecified());
255  BOOST_CHECK(!shape.IsAtLeastOneDimensionSpecified());
256 
257  armnn::TensorShape shape_equal;
258  armnn::TensorShape shape_different;
259  shape_equal = shape;
260  BOOST_TEST(shape_equal == shape);
261  BOOST_TEST(shape_different != shape);
262 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290

◆ BOOST_AUTO_TEST_CASE() [8/10]

BOOST_AUTO_TEST_CASE ( TensorShape_DynamicTensorType1_unknownSomeDimensionsSizes  )

Definition at line 264 of file TensorTest.cpp.

References armnn::Float32, BaseTensor< MemoryType >::GetInfo(), TensorInfo::GetShape(), BaseTensor< MemoryType >::GetShape(), armnn::info, and armnn::Specified.

265 {
266  std::vector<float> mutableDatum { 42.f, 42.f, 42.f,
267  0.0f, 0.1f, 0.2f };
268 
269  armnn::TensorShape shape ( {2, 0, 3}, {true, false, true} );
270  armnn::TensorInfo info ( shape, DataType::Float32 );
271  armnn::Tensor tensor ( info, &mutableDatum );
272 
273  BOOST_CHECK(armnn::Dimensionality::Specified == shape.GetDimensionality());
274  BOOST_CHECK_MESSAGE(6 == shape.GetNumElements(), "Number of elements is " << shape.GetNumElements());
275  BOOST_CHECK_MESSAGE(3 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
276  BOOST_CHECK(true == shape.GetDimensionSpecificity(0));
277  BOOST_CHECK(false == shape.GetDimensionSpecificity(1));
278  BOOST_CHECK(true == shape.GetDimensionSpecificity(2));
279  BOOST_CHECK(!shape.AreAllDimensionsSpecified());
280  BOOST_CHECK(shape.IsAtLeastOneDimensionSpecified());
281 
282  BOOST_CHECK_THROW(shape[1], InvalidArgumentException);
283  BOOST_CHECK_THROW(tensor.GetShape()[1], InvalidArgumentException);
284  BOOST_CHECK_THROW(tensor.GetInfo().GetShape()[1], InvalidArgumentException);
285 
286  BOOST_TEST(2 == shape[0]);
287  BOOST_TEST(2 == tensor.GetShape()[0]);
288  BOOST_TEST(2 == tensor.GetInfo().GetShape()[0]);
289  BOOST_CHECK_THROW( shape[1], InvalidArgumentException );
290 
291  BOOST_TEST(3 == shape[2]);
292  BOOST_TEST(3 == tensor.GetShape()[2]);
293  BOOST_TEST(3 == tensor.GetInfo().GetShape()[2]);
294 
295  armnn::TensorShape shape_equal;
296  armnn::TensorShape shape_different;
297  shape_equal = shape;
298  BOOST_TEST(shape_equal == shape);
299  BOOST_TEST(shape_different != shape);
300 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290

◆ BOOST_AUTO_TEST_CASE() [9/10]

BOOST_AUTO_TEST_CASE ( TensorShape_DynamicTensorType1_transitionFromUnknownToKnownDimensionsSizes  )

Definition at line 302 of file TensorTest.cpp.

References TensorShape::AreAllDimensionsSpecified(), armnn::Float32, TensorShape::GetDimensionality(), TensorShape::GetDimensionSpecificity(), BaseTensor< MemoryType >::GetInfo(), TensorShape::GetNumDimensions(), TensorShape::GetNumElements(), TensorInfo::GetShape(), BaseTensor< MemoryType >::GetShape(), armnn::info, TensorShape::IsAtLeastOneDimensionSpecified(), armnn::NotSpecified, TensorShape::SetDimensionSize(), TensorShape::SetNumDimensions(), TensorInfo::SetShape(), and armnn::Specified.

303 {
304  std::vector<float> mutableDatum { 42.f, 42.f, 42.f,
305  0.0f, 0.1f, 0.2f };
306 
308  armnn::TensorInfo info ( shape, DataType::Float32 );
309  armnn::Tensor tensor ( info, &mutableDatum );
310 
311  // Specify the number of dimensions
312  shape.SetNumDimensions(3);
313  BOOST_CHECK(armnn::Dimensionality::Specified == shape.GetDimensionality());
314  BOOST_CHECK_MESSAGE(3 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
315  BOOST_CHECK(false == shape.GetDimensionSpecificity(0));
316  BOOST_CHECK(false == shape.GetDimensionSpecificity(1));
317  BOOST_CHECK(false == shape.GetDimensionSpecificity(2));
318  BOOST_CHECK(!shape.AreAllDimensionsSpecified());
319  BOOST_CHECK(!shape.IsAtLeastOneDimensionSpecified());
320 
321  // Specify dimension 0 and 2.
322  shape.SetDimensionSize(0, 2);
323  shape.SetDimensionSize(2, 3);
324  BOOST_CHECK_MESSAGE(3 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
325  BOOST_CHECK_MESSAGE(6 == shape.GetNumElements(), "Number of elements is " << shape.GetNumElements());
326  BOOST_CHECK(true == shape.GetDimensionSpecificity(0));
327  BOOST_CHECK(false == shape.GetDimensionSpecificity(1));
328  BOOST_CHECK(true == shape.GetDimensionSpecificity(2));
329  BOOST_CHECK(!shape.AreAllDimensionsSpecified());
330  BOOST_CHECK(shape.IsAtLeastOneDimensionSpecified());
331 
332  info.SetShape(shape);
333  armnn::Tensor tensor2( info, &mutableDatum );
334  BOOST_TEST(2 == shape[0]);
335  BOOST_TEST(2 == tensor2.GetShape()[0]);
336  BOOST_TEST(2 == tensor2.GetInfo().GetShape()[0]);
337 
338  BOOST_CHECK_THROW(shape[1], InvalidArgumentException);
339  BOOST_CHECK_THROW(tensor.GetShape()[1], InvalidArgumentException);
340  BOOST_CHECK_THROW(tensor.GetInfo().GetShape()[1], InvalidArgumentException);
341 
342  BOOST_TEST(3 == shape[2]);
343  BOOST_TEST(3 == tensor2.GetShape()[2]);
344  BOOST_TEST(3 == tensor2.GetInfo().GetShape()[2]);
345 
346  armnn::TensorShape shape_equal;
347  armnn::TensorShape shape_different;
348  shape_equal = shape;
349  BOOST_TEST(shape_equal == shape);
350  BOOST_TEST(shape_different != shape);
351 
352  // Specify dimension 1.
353  shape.SetDimensionSize(1, 5);
354  BOOST_CHECK_MESSAGE(3 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
355  BOOST_CHECK_MESSAGE(30 == shape.GetNumElements(), "Number of elements is " << shape.GetNumElements());
356  BOOST_CHECK(true == shape.GetDimensionSpecificity(0));
357  BOOST_CHECK(true == shape.GetDimensionSpecificity(1));
358  BOOST_CHECK(true == shape.GetDimensionSpecificity(2));
359  BOOST_CHECK(shape.AreAllDimensionsSpecified());
360  BOOST_CHECK(shape.IsAtLeastOneDimensionSpecified());
361 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290

◆ BOOST_AUTO_TEST_CASE() [10/10]

BOOST_AUTO_TEST_CASE ( Tensor_emptyConstructors  )

Definition at line 363 of file TensorTest.cpp.

References BOOST_AUTO_TEST_SUITE_END(), and armnn::Specified.

364 {
365  auto shape = armnn::TensorShape();
366  BOOST_CHECK_MESSAGE( 0 == shape.GetNumDimensions(), "Number of dimensions is " << shape.GetNumDimensions());
367  BOOST_CHECK_MESSAGE( 0 == shape.GetNumElements(), "Number of elements is " << shape.GetNumElements());
368  BOOST_CHECK( armnn::Dimensionality::Specified == shape.GetDimensionality());
369  BOOST_CHECK( shape.AreAllDimensionsSpecified());
370  BOOST_CHECK_THROW( shape[0], InvalidArgumentException );
371 
372  auto tensor = armnn::Tensor();
373  BOOST_CHECK_MESSAGE( 0 == tensor.GetNumDimensions(), "Number of dimensions is " << tensor.GetNumDimensions());
374  BOOST_CHECK_MESSAGE( 0 == tensor.GetNumElements(), "Number of elements is " << tensor.GetNumElements());
375  BOOST_CHECK_MESSAGE( 0 == tensor.GetShape().GetNumDimensions(), "Number of dimensions is " <<
376  tensor.GetShape().GetNumDimensions());
377  BOOST_CHECK_MESSAGE( 0 == tensor.GetShape().GetNumElements(), "Number of dimensions is " <<
378  tensor.GetShape().GetNumElements());
379  BOOST_CHECK( armnn::Dimensionality::Specified == tensor.GetShape().GetDimensionality());
380  BOOST_CHECK( tensor.GetShape().AreAllDimensionsSpecified());
381  BOOST_CHECK_THROW( tensor.GetShape()[0], InvalidArgumentException );
382 }
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:290

◆ BOOST_FIXTURE_TEST_CASE() [1/6]

BOOST_FIXTURE_TEST_CASE ( ConstructShapeUsingListInitialization  ,
TensorInfoFixture   
)

Definition at line 55 of file TensorTest.cpp.

56 {
57  TensorShape listInitializedShape{ 6, 7, 8, 9 };
58  BOOST_TEST(listInitializedShape == m_TensorInfo.GetShape());
59 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:187

◆ BOOST_FIXTURE_TEST_CASE() [2/6]

BOOST_FIXTURE_TEST_CASE ( ConstructTensorInfo  ,
TensorInfoFixture   
)

Definition at line 61 of file TensorTest.cpp.

62 {
63  BOOST_TEST(m_TensorInfo.GetNumDimensions() == 4);
64  BOOST_TEST(m_TensorInfo.GetShape()[0] == 6); // <= Outer most
65  BOOST_TEST(m_TensorInfo.GetShape()[1] == 7);
66  BOOST_TEST(m_TensorInfo.GetShape()[2] == 8);
67  BOOST_TEST(m_TensorInfo.GetShape()[3] == 9); // <= Inner most
68 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:191

◆ BOOST_FIXTURE_TEST_CASE() [3/6]

BOOST_FIXTURE_TEST_CASE ( CopyConstructTensorInfo  ,
TensorInfoFixture   
)

Definition at line 70 of file TensorTest.cpp.

71 {
72  TensorInfo copyConstructed(m_TensorInfo);
73  BOOST_TEST(copyConstructed.GetNumDimensions() == 4);
74  BOOST_TEST(copyConstructed.GetShape()[0] == 6);
75  BOOST_TEST(copyConstructed.GetShape()[1] == 7);
76  BOOST_TEST(copyConstructed.GetShape()[2] == 8);
77  BOOST_TEST(copyConstructed.GetShape()[3] == 9);
78 }

◆ BOOST_FIXTURE_TEST_CASE() [4/6]

BOOST_FIXTURE_TEST_CASE ( TensorInfoEquality  ,
TensorInfoFixture   
)

Definition at line 80 of file TensorTest.cpp.

81 {
82  TensorInfo copyConstructed(m_TensorInfo);
83  BOOST_TEST(copyConstructed == m_TensorInfo);
84 }

◆ BOOST_FIXTURE_TEST_CASE() [5/6]

BOOST_FIXTURE_TEST_CASE ( TensorInfoInequality  ,
TensorInfoFixture   
)

Definition at line 86 of file TensorTest.cpp.

References armnn::Float32.

87 {
88  TensorInfo other;
89  unsigned int sizes[] = {2,3,4,5};
90  other = TensorInfo(4, sizes, DataType::Float32);
91 
92  BOOST_TEST(other != m_TensorInfo);
93 }

◆ BOOST_FIXTURE_TEST_CASE() [6/6]

BOOST_FIXTURE_TEST_CASE ( TensorInfoAssignmentOperator  ,
TensorInfoFixture   
)

Definition at line 95 of file TensorTest.cpp.

96 {
97  TensorInfo copy;
98  copy = m_TensorInfo;
99  BOOST_TEST(copy == m_TensorInfo);
100 }

◆ CheckTensor()

void CheckTensor ( const ConstTensor t)

Definition at line 102 of file TensorTest.cpp.

References BaseTensor< MemoryType >::GetInfo().

Referenced by BOOST_AUTO_TEST_CASE().

103 {
104  t.GetInfo();
105 }
const TensorInfo & GetInfo() const
Definition: Tensor.hpp:266