()
| 53 | |
| 54 | |
| 55 | def test_linear(): |
| 56 | @R.function |
| 57 | def foo( |
| 58 | x: R.Tensor((2, 3, 4, 5), "float32"), |
| 59 | w: R.Tensor((3, 5), "float32"), |
| 60 | bias: R.Tensor((3,), "float32"), |
| 61 | ): |
| 62 | gv = R.linear(x, w, bias) |
| 63 | return gv |
| 64 | |
| 65 | x = relax.Var("x", R.Tensor((2, 3, 4, 5), "float32")) |
| 66 | w = relax.Var("y", R.Tensor((3, 5), "float32")) |
| 67 | bias = relax.Var("bias", R.Tensor((3,), "float32")) |
| 68 | bb = relax.BlockBuilder() |
| 69 | with bb.function("foo", [x, w, bias]): |
| 70 | w_T = bb.emit(relax.op.permute_dims(w, axes=None)) |
| 71 | matmul = bb.emit(relax.op.matmul(x, w_T)) |
| 72 | out = matmul + bias |
| 73 | bb.emit_func_output(out) |
| 74 | |
| 75 | _check(foo, bb.get()["foo"]) |
| 76 | |
| 77 | |
| 78 | def test_einsum(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…