Giter Site home page Giter Site logo

Comments (7)

Enet4 avatar Enet4 commented on August 22, 2024 1

Good to know! I'll leave this open in the event that we or someone else would be interested in making it part of the high level API.

from faiss-rs.

Enet4 avatar Enet4 commented on August 22, 2024

I'm afraid that the high-level bindings do not expose setting index parameters once the index was already constructed. I have managed to make do without this, apparently.

In the low-level API, the constructor function to the parameter space object is faiss_ParameterSpace_new.

FaissParameterSpace* params = NULL;
int err = faiss_ParameterSpace_new(&params);

Nevertheless, if you'd like to try and extend the safe API with parameter space setting, please let me know, so I can then provide better guidance.

from faiss-rs.

guskovd avatar guskovd commented on August 22, 2024

I seem to have succeeded

	    let param = "nprobe".to_string();
	    let mut param_vec: Vec<*mut faiss_sys::FaissParameterSpace> = vec![std::ptr::null::<*mut faiss_sys::FaissParameterSpace>() as *mut _];
	    faiss_sys::faiss_ParameterSpace_new(param_vec.as_mut_ptr());
	    faiss_sys::faiss_ParameterSpace_set_index_parameter(*param_vec.as_mut_ptr(), self.inner_ptr(), param.as_ptr() as *const _, 2.0 );
	    let nprobe = faiss_sys::faiss_IndexIVF_nprobe(self.inner_ptr());
	    println!("{:?}", nprobe);
2

from faiss-rs.

ava57r avatar ava57r commented on August 22, 2024

Why is faiss_ParameterSpace_new required *mut *mut?

https://github.com/Enet4/faiss-rs/blob/master/faiss-sys/src/bindings.rs#L263

from faiss-rs.

Enet4 avatar Enet4 commented on August 22, 2024

@ava57r The function

extern "C" {
    pub fn faiss_ParameterSpace_new(space: *mut *mut FaissParameterSpace) -> ::std::os::raw::c_int;

Is the translation of the C function

int faiss_ParameterSpace_new(ParameterSpace** p_space);

Where to *p_space is assigned the output of constructing a ParameterSpace object via new. Using it would be something like this:

let mut p_space = std::ptr::null_mut();
let e = faiss_ParameterSpace_new(&mut p_space);

from faiss-rs.

ava57r avatar ava57r commented on August 22, 2024

faiss_ParameterSpace_free function exists only versions >= 1.6.4

fix free parameterspace (#1243)

from faiss-rs.

Enet4 avatar Enet4 commented on August 22, 2024

This seems to have been resolved by #14.

from faiss-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.