Skip to main content

RewriteMatch

One occurrence a rule (transforms.rewrite) rewrites, read on the graph as the rule's earlier replacements in the same iteration left it; the rule's replacement and condition receive it. Its views keep the graph alive, and the ones a replacement removes are gone afterwards.

inputs (property)​

The Values the occurrence reads from outside it: every input of a matched node that no matched node makes, in pattern-node order and then input-port order, each listed once. A constant is one of them. The replacement gets one traced Tensor per entry, in this order.

nodes (property)​

The matched Node per pattern node, in add_node order; None for an optional node the occurrence lacks.

outputs (property)​

The Values the occurrence makes that a node outside it reads or the graph returns, in the same order, each listed once; the replacement returns one new value per entry.

__init__​

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.