5 #include <boost/test/unit_test.hpp> 14 ostr <<
"TensorInfo[ " 26 ostr <<
"TensorShape[ " 37 using namespace armnn;
41 struct TensorInfoFixture
45 unsigned int sizes[] = {6,7,8,9};
48 ~TensorInfoFixture() {};
56 BOOST_TEST(listInitializedShape == m_TensorInfo.
GetShape());
62 BOOST_TEST(m_TensorInfo.
GetShape()[0] == 6);
63 BOOST_TEST(m_TensorInfo.
GetShape()[1] == 7);
64 BOOST_TEST(m_TensorInfo.
GetShape()[2] == 8);
65 BOOST_TEST(m_TensorInfo.
GetShape()[3] == 9);
72 BOOST_TEST(copyConstructed.
GetShape()[0] == 6);
73 BOOST_TEST(copyConstructed.
GetShape()[1] == 7);
74 BOOST_TEST(copyConstructed.
GetShape()[2] == 8);
75 BOOST_TEST(copyConstructed.
GetShape()[3] == 9);
81 BOOST_TEST(copyConstructed == m_TensorInfo);
87 unsigned int sizes[] = {2,3,4,5};
90 BOOST_TEST(other != m_TensorInfo);
97 BOOST_TEST(copy == m_TensorInfo);
107 int mutableDatum = 2;
108 const int immutableDatum = 3;
113 uninitializedTensor2 = uninitializedTensor;
140 BOOST_TEST(shape[2] == 2);
143 BOOST_TEST(shape[2] == 20);
150 BOOST_CHECK(!tensorInfo0.HasMultipleQuantizationScales());
151 BOOST_CHECK(tensorInfo0.GetQuantizationScale() == 2.0f);
152 BOOST_CHECK(tensorInfo0.GetQuantizationOffset() == 1);
153 BOOST_CHECK(tensorInfo0.GetQuantizationScales()[0] == 2.0f);
154 BOOST_CHECK(!tensorInfo0.GetQuantizationDim().has_value());
157 std::vector<float> perAxisScales{ 3.0f, 4.0f };
158 tensorInfo0.SetQuantizationScales(perAxisScales);
159 BOOST_CHECK(tensorInfo0.HasMultipleQuantizationScales());
160 BOOST_CHECK(tensorInfo0.GetQuantizationScales() == perAxisScales);
163 tensorInfo0.SetQuantizationScale(5.0f);
164 BOOST_CHECK(!tensorInfo0.HasMultipleQuantizationScales());
165 BOOST_CHECK(tensorInfo0.GetQuantizationScales()[0] == 5.0f);
169 BOOST_CHECK(tensorInfo0.GetQuantizationDim().value() == 1);
172 perAxisScales = { 6.0f, 7.0f };
174 BOOST_CHECK(tensorInfo1.HasMultipleQuantizationScales());
175 BOOST_CHECK(tensorInfo1.GetQuantizationOffset() == 0);
176 BOOST_CHECK(tensorInfo1.GetQuantizationScales() == perAxisScales);
177 BOOST_CHECK(tensorInfo1.GetQuantizationDim().value() == 1);
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
const TensorShape & GetShape() const
BOOST_FIXTURE_TEST_CASE(ConstructShapeUsingListInitialization, TensorInfoFixture)
Copyright (c) 2020 ARM Limited.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
void SetShape(const TensorShape &newShape)
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
void CheckTensor(const ConstTensor &t)
int32_t GetQuantizationOffset() const
float GetQuantizationScale() const
DataType GetDataType() const
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void SetQuantizationScale(float scale)
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
const TensorInfo & GetInfo() const
void SetDataType(DataType type)
std::ostream & boost_test_print_type(std::ostream &ostr, const TensorInfo &right)
BOOST_AUTO_TEST_SUITE_END()
unsigned int GetNumDimensions() const
void SetQuantizationOffset(int32_t offset)
unsigned int GetNumDimensions() const