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

#### 产品支持情况

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


#### 功能说明

设置1:N场景下返回的topK结果数量的最大值，如果不设置，默认topK结果数量的最大值为4800。

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


#### 函数原型

- C函数原型
  1 aclError aclfvSet1NTopNum(aclfvInitPara *initPara, uint32_t maxTopNumFor1N)

- python函数
  1 ret = acl.fv.set_1n_top_num(init_para, max_top_num_for_1n)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| init\_para | int，指定特征向量检索的初始化参数。 需提前调用acl.fv.create\_init\_para接口创建aclfvInitPara类型的数据。 |
| max\_top\_num\_for\_1n | int，1:N场景下返回的topK结果的最大值，取值范围：[2, 4800]。 |


#### 返回值说明

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


#### 资源参考

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