def _get_threadpool_controller(): if not hasattr(threadpoolctl, "ThreadpoolController"): return None if not hasattr(sklearn, "_sklearn_threadpool_controller"): sklearn._sklearn_threadpool_controller = threadpoolctl.ThreadpoolController() return sklearn._sklearn_threadpool_controller
def check_update(self): import threadpoolctl new_info = threadpoolctl.threadpool_info() if new_info != self._info: self._stable = 0 self._controller = threadpoolctl.ThreadpoolController() self._info = new_info else: self._stable += 1
def __init__(self, repeats=2): import threadpoolctl self._info = threadpoolctl.threadpool_info() self._controller = threadpoolctl.ThreadpoolController() self._stable = 0 self.repeats = repeats