Skip to content

Add better attributes handling for MetaOperator

Currently getting attributes from a MetaOperator is "tidious", you have to get the graphview access a node and access the attribute.

This is a little annoying for export where I want to access attributes from the MetaOperator and i have to use the following code:

for n in self.operator.get_micro_graph().get_nodes():
            if n.type() == "Pad":
                self.attributes["padding"] = n.get_operator(
                ).attr.begin_end_borders
            if n.type() == "Conv":
                self.attributes["kernel_dims"] = n.get_operator(
                ).attr.kernel_dims
                self.attributes["stride_dims"] = n.get_operator(
                ).attr.stride_dims
                self.attributes["dilation_dims"] = n.get_operator(
                ).attr.dilation_dims

Instead of having self.attributes += node.attr.

However, accessing attributes is not trivial, specially if we have a collision of attribute name. For example if we have two conv we will have two kernel_dims attributes.

Maybe using attribute namespace introduced in !161 (merged) canfix this ?