diff options
author | jimfly01 <jim.flynn@arm.com> | 2019-02-05 09:20:11 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2019-02-07 16:00:12 +0000 |
commit | aebf2e7871997378d33fa99f7cab6322be9b726f (patch) | |
tree | aef3f6fd05aafbee10100de85ec2e766d4f92ef7 /src/armnn/test/TestLayerVisitor.cpp | |
parent | 857aa45407df9dbe99a11d03a4be2b20bd0110ae (diff) | |
download | armnn-aebf2e7871997378d33fa99f7cab6322be9b726f.tar.gz |
IVGCVSW-2553 Add Unit Test for ConstTensor layer visitors
Change-Id: I20a67135e4af7aa1f28f5000d73122f4e5e3acd5
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/armnn/test/TestLayerVisitor.cpp')
-rw-r--r-- | src/armnn/test/TestLayerVisitor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/armnn/test/TestLayerVisitor.cpp b/src/armnn/test/TestLayerVisitor.cpp index 5cb7bdfca5..2584179bb7 100644 --- a/src/armnn/test/TestLayerVisitor.cpp +++ b/src/armnn/test/TestLayerVisitor.cpp @@ -30,4 +30,22 @@ void TestLayerVisitor::CheckLayerPointer(const IConnectableLayer* layer) BOOST_CHECK(layer != nullptr); }; +void TestLayerVisitor::CheckConstTensors(const ConstTensor& expected, const ConstTensor& actual) +{ + BOOST_CHECK(expected.GetInfo() == actual.GetInfo()); + BOOST_CHECK(expected.GetNumDimensions() == actual.GetNumDimensions()); + BOOST_CHECK(expected.GetNumElements() == actual.GetNumElements()); + BOOST_CHECK(expected.GetNumBytes() == actual.GetNumBytes()); + if (expected.GetNumBytes() == actual.GetNumBytes()) + { + //check data is the same byte by byte + const unsigned char* expectedPtr = static_cast<const unsigned char*>(expected.GetMemoryArea()); + const unsigned char* actualPtr = static_cast<const unsigned char*>(actual.GetMemoryArea()); + for (unsigned int i = 0; i < expected.GetNumBytes(); i++) + { + BOOST_CHECK(*(expectedPtr + i) == *(actualPtr + i)); + } + } +} + } //namespace armnn
\ No newline at end of file |