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

Function test_tuple_get_item

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

Source from the content-addressed store, hash-verified

559
560
561def test_tuple_get_item():
562 @R.function
563 def foo(x: R.Tensor, y: R.Tensor):
564 t1 = R.tuple(x, y)
565 t2 = (x, y)
566 a = t1[0]
567 b = R.TupleGetItem(t2, 1)
568 c = R.add(a, b)
569 return c
570
571 x = relax.Var("x", R.Tensor())
572 y = relax.Var("y", R.Tensor())
573 bb = relax.BlockBuilder()
574 with bb.function("foo", (x, y)):
575 t1 = bb.emit(relax.Tuple([x, y]))
576 t2 = bb.emit(relax.Tuple([x, y]))
577 a = bb.emit(relax.TupleGetItem(t1, 0))
578 b = bb.emit(relax.TupleGetItem(t2, 1))
579 c = bb.emit(relax.op.add(a, b))
580 bb.emit_func_output(c)
581
582 _check(foo, bb.get()["foo"])
583
584
585def test_dataflow_block():

Callers

nothing calls this directly

Calls 7

functionMethod · 0.95
emitMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
_checkFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…