-
Notifications
You must be signed in to change notification settings - Fork 143
Expose graph and dataset accessors for CAGRA to C/Python #1086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1d84ac3
3f92c4f
5a8cb2b
14c92f1
97d7323
19757af
5d168e3
2f22d53
0eef37c
97d1f00
260eaa0
ab582f4
bd28402
29b83db
e447402
fe2f03f
8206323
ca991af
07acc6b
e199a4f
b03889b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ extern "C" { | |
| * @{ | ||
| */ | ||
|
|
||
| enum cuvsKMeansInitMethod { | ||
| typedef enum { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| /** | ||
| * Sample the centroids using the kmeans++ strategy | ||
| */ | ||
|
|
@@ -45,7 +45,7 @@ enum cuvsKMeansInitMethod { | |
| * User provides the array of initial centroids | ||
| */ | ||
| Array | ||
| }; | ||
| } cuvsKMeansInitMethod; | ||
|
|
||
| /** | ||
| * @brief Hyper-parameters for the kmeans algorithm | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2024, NVIDIA CORPORATION. | ||
| * Copyright (c) 2024-2025, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
|
|
@@ -358,6 +358,48 @@ cuvsError_t cuvsCagraIndexDestroy(cuvsCagraIndex_t index); | |
| */ | ||
| cuvsError_t cuvsCagraIndexGetDims(cuvsCagraIndex_t index, int* dim); | ||
|
|
||
| /** | ||
| * @brief Get size of the CAGRA index | ||
| * | ||
| * @param[in] index CAGRA index | ||
| * @param[out] size return number of vectors in the index | ||
| * @return cuvsError_t | ||
| */ | ||
| cuvsError_t cuvsCagraIndexGetSize(cuvsCagraIndex_t index, uint32_t* size); | ||
|
|
||
| /** | ||
| * @brief Get graph degree of the CAGRA index | ||
| * | ||
| * @param[in] index CAGRA index | ||
| * @param[out] graph_degree return graph degree | ||
| * @return cuvsError_t | ||
| */ | ||
| cuvsError_t cuvsCagraIndexGetGraphDegree(cuvsCagraIndex_t index, uint32_t* graph_degree); | ||
|
|
||
| /** | ||
| * @brief Get the CAGRA dataset | ||
| * | ||
| * @param[in] res cuvsResources_t opaque C handle | ||
| * @param[in] index CAGRA index | ||
| * @param[out] dataset output dataset, with shape (size, dim) | ||
| * @return cuvsError_t | ||
| */ | ||
| cuvsError_t cuvsCagraIndexGetDataset(cuvsResources_t res, | ||
| cuvsCagraIndex_t index, | ||
| DLManagedTensor* dataset); | ||
|
|
||
| /** | ||
| * @brief Get the CAGRA graph | ||
| * | ||
| * @param[in] res cuvsResources_t opaque C handle | ||
| * @param[in] index CAGRA index | ||
| * @param[out] graph the output knn graph, with shape (size, graph_degree) | ||
| * @return cuvsError_t | ||
| */ | ||
| cuvsError_t cuvsCagraIndexGetGraph(cuvsResources_t res, | ||
| cuvsCagraIndex_t index, | ||
| DLManagedTensor* graph); | ||
|
|
||
| /** | ||
| * @} | ||
| */ | ||
|
|
@@ -613,6 +655,21 @@ cuvsError_t cuvsCagraSerializeToHnswlib(cuvsResources_t res, | |
| */ | ||
| cuvsError_t cuvsCagraDeserialize(cuvsResources_t res, const char* filename, cuvsCagraIndex_t index); | ||
|
|
||
| /** | ||
| * Load index from a dataset and graph | ||
| * | ||
| * @param[in] res cuvsResources_t opaque C handle | ||
| * @param[in] metric cuvsDistanceType to use in the index | ||
| * @params[in] graph the knn graph to use , shape (size, graph_degree) | ||
| * @params[in] dataset the dataset to use , shape (size, dim) | ||
| * @param[out] index CAGRA index constructed from the graph and dataset | ||
| */ | ||
| cuvsError_t cuvsCagraIndexFromGraph(cuvsResources_t res, | ||
|
||
| cuvsDistanceType metric, | ||
| DLManagedTensor* graph, | ||
| DLManagedTensor* dataset, | ||
| cuvsCagraIndex_t index); | ||
benfred marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @brief Merge multiple CAGRA indices into a single CAGRA index. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍