AscendIndexIVFPQ

API Definition

AscendIndexIVFPQ(int dims, int nlist, int subQuantizers, int bitsPerCode, faiss::MetricType metric, AscendIndexIVFPQConfig config = AscendIndexIVFPQConfig())

Function

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

Input

int dims: dimensions of a group of feature vectors managed by AscendIndexIVFPQ.

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

int subQuantizers: number of subquantizers of AscendIndexIVFPQ.

int bitsPerCode: number of bits of AscendIndexIVFPQ

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

AscendIndexIVFFlatConfig config: resource configuration on the NPU.

Output

N/A

Return Value

N/A

Restrictions

  • dim ∈ {64, 128, 256, 384, 512, 1024, 2048}.
  • nlist ∈ {1024, 2048, 4096, 8192, 16384}.
  • dim/subQuantizers ∈ {4, 8, 16, 32, 48, 64, 96, 128, 256}.
  • bitsPerCode = 8 (Currently, the value of bitsPerCode can only be 8.)
  • metric = faiss::MetricType::METRIC_L2 (Currently, only faiss::MetricType::METRIC_L2 is supported.)