lp:~medib/opensearch-project-components/+git/python-faiss

Owned by Mehdi B.
Get this repository:
git clone https://git.launchpad.net/~medib/opensearch-project-components/+git/python-faiss
Only Mehdi B. can upload to this repository. If you are Mehdi B. please log in for upload directions.

Branches

Name Last Modified Last Commit
main 2023-10-03 09:30:47 UTC
Fix SingleBestResultHandler bug. if IndexFlatL2 empty data then search topk =...

Author: Haijun Yu
Author Date: 2023-10-03 09:30:47 UTC

Fix SingleBestResultHandler bug. if IndexFlatL2 empty data then search topk = 1 return label = 0 not -1. (#3075)

Summary:
Fix SingleBestResultHandler bug. if IndexFlatL2 empty data then search topk = 1 return label = 0 not -1.

for example

 int d = 64; // dimension
    int nb = 100000; // database size
    int nq = 1; // nb of queries

    std::mt19937 rng;
    std::uniform_real_distribution<> distrib;

    float* xb = new float[d * nb];
    float* xq = new float[d * nq];

    for (int i = 0; i < nb; i++) {
        for (int j = 0; j < d; j++)
            xb[d * i + j] = distrib(rng);
        xb[d * i] += i / 1000.;
    }

    for (int i = 0; i < nq; i++) {
        for (int j = 0; j < d; j++)
            xq[d * i + j] = distrib(rng);
        xq[d * i] += i / 1000.;
    }

    faiss::IndexFlatL2 index(d); // call constructor
    printf("is_trained = %s\n", index.is_trained ? "true" : "false");

    int k = 1;

    { // sanity check: search 1 first vectors of xb
        idx_t* I = new idx_t[k * nq];
        float* D = new float[k * nq];

        index.search(nq, xb, k, D, I); // *I = 0 not -1
 }

Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3075

Reviewed By: pemazare

Differential Revision: D49749983

Pulled By: mdouze

fbshipit-source-id: 10e9784035118b9e33e109180cab425de28d4ded

11 of 1 result
This repository contains Public information 
Everyone can see this information.

Subscribers