Replace variables with constants
| 105 | |
| 106 | @tirx.functor.mutator |
| 107 | class VariableReplacer(PyStmtExprMutator): |
| 108 | """Replace variables with constants""" |
| 109 | |
| 110 | def __init__(self, replacements): |
| 111 | super().__init__() |
| 112 | self.replacements = replacements |
| 113 | |
| 114 | def visit_var_(self, op: Var): |
| 115 | if op.name in self.replacements: |
| 116 | return IntImm("int32", self.replacements[op.name]) |
| 117 | return op |
| 118 | |
| 119 | |
| 120 | @tirx.functor.mutator |
no outgoing calls
searching dependent graphs…