AscendIndexIVFSP
Before passing config to the function, set conf.handleBatch, conf.nprobe, and conf.searchListSize based on your requirements. For details about the field description, see Common Parameters.
The values of conf.handleBatch and conf.searchListSize must be the same as those of <nprobe handle batch> and <search list size> specified in the service operator model file in IVFSP.
The default value of conf.filterable (inherited from AscendIndexConfig) is false. To use the search_with_filter() API, you need to set conf.filterable to true. If conf.filterable is set to true, additional information is stored on the NPU, consuming more NPU memory.
API definition |
AscendIndexIVFSP(int dims, int nonzeroNum, int nlist, const char *codeBookPath, faiss::ScalarQuantizer::QuantizerType qType = ScalarQuantizer::QuantizerType::QT_8bit, faiss::MetricType metric = MetricType::METRIC_L2, AscendIndexIVFSPConfig config = AscendIndexIVFSPConfig()); |
|---|---|
Function |
Constructor of AscendIndexIVFSP. The device resources are set based on the value configured in config. |
Input |
int dims: dimensions of a group of feature vectors managed by AscendIndexIVFSP. int nonzeroNum: number of non-zero dimensions after feature vector compression and dimension reduction. int nlist: number of cluster centroids, which corresponds to the value of <centroid num> in Generating the IVFSP Service Operator Model File. const char *codeBookPath: path of the codebook file used by the IVFSP. faiss::ScalarQuantizer::QuantizerType qType: scalar quantization type. Currently, only ScalarQuantizer::QuantizerType::QT_8bit is supported. faiss::MetricType metric: distance measurement type used by AscendIndex when it retrieves feature vector similarity. Currently, faiss::MetricType metric supports only METRIC_L2. AscendIndexIVFSPConfig: resource configuration on the device. |
Output |
N/A |
Return value |
N/A |
Restrictions |
|
API definition |
AscendIndexIVFSP(int dims, int nonzeroNum, int nlist, const AscendIndexIVFSP &codeBookSharedIdx, faiss::ScalarQuantizer::QuantizerType qType = ScalarQuantizer::QuantizerType::QT_8bit, faiss::MetricType metric = MetricType::METRIC_L2, AscendIndexIVFSPConfig config = AscendIndexIVFSPConfig()); |
|---|---|
Function |
Constructor of AscendIndexIVFSP. The device resources are set based on the information configured in config. |
Input |
int dims: dimensions of a group of feature vectors managed by AscendIndexIVFSP. int nonzeroNum: number of non-zero dimensions after feature vector compression and dimension reduction. int nlist: number of cluster centroids, which corresponds to the value of <centroid num> in Generating the IVFSP Service Operator Model File. const AscendIndexIVFSP &codeBookSharedIdx: AscendIndexIVFSP object of the shared codebook. faiss::ScalarQuantizer::QuantizerType qType: scalar quantization type. Currently, only ScalarQuantizer::QuantizerType::QT_8bit is supported. faiss::MetricType metric: distance measurement type used by AscendIndex when it retrieves feature vector similarity. Currently, faiss::MetricType metric supports only METRIC_L2. AscendIndexIVFSPConfig: resource configuration on the device. |
Output |
N/A |
Return value |
N/A |
Restrictions |
|
API definition |
AscendIndexIVFSP (const AscendIndexIVFSP&) = delete; |
|---|---|
Function |
Declares that the copy constructor of this Index class is void, that is, it cannot be copied. |
Input |
const AscendIndexIVFSP&: constant AscendIndexIVFSP. |
Output |
N/A |
Return value |
N/A |
Restrictions |
N/A |
API definition |
virtual ~AscendIndexIVFSP(); |
|---|---|
Function |
Destructor of AscendIndexIVFSP, which is used to destroy the AscendIndexIVFSP object and resources. |
Input |
N/A |
Output |
N/A |
Return value |
N/A |
Restrictions |
N/A |
API definition |
AscendIndexIVFSP(int dims, int nonzeroNum, int nlist, faiss::ScalarQuantizer::QuantizerType qType = ScalarQuantizer::QuantizerType::QT_8bit, faiss::MetricType metric = MetricType::METRIC_L2, AscendIndexIVFSPConfig config = AscendIndexIVFSPConfig()); |
|---|---|
Function |
Constructor of AscendIndexIVFSP. The device resources are set based on the value configured in config. |
Input |
|
Output |
N/A |
Return value |
N/A |
Restrictions |
|