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

Function test_complex_mutator

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

Test stmt_expr_mutator

()

Source from the content-addressed store, hash-verified

309
310
311def test_complex_mutator():
312 """Test stmt_expr_mutator"""
313 x = Var("x", dtype="int32")
314 y = Var("y", dtype="int32")
315
316 # Expression with Add operations
317 expr = Add(x, y)
318 stmt = Evaluate(expr)
319
320 mutator = ComplexMutator()
321 result = mutator.visit_stmt(stmt)
322 print(type(mutator))
323
324 assert mutator.modifications == 1 # One Add operation modified
325 assert isinstance(result, Evaluate)
326
327 # Check that the expression was modified
328 modified_expr = result.value
329 assert isinstance(modified_expr, Add)
330 assert isinstance(modified_expr.a, Mul) # First operand should be multiplied by 2
331
332
333def test_different_expr_types():

Callers

nothing calls this directly

Calls 6

VarClass · 0.90
AddClass · 0.90
EvaluateClass · 0.90
ComplexMutatorClass · 0.85
printFunction · 0.85
visit_stmtMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…