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

Function callback

tests/python/test_function.py:183–193  ·  view source on GitHub ↗
(x: Any, expected_count: int)

Source from the content-addressed store, hash-verified

181 use_count = tvm_ffi.get_global_func("testing.object_use_count")
182
183 def callback(x: Any, expected_count: int) -> Any:
184 # The use count of TVM FFI objects is decremented as part of
185 # `ObjectRef.__del__`, which runs when the Python object is
186 # destructed. However, Python object destruction is not
187 # deterministic, and even CPython's reference-counting is
188 # considered an implementation detail. Therefore, to ensure
189 # correct results from this test, `gc.collect()` must be
190 # explicitly called.
191 gc.collect()
192 assert expected_count == use_count(x)
193 return x._move()
194
195 f = tvm_ffi.convert(callback)
196

Callers 2

VisitContextSymbolsMethod · 0.85
ForEachFieldInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected