From 6d0da9915bbccf92d751ad4146e00bc8cce8dfa1 Mon Sep 17 00:00:00 2001 From: Amir Sadoughi Date: Thu, 22 Aug 2024 21:48:47 -0400 Subject: [PATCH] 3526: numpy 2 hacks * need to fix SWIG to understand why its not auto-converting np.float32 as float * as it was before * numpy/numpy/18058 mentions we should be using show_config() or perhaps show_runtime() instead of the internal api --- faiss/python/loader.py | 2 +- tests/test_contrib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/faiss/python/loader.py b/faiss/python/loader.py index fa75edb468..006a05a977 100644 --- a/faiss/python/loader.py +++ b/faiss/python/loader.py @@ -44,7 +44,7 @@ def is_sve_supported(): import numpy if Version(numpy.__version__) >= Version("1.19"): # use private API as next-best thing until numpy/numpy#18058 is solved - from numpy.core._multiarray_umath import __cpu_features__ + from numpy._core._multiarray_umath import __cpu_features__ # __cpu_features__ is a dictionary with CPU features # as keys, and True / False as values supported = {k for k, v in __cpu_features__.items() if v} diff --git a/tests/test_contrib.py b/tests/test_contrib.py index 05a2c4ac8b..aec8791856 100644 --- a/tests/test_contrib.py +++ b/tests/test_contrib.py @@ -373,7 +373,7 @@ def test_float(self): D, I = ivf_tools.search_preassigned(index, xq, 4, a) radius = D.max() * 1.01 - lims, DR, IR = ivf_tools.range_search_preassigned(index, xq, radius, a) + lims, DR, IR = ivf_tools.range_search_preassigned(index, xq, float(radius), a) # with that radius the k-NN results are a subset of the range search # results