From 303e225dfb068c1581780c71db7d13a55df7e746 Mon Sep 17 00:00:00 2001
From: auphelia <jakobapk@web.de>
Date: Wed, 11 Dec 2019 10:51:44 +0000
Subject: [PATCH] [xnorpopcountmatmul] filled verify_node function

---
 src/finn/custom_op/xnorpopcount.py | 33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/finn/custom_op/xnorpopcount.py b/src/finn/custom_op/xnorpopcount.py
index 8af7429a5..15ec57a00 100644
--- a/src/finn/custom_op/xnorpopcount.py
+++ b/src/finn/custom_op/xnorpopcount.py
@@ -57,3 +57,36 @@ class XnorPopcountMatMul(CustomOp):
         output = xnorpopcountmatmul(inp0, inp1)
         # set context according to output name
         context[node.output[0]] = output
+
+    def verify_node(self):
+        info_messages = []
+
+        # verify number of attributes
+        num_of_attr = 0
+        if len(self.onnx_node.attribute) == num_of_attr:
+            info_messages.append("The number of attributes is correct")
+        else:
+            info_messages.append(
+                """The number of attributes is incorrect,
+            {} should have {} attributes""".format(
+                    self.onnx_node.op_type, num_of_attr
+                )
+            )
+
+        # verify that "domain" is set to "finn"
+        domain_value = self.onnx_node.domain
+        if domain_value == "finn":
+            info_messages.append("Attribute domain is set correctly")
+        else:
+            info_messages.append('Attribute domain should be set to "finn"')
+
+        # verify that all necessary attributes exist
+        info_messages.append("XnorPopcountMatMul should not have any attributes")
+
+        # verify the number of inputs
+        if len(self.onnx_node.input) == 2:
+            info_messages.append("The number of inputs is correct")
+        else:
+            info_messages.append("XnorPopcountMatMul needs 2 data inputs")
+
+        return info_messages
-- 
GitLab