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

Function _run_expr

python/tvm/testing/utils.py:300–313  ·  view source on GitHub ↗

Evaluate expr for every value of free variables given by vranges and return the tensor of results.

(expr, vranges)

Source from the content-addressed store, hash-verified

298 bool_expr = tvm.te.any(tvm.tirx.Not(cond), bool_expr)
299
300 def _run_expr(expr, vranges):
301 """Evaluate expr for every value of free variables
302 given by vranges and return the tensor of results.
303 """
304
305 def _compute_body(*us):
306 vmap = {v: u + r.min for (v, r), u in zip(vranges.items(), us)}
307 return tvm.tirx.stmt_functor.substitute(expr, vmap)
308
309 A = tvm.te.compute([r.extent.value for v, r in vranges.items()], _compute_body)
310 args = [tvm.runtime.empty(A.shape, A.dtype)]
311 mod = tvm.compile(tvm.IRModule.from_expr(tvm.te.create_prim_func([A])))
312 mod(*args)
313 return args[0].numpy()
314
315 res = _run_expr(bool_expr, vranges)
316 if not np.all(res):

Callers 1

check_bool_expr_is_trueFunction · 0.85

Calls 6

from_exprMethod · 0.80
numpyMethod · 0.80
modFunction · 0.50
itemsMethod · 0.45
emptyMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…