I need to create a pattern matching to match all qnn.conv2d operators which are depthwise convolution operators. I saw that the EthosU integration does this by checking the kernel_layout attribute using the has_attr function. My problem is, I did a layout conversion before so both conv2d and depthwise conv2d have the same kernel_layout attribute.
I noticed that only the depthwise convolution operators have the groups attribute, so I was trying to match them, but I couldn’t find a way of saying “match any qnn.conv2d with attribute groups, no matter the value of the attribute”. Using something like this:
is_op("qnn.conv2d")(...).has_attr({"groups": 512})
Works only for the qnn.conv2d operators which has the groups attribute set to 512. I was hoping I could do something like:
is_op("qnn.conv2d")(...).has_attr({"groups": wildcard()})
Or:
is_op("qnn.conv2d")(...).has_attr({"groups": is_constant()})
But sadly, none of them work.
Does anyone know a way to do this? Or perhaps another workaround?