MCPcopy Create free account
hub / github.com/apache/tvm / ComplexMutator

Class ComplexMutator

tests/python/tirx-transform/test_tir_functor.py:190–202  ·  view source on GitHub ↗

Mutator that handles both statements and expressions

Source from the content-addressed store, hash-verified

188
189@tirx.functor.mutator
190class ComplexMutator(PyStmtExprMutator):
191 """Mutator that handles both statements and expressions"""
192
193 def __init__(self):
194 super().__init__()
195 self.modifications = 0
196
197 def visit_add_(self, op: Add):
198 self.modifications += 1
199 # Convert a + b to a * 2 + b for demonstration
200 a = self.visit_expr(op.a)
201 b = self.visit_expr(op.b)
202 return Add(Mul(a, IntImm("int32", 2)), b)
203
204
205def test_basic_visitor():

Callers 1

test_complex_mutatorFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_complex_mutatorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…