Specify number of cores in search

This commit is contained in:
ixaxaar 2017-12-15 18:27:41 +05:30
parent 637e481c6f
commit 116432d2c5

View File

@ -37,7 +37,7 @@ class FLANNIndex(object):
elif isinstance(query, T.Tensor): elif isinstance(query, T.Tensor):
query = query.cpu().numpy() query = query.cpu().numpy()
l, d = self.index.nn_index(query, num_neighbors=self.K if k is None else k) l, d = self.index.nn_index(query, num_neighbors=self.K if k is None else k, cores=4)
distances = T.from_numpy(d).float() distances = T.from_numpy(d).float()
labels = T.from_numpy(l).long() labels = T.from_numpy(l).long()