昇腾社区首页
中文
注册

AscendIndexSQ接口

API定义

AscendIndexSQ(const faiss::IndexScalarQuantizer* index, AscendIndexSQConfig config = AscendIndexSQConfig());

功能描述

AscendIndexSQ的构造函数,基于一个已有的“index”创建Ascend上的检索Index。

输入

const faiss::IndexScalarQuantizer* index:CPU侧的Index资源。

AscendIndexSQConfig config:Device侧资源配置。

输出

返回值

约束说明

“index”需要为合法有效的CPU index指针,该index的维度d参数取值范围为{64, 128, 256, 384, 512, 768},底库向量总数的取值范围:0 ≤ n < 1e9,metric_type参数取值为{faiss::MetricType::METRIC_L2, faiss::MetricType::METRIC_INNER_PRODUCT},sq.qtype参数仅支持“ScalarQuantizer::QuantizerType::QT_8bit”。

API定义

AscendIndexSQ(const faiss::IndexIDMap* index, AscendIndexSQConfig config = AscendIndexSQConfig());

功能描述

AscendIndexSQ的构造函数,基于一个已有的“index”创建Ascend上的检索Index。

输入

const faiss::IndexIDMap* index:CPU侧index资源。

AscendIndexSQConfig config:Device侧资源配置。

输出

返回值

约束说明

“index”需要为合法有效的CPU index指针,该index的成员索引的维度d参数取值范围为{64, 128, 256, 384, 512, 768},底库向量总数的取值范围:0 ≤ n < 1e9,metric_type参数取值为{faiss::MetricType::METRIC_L2, faiss::MetricType::METRIC_INNER_PRODUCT}, sq.qtype参数仅支持“ScalarQuantizer::QuantizerType::QT_8bit”。

API定义

AscendIndexSQ(int dims, faiss::ScalarQuantizer::QuantizerType qType = ScalarQuantizer::QuantizerType::QT_8bit, faiss::MetricType metric = MetricType::METRIC_L2, AscendIndexSQConfig config = AscendIndexSQConfig());

功能描述

AscendIndexSQ的构造函数,生成维度为dims的AscendIndex(单个Index管理的一组向量的维度是唯一的),此时根据“config”中配置的值设置Device侧资源。

输入

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

faiss::ScalarQuantizer::QuantizerType qType = ScalarQuantizer::QuantizerType::QT_8bit,当前仅支持“ScalarQuantizer::QuantizerType::QT_8bit”。

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

AscendIndexSQConfig config:Device侧资源配置。

输出

返回值

约束说明

  • dims ∈ {64, 128, 256, 384, 512, 768}。
  • metric ∈ {faiss::MetricType::METRIC_L2, faiss::MetricType::METRIC_INNER_PRODUCT}。

API定义

AscendIndexSQ(const AscendIndexSQ&) = delete;

功能描述

声明此index拷贝构造函数为空,即不可拷贝类型。

输入

const AscendIndexSQ&:AscendIndexSQ对象。

输出

返回值

约束说明

API定义

virtual ~AscendIndexSQ();

功能描述

AscendIndexSQ的析构函数,销毁AscendIndexSQ对象,释放资源。

输入

输出

返回值

约束说明