Skip to content

Commit

Permalink
[Documentation] Document rewrite_once option (#8900)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalda committed Sep 7, 2021
1 parent f33b717 commit 0034732
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/langref/relay_pattern.rst
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ is required to be run before the callback.
The function ``def callback(self, pre, post, node_map)`` will be invoked when the rewriter matches
``self.pattern``. ``node_map`` is a dictionary mapping from pattern nodes to matched nodes in the graph.

The callback function will be invoked recursively on the returned pattern until the pattern stops changing. As a result, if ``self.pattern`` matches any part of the graph that the callback returned, the rewriter will run in a loop. If you want to avoid multiple rewrites, you can pass a ``rewrite_once=True`` parameter to the constructor.

Pattern Partitioning
********************

Expand Down

0 comments on commit 0034732

Please sign in to comment.