()
| 147 | |
| 148 | |
| 149 | def test_pyfunc_convert() -> None: |
| 150 | def add(a: int, b: int) -> int: |
| 151 | return a + b |
| 152 | |
| 153 | fadd = tvm_ffi.convert(add) |
| 154 | assert isinstance(fadd, tvm_ffi.Function) |
| 155 | assert fadd(1, 2) == 3 |
| 156 | |
| 157 | def fapply(f: Any, *args: Any) -> Any: |
| 158 | return f(*args) |
| 159 | |
| 160 | fapply = tvm_ffi.convert(fapply) |
| 161 | assert fapply(add, 1, 3.3) == 4.3 |
| 162 | |
| 163 | |
| 164 | def test_global_func() -> None: |