()
| 191 | |
| 192 | |
| 193 | def test_object_protocol() -> None: |
| 194 | class CompactObject: |
| 195 | def __init__(self, backend_obj: Any) -> None: |
| 196 | self.backend_obj = backend_obj |
| 197 | |
| 198 | def __tvm_ffi_object__(self) -> Any: |
| 199 | return self.backend_obj |
| 200 | |
| 201 | x = tvm_ffi.convert([]) |
| 202 | assert isinstance(x, tvm_ffi.Object) |
| 203 | x_compact = CompactObject(x) |
| 204 | test_echo = tvm_ffi.get_global_func("testing.echo") |
| 205 | y = test_echo(x_compact) |
| 206 | assert y.__chandle__() == x.__chandle__() |
| 207 | |
| 208 | |
| 209 | def test_unregistered_object_fallback() -> None: |
nothing calls this directly
no test coverage detected