昇腾社区首页
中文
注册

AscendIndexFlat接口

API定义

AscendIndexFlat(const faiss::IndexFlat *index, AscendIndexFlatConfig config = AscendIndexFlatConfig());

功能描述

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

输入

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

AscendIndexFlatConfig config:Device侧资源配置。

输出

返回值

约束说明

“index”需要为合法有效的CPU index指针,该index的维度d参数取值范围为{32, 64, 128, 256, 384, 512, 768, 1024, 1408, 1536, 2048, 3072, 3584, 4096}。底库向量总数的取值范围:0 ≤ n < 1e9,metric_type参数取值为{faiss::MetricType::METRIC_L2, faiss::MetricType::METRIC_INNER_PRODUCT}。

API定义

AscendIndexFlat(const faiss::IndexIDMap*index, AscendIndexFlatConfig config = AscendIndexFlatConfig());

功能描述

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

输入

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

AscendIndexFlatConfig config:Device侧资源配置。

输出

返回值

约束说明

“index”需要为合法有效的IndexIDMap指针,该Index的成员索引维度d参数取值范围为{32, 64, 128, 256, 384, 512, 768, 1024, 1408, 1536, 2048, 3072, 3584, 4096}。底库向量总数的取值范围:0 ≤ n < 1e9,metric_type参数取值为{faiss::MetricType::METRIC_L2, faiss::MetricType::METRIC_INNER_PRODUCT}。

API定义

AscendIndexFlat(int dims, faiss::MetricType metric, AscendIndexFlatConfig config = AscendIndexFlatConfig());

功能描述

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

输入

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

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

AscendIndexFlatConfig config:Device侧资源配置。

输出

返回值

约束说明

  • dims ∈ {32, 64, 128, 256, 384, 512, 768, 1024, 1408, 1536, 2048, 3072, 3584, 4096}。
  • metric ∈ {faiss::MetricType::METRIC_L2, faiss::MetricType::METRIC_INNER_PRODUCT}。

API定义

AscendIndexFlat(const AscendIndexFlat&) = delete;

功能描述

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

输入

const AscendIndexFlat&:常量AscendIndexFlat。

输出

返回值

约束说明

API定义

virtual ~AscendIndexFlat();

功能描述

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

输入

输出

返回值

约束说明