昇腾社区首页
中文
注册

AscendIndexInt8Flat接口

API定义

AscendIndexInt8Flat(int dims, faiss::MetricType metric = faiss::METRIC_L2, AscendIndexInt8FlatConfig config = AscendIndexInt8FlatConfig());

功能描述

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

输入

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

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

AscendIndexFlatConfig config:Device侧资源配置。

输出

返回值

约束说明

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

API定义

AscendIndexInt8Flat(const faiss::IndexScalarQuantizer *index, AscendIndexInt8FlatConfig config = AscendIndexInt8FlatConfig());

功能描述

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

输入

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

AscendIndexInt8FlatConfig config:Device侧资源配置。

输出

返回值

约束说明

“index”需要为合法有效的CPU index指针,必须为AscendIndexInt8Flat执行copyTo接口生成的faiss::IndexScalarQuantizer类型指针。

API定义

AscendIndexInt8Flat(const faiss::IndexIDMap*index, AscendIndexInt8FlatConfig config = AscendIndexInt8FlatConfig());

功能描述

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

输入

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

AscendIndexInt8FlatConfig config:Device侧资源配置。

输出

返回值

约束说明

“index”需要为合法有效的CPU index指针,必须为AscendIndexInt8Flat执行copyTo接口生成的faiss::IndexIDMap类型指针。

API定义

AscendIndexInt8Flat(const AscendIndexInt8Flat&) = delete;

功能描述

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

输入

const AscendIndexInt8Flat&:常量AscendIndexInt8Flat。

输出

返回值

约束说明

API定义

virtual ~AscendIndexInt8Flat();

功能描述

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

输入

输出

返回值

约束说明