MCPcopy Create free account
hub / github.com/apache/tvm-ffi / ValueProtocol

Class ValueProtocol

tests/python/test_function.py:397–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395
396def test_function_with_value_protocol() -> None:
397 class ValueProtocol:
398 def __init__(self, value: Any) -> None:
399 self.value = value
400
401 def __tvm_ffi_value__(self) -> Any:
402 return self.value
403
404 fecho = tvm_ffi.get_global_func("testing.echo")
405 assert fecho(ValueProtocol(10)) == 10

Callers 1

Calls

no outgoing calls

Tested by 1