tqchen commented on code in PR #189:
URL: https://github.com/apache/tvm-ffi/pull/189#discussion_r2472922348
##########
python/tvm_ffi/_optional_torch_c_dlpack.py:
##########
@@ -54,6 +54,15 @@ def load_torch_c_dlpack_extension() -> Any:
return None
"""Load the torch c dlpack extension."""
+ try:
+ import torch_c_dlpack_ext # type: ignore # noqa: PLC0415
+
+ func = torch_c_dlpack_ext.load_torch_c_dlpack_lib(torch.__version__)
+ setattr(torch.Tensor, "__c_dlpack_exchange_api__", func())
+ return None
+ except ImportError:
Review Comment:
note that this may still raise a ValueError if in the case of
load_torch_c_dlpack_lib failed, we should support such case as well, to relax
assumption here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]