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

Function test_where

tests/python/relax/test_tvmscript_parser_op_search.py:37–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36
37def test_where():
38 @R.function
39 def foo(
40 condition: R.Tensor((2, 1), "bool"),
41 x: R.Tensor((2, 3), "float32"),
42 y: R.Tensor((1, 3), "float32"),
43 ) -> R.Tensor((2, 3), "float32"):
44 gv: R.Tensor((2, 3), "float32") = R.where(condition, x, y)
45 return gv
46
47 bb = relax.BlockBuilder()
48 condition = relax.Var("condition", R.Tensor((2, 1), "bool"))
49 x = relax.Var("x", R.Tensor((2, 3), "float32"))
50 y = relax.Var("y", R.Tensor((1, 3), "float32"))
51 with bb.function("foo", [condition, x, y]):
52 gv = bb.emit(relax.op.where(condition, x, y))
53 bb.emit_func_output(gv)
54
55 _check(foo, bb.get()["foo"])
56
57
58def test_argmax():

Callers

nothing calls this directly

Calls 7

functionMethod · 0.95
emitMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
whereMethod · 0.80
_checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…