diff --git a/src/finn/custom_op/xnorpopcount.py b/src/finn/custom_op/xnorpopcount.py index 8af7429a5d54d675e62b527cae6e2fdf55b09536..15ec57a002148a4e9213d28fe4f68c5a78837ab6 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