pub unsafe extern "C" fn cuvsHnswDeserialize(
res: cuvsResources_t,
params: cuvsHnswIndexParams_t,
filename: *const c_char,
dim: c_int,
metric: cuvsDistanceType,
index: cuvsHnswIndex_t,
) -> cuvsError_tExpand description
Load hnswlib index from file which was serialized from a HNSW index.
NOTE: When hierarchy is NONE, the loaded hnswlib index is immutable, and only be read by the
hnswlib wrapper in cuVS, as the serialization format is not compatible with the original
hnswlib. Experimental, both the API and the serialization format are subject to change.
@code{.c} #include <cuvs/core/c_api.h> #include <cuvs/neighbors/cagra.h> #include <cuvs/neighbors/hnsw.h>
// Create cuvsResources_t cuvsResources_t res; cuvsError_t res_create_status = cuvsResourcesCreate(&res);
// create an index with cuvsCagraBuild
cuvsCagraSerializeHnswlib(res, “/path/to/index”, index);
// Load the serialized CAGRA index from file as an hnswlib index // The index should have the same dtype as the one used to build CAGRA the index cuvsHnswIndex_t hnsw_index; cuvsHnswIndexCreate(&hnsw_index); cuvsHnsWIndexParams_t hnsw_params; cuvsHnswIndexParamsCreate(&hnsw_params); hnsw_params->hierarchy = NONE; hnsw_index->dtype = index->dtype; cuvsHnswDeserialize(res, hnsw_params, “/path/to/index”, dim, metric hnsw_index); @endcode
@param[in] res cuvsResources_t opaque C handle @param[in] params cuvsHnswIndexParams_t used to load Hnsw index @param[in] filename the name of the file that stores the index @param[in] dim the dimension of the vectors in the index @param[in] metric the distance metric used to build the index @param[out] index HNSW index loaded disk