mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-01 01:27:28 +00:00
* try-catch sklearn and scipy * haystack imports * linting * mypy * try to import baseretriever * remove typing * unused import * remove more typing * pylint * isolate sql imports for postgres, which we don't use anyway * remove stats * replace expit * als inmemory * mypy * feedback * docker * expit * re-add njit
18 lines
421 B
Python
18 lines
421 B
Python
import logging
|
|
import numpy as np
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
try:
|
|
from numba import njit # pylint: disable=import-error
|
|
except (ImportError, ModuleNotFoundError):
|
|
logger.debug("Numba not found, replacing njit() with no-op implementation. Enable it with 'pip install numba'.")
|
|
|
|
def njit(f):
|
|
return f
|
|
|
|
|
|
@njit # (fastmath=True)
|
|
def expit(x: float) -> float:
|
|
return 1 / (1 + np.exp(-x))
|