Beispiel #1
0
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
Beispiel #2
0
 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
Beispiel #3
0
 def __init__(self, repeats=2):
     import threadpoolctl
     self._info = threadpoolctl.threadpool_info()
     self._controller = threadpoolctl.ThreadpoolController()
     self._stable = 0
     self.repeats = repeats