Hello,

I was looking at the Arm EthosU integration in TVM and [noticed that there was 
a new conv2d Relay operator 
defined](https://github.com/apache/tvm/blob/main/python/tvm/relay/backend/contrib/ethosu/op/convolution.py#L185).
 Obviously this operator is only legal/valid for offloading onto the EthosU, 
[so they decide to replace standard Relay operator patterns inside of a 
Composite with this single 
operator](https://github.com/apache/tvm/blob/main/python/tvm/relay/backend/contrib/ethosu/legalize.py#L126).
That makes it easier to define their own Relay->Tir pipeline since they only 
need to parse one node and all its parameters/attributes.

I was wondering though, how could this (or any) new Relay operator be added 
into the pattern matching infrastructure?

I guess what I would like is the following
```
#Original Relay module using standard Relay operators
%1 = standard_relay_op_1(...)
%2 = standard_relay_op_2(...)

#Assume I have some custom Relay operators that each match to one of those from 
above
%1 = my_custom_relay_op_1(...)
%2 = my_custom_relay_op_2(...)

#Now, I further have a third Relay operator which matches exactly to the 
pattern above
%1 = my_custom_rela_op_3(....)
```

I know in this simple case there is a solution using the already available 
pattern matcher infrastructure (i.e. defining the pattern to be match of 
`my_custom_relay_op_3` before the others in the pattern list). But let's say 
for more complex situations I couldn't just solve it via position in the 
pattern list.

How do I add `my_custom_relay_op_{1,2}` to the pattern matching infrastructure 
such that I can define the pattern matching for `my_custom_relay_op_3` to have 
statements/expression like `is_op('my_custom_relay_op_1')` ?


Thank you all





---
[Visit 
Topic](https://discuss.tvm.apache.org/t/how-to-add-my-custom-relay-node-to-pattern-matcher-ethosu-example/11498/1)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.apache.org/email/unsubscribe/afd28cebad62f95679f29998044d6e6e9d61e5440a9d22e725a44a23655447b7).

Reply via email to