File tree Expand file tree Collapse file tree 4 files changed +4
-43
lines changed
Expand file tree Collapse file tree 4 files changed +4
-43
lines changed Original file line number Diff line number Diff line change 8686#else
8787#define TVM_FFI_FUNC_SIG __func__
8888#endif
89- // / \endcond
9089
9190#if defined(__GNUC__)
9291// gcc and clang and attribute constructor
115114 return 0 ; \
116115 }(); \
117116 static void FnName ()
118- // / \endcond
119- /* !
120- * \brief Macro that defines a block that will be called during static initialization.
121- *
122- * \code{.cpp}
123- * TVM_FFI_STATIC_INIT_BLOCK() {
124- * RegisterFunctions();
125- * }
126- * \endcode
127- */
117+
128118#define TVM_FFI_STATIC_INIT_BLOCK () \
129119 TVM_FFI_STATIC_INIT_BLOCK_DEF_ (TVM_FFI_STR_CONCAT(__TVMFFIStaticInitFunc, __COUNTER__), \
130120 TVM_FFI_STR_CONCAT(__TVMFFIStaticInitReg, __COUNTER__))
121+ // / \endcond
131122#endif
132123
133- /* !
124+ /*
134125 * \brief Define the default copy/move constructor and assign operator
135126 * \param TypeName The class typename.
136127 */
@@ -322,4 +313,5 @@ using TypeSchema = TypeSchemaImpl<std::remove_const_t<std::remove_reference_t<T>
322313} // namespace details
323314} // namespace ffi
324315} // namespace tvm
316+ // / \endcond
325317#endif // TVM_FFI_BASE_DETAILS_H_
Original file line number Diff line number Diff line change @@ -184,7 +184,6 @@ class DLTensorTestWrapper:
184184def _dltensor_test_wrapper_c_dlpack_from_pyobject_as_intptr () -> int : ...
185185
186186class Function (Object ):
187- def __init__ (self , func : Callable [..., Any ]) -> None : ...
188187 @property
189188 def release_gil (self ) -> bool : ...
190189 @release_gil .setter
Original file line number Diff line number Diff line change @@ -889,27 +889,6 @@ cdef class Function(Object):
889889 def __cinit__ (self ) -> None:
890890 self.c_release_gil = _RELEASE_GIL_BY_DEFAULT
891891
892- def __init__(self , func: Callable[..., Any]) -> None:
893- """Initialize a Function from a Python callable.
894-
895- This constructor allows creating a `tvm_ffi.Function` directly
896- from a Python function or another `tvm_ffi.Function` instance.
897-
898- Parameters
899- ----------
900- func : Callable[..., Any]
901- The Python callable to wrap.
902- """
903- cdef TVMFFIObjectHandle chandle = NULL
904- if not callable(func ):
905- raise TypeError (f" func must be callable, got {type(func)}" )
906- if isinstance (func, Function):
907- chandle = (< Object> func).chandle
908- TVMFFIObjectIncRef(chandle)
909- else :
910- _convert_to_ffi_func_handle(func, & chandle)
911- self .chandle = chandle
912-
913892 property release_gil:
914893 """Whether calls release the Python GIL while executing."""
915894
Original file line number Diff line number Diff line change @@ -153,15 +153,6 @@ def fapply(f: Any, *args: Any) -> Any:
153153 assert fapply (add , 1 , 3.3 ) == 4.3
154154
155155
156- def test_pyfunc_init () -> None :
157- def add (a : int , b : int ) -> int :
158- return a + b
159-
160- fadd = tvm_ffi .Function (add )
161- assert isinstance (fadd , tvm_ffi .Function )
162- assert fadd (1 , 2 ) == 3
163-
164-
165156def test_global_func () -> None :
166157 @tvm_ffi .register_global_func ("mytest.echo" )
167158 def echo (x : Any ) -> Any :
You can’t perform that action at this time.
0 commit comments