I want to write a relay pass that optimizes back-to-back memory operations. An example would be back-to-back reshapes that cancel each other out.
To do this, if I understand correctly, I need a way to detect a pattern and modify the Relay function when the pattern is detected. Is there any other Relay pass that solves similar kind of problem, so that I can see how this can be done?