MCPcopy Index your code
hub / github.com/apache/tvm / VarTableFrame

Class VarTableFrame

python/tvm/script/parser/core/parser.py:173–210  ·  view source on GitHub ↗

The variable table frame. A frame of variable table stores the variables created in one block or scope. Parameters ---------- vars : Set[str] The set of variable names in the variable table frame.

Source from the content-addressed store, hash-verified

171
172
173class VarTableFrame:
174 """The variable table frame.
175 A frame of variable table stores the variables created in one block or scope.
176
177 Parameters
178 ----------
179 vars : Set[str]
180 The set of variable names in the variable table frame.
181 """
182
183 vars: set[str]
184
185 def __init__(self):
186 self.vars = set()
187
188 def add(self, var: str):
189 """Add a new variable into variable table frame.
190
191 Parameters
192 ----------
193 var : str
194 The name of new variable.
195 """
196 if var in self.vars:
197 raise ValueError(f"Variable {var} already defined in current scope")
198 self.vars.add(var)
199
200 def pop_all(self, fn_pop: Callable[[str], None]):
201 """Pop out all variable in variable table frame.
202
203 Parameters
204 ----------
205 fn_pop : Callable[[str], None]
206 The methods to call when popping each variable.
207 """
208 for var in self.vars:
209 fn_pop(var)
210 self.vars.clear()
211
212
213class VarTable:

Callers 1

with_frameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…