()
| 35 | |
| 36 | |
| 37 | def 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 | |
| 58 | def test_argmax(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…