`has_type` is not necessary to match the final expression. It can also be used
like the following to check the type of an op:
```python
in1 = wildcard()
in2 = wildcard()
pat = is_op('add')(in1, in2).has_type(relay.TensorType((10, 10), 'float32'))
x = relay.var('x', shape=(10, 10), dtype='float32')
pat.match(relay.add(x, x))
```
This can be extended to a more complex pattern like
```python
in1 = wildcard()
in2 = wildcard()
add = is_op('add')(in1, in2).has_type(relay.TensorType((10, 10), 'float32'))
mul = is_op('multiply')(add, add)
```
In this case, you only match the the type of `add` but do not care `mul`,
although in this case `mul` must be `float32`, too.
---
[Visit
Topic](https://discuss.tvm.ai/t/pattenlang-how-to-match-op-according-to-element-type-of-input-and-output/6846/2)
to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click
here](https://discuss.tvm.ai/email/unsubscribe/3027e8d81e00b34102ed7ce473e4174be0fd8d1228d50220f9492c2b8fad3f5c).