# Pattern matching pass

**URL:** <https://discuss.tvm.apache.org/t/pattern-matching-pass/12249>\
**Category:** RFC\
**Created:** [March 6, 2022, 4:05pm UTC](https://discuss.tvm.apache.org/t/pattern-matching-pass/12249 "2022-03-06T16:05:26Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![MajorTom](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@MajorTom](https://discuss.tvm.apache.org/u/MajorTom)\
**Post date:** [March 6, 2022, 4:05pm UTC](https://discuss.tvm.apache.org/t/pattern-matching-pass/12249/1 "2022-03-06T16:05:26Z")

</div>

Hi, I am trying to implement a simple pass that merges a certain pattern into a single “normalize” op. I use the **register\_pattern\_table** which I understand is support to register the pass.

```
def make_pattern():
    data = wildcard()
    data2 = wildcard()
    data3 = wildcard()

    copy_op = is_op("copy")(data)
    reshape1_op = is_op("reshape")(data2)
    substract_op = is_op("subtract")(copy_op, reshape1_op)
    reshape2_op = is_op("reshape")(data3)
    divide_op = is_op("reshape")(substract_op, reshape2_op)
    return divide_op

@register_pattern_table
def normalize_pattern():
    normalize_pat = ("normalize", make_pattern())
    normalize_patterns = [normalize_pat]
    return normalize_patterns

```

I import this code in my test but nothing happens. the code is not called. what am I missing? It will really help if you could show me a tutorial or example of adding a pattern matching pass end-to-end.

---

_[View the full topic](https://discuss.tvm.apache.org/t/pattern-matching-pass/12249)._
