π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Merge branch 'optimize' of https://github.com/Varun-sai-500/kornia into optimize
Varun Sai37cb61d7a282
diff --cc kornia/feature/lightglue_onnx/lightglue.pyindex a0b26030b,5f34f2bbb..26802f6d3--- a/kornia/feature/lightglue_onnx/lightglue.py+++ b/kornia/feature/lightglue_onnx/lightglue.py@@@ -186,22 -186,12 +186,22 @@@ class OnnxLightGluematches, mscores = binding.get_outputs()# Prefer DLPack-based conversion when available for zero-copy transfer between them# The fallback path uses NumPy, which incurs a device-to-host copy and is slower.++ # ORT's io_binding.get_outputs() returns Python-level OrtValue wrappers.+ # The DLPack protocol (__dlpack__ + __dlpack_device__) is only available on+ # the underlying pybind11 C object (_ortvalue), not the Python wrapper itself.+ # We use getattr to handle both current ORT (needs ._ortvalue) and future ORT+ # versions that may expose __dlpack__ directly on the wrapper.+ # Both outputs must support the full protocol before taking the zero-copy path._m = getattr(matches, "_ortvalue", matches)_s = getattr(mscores, "_ortvalue", mscores)- if hasattr(_m, "__dlpack__"):+ if (+ hasattr(_m, "__dlpack__") and hasattr(_m, "__dlpack_device__") and+ hasattr(_s, "__dlpack__") and hasattr(_s, "__dlpack_device__")+ ):outputs = {"matches": torch.from_dlpack(_m),- "scores": torch.from_dlpack(_s),+ "scores": torch.from_dlpack(_s),}else:outputs = {