aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test/TestLayerVisitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn/test/TestLayerVisitor.cpp')
-rw-r--r--src/armnn/test/TestLayerVisitor.cpp18
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