Scikit-learn
human-activity-recognition
wearable
wrist
time-series
cpu
scikit-learn
WISP / src /wisp_fast /native.py
Zipeng365's picture
wisp-har 0.2.0: accelerated implementation with speed (exact/fast) and HMM sequence (subject/recording) options
ac7f7cb verified
Raw History Blame Contribute Delete
531 Bytes
"""Look up optional CPU symbols from the installed extension or standalone C build."""
import ctypes
from importlib.util import find_spec
from pathlib import Path
def lookup(symbol):
ext = find_spec("wisp_fast._kernels")
paths = [ext.origin] if ext is not None and ext.origin else []
paths.append(Path(__file__).with_name("_wisp_viterbi.so"))
for path in paths:
try:
return getattr(ctypes.CDLL(str(path)), symbol)
except (OSError, AttributeError):
continue
return None