API定义 |
APP_ERROR MultiSearchWithMask(std::vector<AscendIndexVStar*>& indexes, const AscendIndexSearchParams& params, const std::vector<uint8_t>& mask, bool merge); |
---|---|
功能描述 |
实现从多个AscendIndexVStar库执行特征向量查询的接口,根据输入的特征向量返回最相似的topK条特征距离及ID。提供基于mask掩码决定底库是否参与距离计算的功能。mask为0、1比特串,每个比特代表底库中对应顺序的特征是否参与距离计算,“0”表示不参与,“1”表示参与。 |
输入 |
std::vector<AscendIndexVStar*>& indexes:待执行检索的多个Index。 const AscendIndexSearchParams& params:检索参数,具体请参见12.5.13.6-AscendIndexSearchParams。 size_t n:查询的特征向量的条数。 std::vector<float>& queryData:特征向量数据。 int topK:需要返回的最近似的结果个数。 const std::vector<uint8_t>& mask:特征底库掩码。 bool merge:是否需要合并多个Index上执行检索的结果。 |
输出 |
std::vector<float>& dists:查询向量与距离最近的前“topK”个向量间的距离值。 std::vector<int64_t>& labels:查询的距离最近的前“topK”个向量的ID。 |
返回值 |
APP_ERROR:调用返回状态,具体请参见接口调用返回值参考。 |
约束说明 |
|