---
title: 函数：repo_add
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/others/fvsearch/aclpythondevg_01_0825.html
sourcePath: /source/zh/canncommercial/900/others/fvsearch/aclpythondevg_01_0825.html
indexId: e5b21815be501bcbe6b36a8ee100d0af58793d254e991c9717c658fbd4c24a6e72
---
# 函数：repo_add

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | x |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | x |
| Atlas 训练系列产品 | x |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | x |


#### 功能说明

添加底库或向已存在底库中添加特征。该章节描述的1:N表示“检索请求的个数：底库的数量”，N:M用于碰撞两个库的相似性。

Atlas 推理系列产品 中的 Atlas 推理系列加速模块产品 不支持该接口。


#### 函数原型

- C函数原型
  1 aclError aclfvRepoAdd(aclfvSearchType type, aclfvFeatureInfo *featureInfo)

- python函数
  1 ret = acl.fv.repo_add(type, feature_info)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| type | int，检索类型，请参见aclfvSearchType处说明。 |
| feature\_info | int，指针地址，指定特征描述信息。 需提前调用acl.fv.create\_feature\_info接口创建aclfvFeatureInfo类型的数据。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码。 返回0表示成功。 返回其它值表示失败。 |


#### 约束说明

- 1:N添加时，对于每个库，用户需要保证aclfvFeatureInfo字典中的offset连续，N:M添加时，offset不为0会报错。
- 非线程安全，N:M场景不允许多线程同时添加\检索\删除。
- 调用本接口，内部会默认创建一个Stream，用于接口内任务同步执行，在接口执行完成后，该Stream资源会被自动释放。
  受硬件限制，Stream总数有限，请参见函数：create_stream(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0079.html)处的说明。


#### 资源参考

接口调用流程及示例代码，参见特征向量检索(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/aclpythondevg_0079.html)。
