Ivf Pq Package
Go package: ivf_pq
Sources: go/ivf_pq
Constants
InternalDistance_Float32 Constants
Source: go/ivf_pq/search_params.go:43
Lut_Uint8 Constants
Source: go/ivf_pq/search_params.go:19
Subspace Constants
Source: go/ivf_pq/index_params.go:18
Variables
CInternalDistanceDtypes
Source: go/ivf_pq/search_params.go:48
Types
IndexParams
Source: go/ivf_pq/index_params.go:12
IvfPqIndex
IVF PQ Index
Source: go/ivf_pq/ivf_pq.go:14
SearchParams
Supplemental parameters to search IVF PQ Index
Source: go/ivf_pq/search_params.go:13
Functions
BuildIndex
Builds an IvfPqIndex from the dataset for efficient search.
Arguments
Resources- Resources to useparams- Parameters for building the indexdataset- A row-major Tensor on either the host or device to indexindex- IvfPqIndex to build
Source: go/ivf_pq/ivf_pq.go:39
CreateIndex
Creates a new empty IvfPqIndex
Source: go/ivf_pq/ivf_pq.go:20
CreateIndexParams
Creates a new IndexParams
Source: go/ivf_pq/index_params.go:29
CreateSearchParams
Creates a new SearchParams
Source: go/ivf_pq/search_params.go:54
SearchIndex
Perform a Approximate Nearest Neighbors search on the Index
Arguments
Resources- Resources to useparams- Parameters to use in searching the indexindex- IvfPqIndex to searchqueries- A tensor in device memory to query forneighbors- Tensor in device memory that receives the indices of the nearest neighborsdistances- Tensor in device memory that receives the distances of the nearest neighbors
Source: go/ivf_pq/ivf_pq.go:67
Methods
IndexParams.Close
Destroys IndexParams
Source: go/ivf_pq/index_params.go:143
IndexParams.SetAddDataOnBuild
After training the coarse and fine quantizers, we will populate the index with the dataset if add_data_on_build == true, otherwise the index is left empty, and the extend method can be used to add new vectors to the index.
Source: go/ivf_pq/index_params.go:133
IndexParams.SetCodebookKind
Source: go/ivf_pq/index_params.go:98
IndexParams.SetForceRandomRotation
Apply a random rotation matrix on the input data and queries even
if dim % pq_dim == 0. Note: if dim is not multiple of pq_dim,
a random rotation is always applied to the input data and queries
to transform the working space from dim to rot_dim, which may
be slightly larger than the original space and and is a multiple
of pq_dim (rot_dim % pq_dim == 0). However, this transform is
not necessary when dim is multiple of pq_dim (dim == rot_dim,
hence no need in adding “extra” data columns / features). By
default, if dim == rot_dim, the rotation transform is
initialized with the identity matrix. When
force_random_rotation == True, a random orthogonal transform
Source: go/ivf_pq/index_params.go:120
IndexParams.SetKMeansNIters
The number of iterations searching for kmeans centers during index building.
Source: go/ivf_pq/index_params.go:65
IndexParams.SetKMeansTrainsetFraction
If kmeans_trainset_fraction is less than 1, then the dataset is subsampled, and only n_samples * kmeans_trainset_fraction rows are used for training.
Source: go/ivf_pq/index_params.go:73
IndexParams.SetMetric
Distance Type to use for building the index
Source: go/ivf_pq/index_params.go:47
IndexParams.SetMetricArg
Metric argument for Minkowski distances - set to 2.0 if not applicable
Source: go/ivf_pq/index_params.go:59
IndexParams.SetNLists
The number of clusters used in the coarse quantizer.
Source: go/ivf_pq/index_params.go:41
IndexParams.SetPQBits
The bit length of the vector element after quantization.
Source: go/ivf_pq/index_params.go:79
IndexParams.SetPQDim
The dimensionality of a the vector after product quantization. When zero, an optimal value is selected using a heuristic. Note pq_dim * pq_bits must be a multiple of 8. Hint: a smaller ‘pq_dim’ results in a smaller index size and better search performance, but lower recall. If ‘pq_bits’ is 8, ‘pq_dim’ can be set to any number, but multiple of 8 are desirable for good performance. If ‘pq_bits’ is not 8, ‘pq_dim’ should be a multiple of 8. For good performance, it is desirable that ‘pq_dim’ is a multiple of 32. Ideally, ‘pq_dim’ should be also a divisor of the dataset dim.
Source: go/ivf_pq/index_params.go:93
IvfPqIndex.Close
Destroys the IvfPqIndex
Source: go/ivf_pq/ivf_pq.go:49
SearchParams.Close
Destroys SearchParams
Source: go/ivf_pq/search_params.go:101
SearchParams.SetInternalDistanceDtype
Storage data type for distance/similarity computation.
Source: go/ivf_pq/search_params.go:89
SearchParams.SetLutDtype
Data type of look up table to be created dynamically at search time. The use of low-precision types reduces the amount of shared memory required at search time, so fast shared memory kernels can be used even for datasets with large dimansionality. Note that the recall is slightly degraded when low-precision type is selected.
Source: go/ivf_pq/search_params.go:77
SearchParams.SetNProbes
The number of clusters to search.
Source: go/ivf_pq/search_params.go:66