昇腾社区首页
中文
注册

AscendIndexIVFPQ

API定义

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

功能描述

AscendIndexIVFPQ的构造函数,生成AscendIndexIVFPQ,此时根据“config”中配置的值设置NPU侧资源。

输入

int dims:AscendIndexIVFPQ管理的一组特征向量的维度。

int nlist:聚类中心的个数,与算子生成脚本中的“coarse_centroid_num”参数对应。

int subQuantizers:AscendIndexIVFPQ的子量化器数量。

int bitsPerCode:AscendIndexIVFPQ的bit数。

faiss::MetricType metric:AscendIndex在执行特征向量相似度检索的时候使用的距离度量类型。

AscendIndexIVFFlatConfig config:NPU侧资源配置。

输出

返回值

约束说明

  • 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 (当前“bitsPerCode”仅支持8)。
  • metric = faiss::MetricType::METRIC_L2 (当前仅支持faiss::MetricType::METRIC_L2)。