Fix unused variables in python

Reviewed By: mdouze

Differential Revision: D26633983

fbshipit-source-id: 32b9f95ed9647716f65b93f2713a8d5bad6abe78
pull/1704/head
Lucas Hosseini 2021-02-24 11:51:03 -08:00 committed by Facebook GitHub Bot
parent 55c93f3cde
commit 6d51766607
7 changed files with 8 additions and 15 deletions

View File

@ -96,7 +96,7 @@ def parse_result_file(fname):
assert False
st = 1
elif 'index size on disk:' in l:
index_size = int(l.split()[-1])
stats["index_size"] = int(l.split()[-1])
elif st == 1:
st = 2
elif st == 2:
@ -256,7 +256,6 @@ def plot_tradeoffs(db, allres, allstats, code_size, recall_rank):
stat0 = next(iter(allstats.values()))
d = stat0["d"]
n_threads = stat0["n_threads"]
nq = stat0["nq"]
recall_idx = stat0["ranks"].index(recall_rank)
# times come after the perf measure
times_idx = len(stat0["ranks"])

View File

@ -40,7 +40,7 @@ def do_partition(n, qin, maxval=65536, seed=123, id_type='int64'):
else:
q_min, q_max = qin
q = np.array([-1], dtype='uint64')
thresh2 = faiss.CMax_uint16_partition_fuzzy(
faiss.CMax_uint16_partition_fuzzy(
tab_a.get(), sp(ids), n,
q_min, q_max, sp(q)
)

View File

@ -115,7 +115,6 @@ def range_ground_truth(xq, db_iterator, threshold, metric_type=faiss.METRIC_L2,
i0 = 0
D = [[] for _i in range(nq)]
I = [[] for _i in range(nq)]
all_lims = []
for xbi in db_iterator:
ni = xbi.shape[0]
if ngpu > 0:

View File

@ -309,7 +309,6 @@ class TestIVFIndices(unittest.TestCase):
res = faiss.StandardGpuResources()
d = 128
nb = 5000
nq = 10
nlist = 10
rs = np.random.RandomState(567)
@ -341,7 +340,6 @@ class TestIVFIndices(unittest.TestCase):
res = faiss.StandardGpuResources()
d = 128
nb = 5000
nq = 10
nlist = 10
M = 4
nbits = 8
@ -377,7 +375,6 @@ class TestIVFIndices(unittest.TestCase):
res = faiss.StandardGpuResources()
d = 128
nb = 5000
nq = 10
nlist = 10
qtype = faiss.ScalarQuantizer.QT_4bit

View File

@ -58,7 +58,7 @@ class TestIndexFlat(unittest.TestCase):
for i in range(nq):
l0, l1 = lims[i:i + 2]
Dl, Il = D2[l0:l1], I2[l0:l1]
_, Il = D2[l0:l1], I2[l0:l1]
if metric_type == faiss.METRIC_L2:
Ilref, = np.where(all_dis[i] < radius)
else:

View File

@ -160,12 +160,12 @@ class TestPartitioningUint16(unittest.TestCase, PartitionTests):
# print("tab a type", tab_a.get())
if type(q) == int:
thresh2 = faiss.CMax_uint16_partition_fuzzy(
faiss.CMax_uint16_partition_fuzzy(
tab_a.get(), sp(ids), n, q, q, None)
else:
q_min, q_max = q
q = np.array([-1], dtype='uint64')
thresh2 = faiss.CMax_uint16_partition_fuzzy(
faiss.CMax_uint16_partition_fuzzy(
tab_a.get(), sp(ids), n,
q_min, q_max, sp(q)
)
@ -209,7 +209,7 @@ class TestPartitioningUint16Min(unittest.TestCase, PartitionTests):
# print("tab a type", tab_a.get())
if type(q) == int:
thresh2 = faiss.CMin_uint16_partition_fuzzy(
faiss.CMin_uint16_partition_fuzzy(
tab_a.get(), sp(ids), n, q, q, None)
else:
q_min, q_max = q

View File

@ -158,8 +158,8 @@ class TestAccuracy(unittest.TestCase):
if 'Lattice' in highac:
codec2 = faiss.deserialize_index(
faiss.serialize_index(codec))
codes = codec.sa_encode(x)
x3 = codec.sa_decode(codes)
codes = codec2.sa_encode(x)
x3 = codec2.sa_decode(codes)
self.assertTrue(np.all(x2 == x3))
def test_SQ(self):
@ -208,8 +208,6 @@ class LatticeTest(unittest.TestCase):
vecs = vec.copy()
vecs.sort()
repeats = faiss.Repeats(dim, swig_ptr(vecs))
rr = [repeats.repeats.at(i) for i in range(repeats.repeats.size())]
# print([(r.val, r.n) for r in rr])
code = repeats.encode(swig_ptr(vec))
#print(vec, code)
vec2 = np.zeros(dim, dtype='float32')