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

Function test_match_cast

tests/python/relax/test_tvmscript_parser.py:478–503  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

476
477
478def test_match_cast():
479 @R.function
480 def foo(x: R.Tensor("float32"), y: R.Tensor("float32")):
481 m = T.int64()
482 n = T.int64()
483 x0 = R.match_cast(x, R.Tensor([m], "float32"))
484 with R.dataflow():
485 y0 = R.match_cast(y, R.Tensor([n], "float32"))
486 gv = y0
487 R.output(gv)
488 return (x0, R.shape([m, n * 2]))
489
490 x = relax.Var("x", R.Tensor("float32"))
491 y = relax.Var("y", R.Tensor("float32"))
492 m = tirx.Var("m", dtype="int64")
493 n = tirx.Var("n", dtype="int64")
494 y2 = relax.Var("y", R.Tensor([n], "float32"))
495 bb = relax.BlockBuilder()
496 with bb.function("foo", (x, y)):
497 x0 = bb.match_cast(x, R.Tensor([m], "float32"))
498 with bb.dataflow():
499 y0 = bb.match_cast(y, R.Tensor([n], "float32"))
500 bb.emit_output(y0)
501 bb.emit_func_output(relax.Tuple([x0, relax.ShapeExpr([m, n * 2])]))
502
503 _check(foo, bb.get()["foo"])
504
505
506def test_tuple_return():

Callers

nothing calls this directly

Calls 8

functionMethod · 0.95
match_castMethod · 0.95
dataflowMethod · 0.95
emit_outputMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
_checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…