AscendIndexIVFSQC

API Definition

AscendIndexIVFSQC(int dimIn, int dimOut, int nlist, faiss::ScalarQuantizer::QuantizerType qtype = ScalarQuantizer::QuantizerType::QT_8bit, faiss::MetricType metric = MetricType::METRIC_INNER_PRODUCT, AscendIndexIVFSQCConfig config = AscendIndexIVFSQCConfig())

Function

Constructor of AscendIndexIVFSQC, which is used to generate AscendIndexIVFSQC. The NPU resources are set based on the value configured in config.

Input

int dimIn: dimensions of a group of original feature vectors managed by AscendIndexIVFSQC.

int dimOut: dimensions of a group of dimension-reduced feature vectors managed by AscendIndexIVFSQC.

int nlist: number of cluster centroids, which corresponds to coarse_centroid_num in the operator generation script.

faiss::ScalarQuantizer::QuantizerType qtype: quantizer type of AscendIndexIVFSQC.

faiss::MetricType metric: distance measurement type used by AscendIndex when it retrieves feature vector similarity.

AscendIndexIVFSQCConfig config: resource configuration on the NPU.

Output

N/A

Return Value

N/A

Restrictions

  • dimIn ∈ {64, 128, 256, 384, 512, 1024}.
  • dimOut ∈ {32, 64, 96, 128}, dimIn % dimOut = 0, and dimIn > dimOut.
  • nlist ∈ {1024, 2048, 4096, 8192, 16384, 32768}
  • qtype = ScalarQuantizer::QuantizerType::QT_8bit (Currently, only ScalarQuantizer::QuantizerType::QT_8bit is supported.)
  • metric = faiss::MetricType::METRIC_INNER_PRODUCT (Currently, only faiss::MetricType::METRIC_INNER_PRODUCT is supported.)