| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat(segment_sum): 新增算子README.md及geir调用样例 Co-authored-by: zhang-wenbo-beat<zhangwenbo67@huawei.com> # message auto-generated for no-merge-commit merge: !9290 merge segment_sum_example into master feat(segment_sum): 新增算子README.md及geir调用样例 Created-by: zhang-wenbo-beat Commit-by: zhang-wenbo-beat Merged-by: cann-robot Description: ## 描述 本 PR 为 SegmentSum 算子补齐对外文档与可运行调用样例,便于用户理解算子语义并快速上手: - ** index/segment_sum/README.md**:新增算子使用文档,涵盖产品支持情况(仅 Ascend 950PR/950DT 支持)、功能说明(分段求和计算公式与示例)、参数说明(x / segment_ids / y 的数据类型与格式)、约束说明、以及调用方式索引。 - **index/segment_sum/examples/test_geir_segment_sum.cpp**:新增图模式(GEIR)调用样例,通过 ge::Session 构建并运行 SegmentSum 计算图,演示输入 x(shape {4,2},填充 2.0)与分段索引 segment_ids({0, 0, 1, 2})的构图、图编译与执行流程,并将输出落盘为 bin 文件用于验证。 改动原因:SegmentSum 算子此前缺少对外文档与可运行示例,本 PR 补齐这两部分,降低使用门槛。 ## 关联的Issue https://gitcode.com/cann/ops-nn/issues/5053 ## 测试 - **样例验证**:样例本身为图模式可运行用例,输入 x = {4,2} 全 2.0、segment_ids = {0, 0, 1, 2},按分段求和语义输出 y shape 为 {3,2}: - y[0] = x[0] + x[1] = [4, 4] - y[1] = x[2] = [2, 2] - y[2] = x[3] = [2, 2] ## 文档更新 - 新增 index/segment_sum/README.md:SegmentSum 算子说明文档。 - 新增 index/segment_sum/examples/test_geir_segment_sum.cpp:图模式调用样例。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [x] AI辅助编写 See merge request: cann/ops-nn!9290 | 26 天前 | |
TF plugin修改1 Co-authored-by: sunchun<sunchun4@h-partners.com> # message auto-generated for no-merge-commit merge: !7547 merge nn1 into master TF plugin修改1 Created-by: sunchun Commit-by: sunchun Merged-by: cann-robot Description: ## 描述 TF plugin修改 ## 关联的Issue https://gitcode.com/cann/ops-nn/issues/4196 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!7547 | 2 个月前 | |
format cpp Co-authored-by: yang-di52<yangdi52@huawei.com> # message auto-generated for no-merge-commit merge: !6784 merge issue_fix into master format cpp Created-by: yang-di52 Commit-by: yang-di52 Merged-by: cann-robot Description: ## 描述 批量刷新cpp代码格式 ## 关联的Issue [#3791](https://gitcode.com/cann/ops-nn/issues/3791) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码格式化 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!6784 | 2 个月前 | |
Feature: 为 index 和 pooling 类算子新增 Ascend350 平台支持 Co-authored-by: klein8793<zhangli24@huawei.com> # message auto-generated for no-merge-commit merge: !9754 merge dev_zl_2026_0902 into master Feature: 为 index 和 pooling 类算子新增 Ascend350 平台支持 Created-by: klein8793 Commit-by: klein8793 Merged-by: cann-robot Description: ## 描述 为 index 和 pooling 类算子新增 Ascend350 平台支持。具体变更包括: 1. **新增 Ascend350 平台配置文件**(42 个 JSON):为每个算子新增 op_host/config/ascend350/ 下的二进制配置 JSON 2. **注册 Ascend350 平台**:在各算子 _def.cpp 中添加 his->AICore().AddConfig(ascend350, aicoreConfig) 3. **更新编译配置**:修改各算子 CMakeLists.txt,添加 Ascend350 编译选项;更新 scendc_config.json 中对应算子的 compute_units 列表,将 [ascend950] 扩展为 [ascend950, ascend350] 4. **更新 Fusion Pass 平台判断**:在 bucketize_v2_fusion_pass、inplace_add_fusion_pass、gather_fusion_pass、tensor_scatter_add_fusion_pass、sorted_sparse_segment_mean_grad_fusion_pass 中将 Ascend350 加入平台白名单 涉及算子(35+): - index: bucketize_v2, concat_offset, gather_elements, gather_nd, gather_v2, index_fill, index_fill_d, index_put_v2, inplace_index_add, inplace_index_fill, linear_index_v2, masked_scatter, repeat_interleave, reverse_sequence, reverse_v2, scatter, scatter_add, scatter_add_with_sorted, scatter_elements, scatter_elements_v2, scatter_nd, scatter_nd_add, scatter_nd_max, scatter_nd_min, scatter_nd_update, scatter_sub, scatter_update, segment_sum, sorted_sparse_segment_mean_grad, sparse_segment_mean, sparse_to_dense, unsorted_segment_max, unsorted_segment_min - pooling: avg_pool, avg_pool_v2 - 公共库: scatter_nd_common, unsorted_segment_common, sort_lib ## 关联的Issue - #5651 ## 测试 obp冒烟、david冒烟已通过 ## 文档更新 NA ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!9754 | 6 天前 | |
MicroAPI namespace to Reg for arch35 kernels Co-authored-by: gcw_DS4cmz2b<1312925094@qq.com> # message auto-generated for no-merge-commit merge: !9267 merge rename into master MicroAPI namespace to Reg for arch35 kernels Created-by: gcw_DS4cmz2b Commit-by: gcw_DS4cmz2b Merged-by: cann-robot Description: ## 描述 修改了index,activation,matmul,conv,foreach,optim,experimental,vfusion,hash这几个文件夹内的命名空间,将MicroAPI-->Reg ## 关联的Issue [多个文件夹内的算子命名空间使用的MicroAPI,应改为Reg](https://gitcode.com/cann/ops-nn/issues/5218) ## 测试 验证方法 严格按四步流程,逐算子验证: 1. Step 1:编译原始代码,保存 baseline binary .o 文件 MD5 2. Step 2:执行 MicroAPI → Reg 替换 3. Step 3:编译替换后代码,保存 after binary .o 文件 MD5 4. Step 4:对比 A_before.md5 与 B_after.md5 平台:ascend950,编译参数:--soc=ascend950 --ops=<op> -j16 验证替换前后 binary 产物 MD5 完全一致。 冒烟,代码审查均通过 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!9267 | 27 天前 | |
将卷积和matmul的ut根据版本隔离开, 整改950 ophost ut Co-authored-by: 18811725231<yangdi52@huawei.com> # message auto-generated for no-merge-commit merge: !9549 merge master into master 将卷积和matmul的ut根据版本隔离开, 整改950 ophost ut Created-by: yang-di52 Commit-by: 18811725231 Merged-by: cann-robot Description: ## 描述 主要修改内容: 1. nn仓完成和legacy common 动态库解耦后,卷积和matmul的不同版本 ophost ut 已经不能混合一起跑了。需要版本隔离 2. ascend950的ut全量编译 失败,需要修改 ## 关联的Issue [https://gitcode.com/cann/ops-nn/issues/5425](https://gitcode.com/cann/ops-nn/issues/5425) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!9549 | 22 天前 | |
Feature: 为 index 和 pooling 类算子新增 Ascend350 平台支持 Co-authored-by: klein8793<zhangli24@huawei.com> # message auto-generated for no-merge-commit merge: !9754 merge dev_zl_2026_0902 into master Feature: 为 index 和 pooling 类算子新增 Ascend350 平台支持 Created-by: klein8793 Commit-by: klein8793 Merged-by: cann-robot Description: ## 描述 为 index 和 pooling 类算子新增 Ascend350 平台支持。具体变更包括: 1. **新增 Ascend350 平台配置文件**(42 个 JSON):为每个算子新增 op_host/config/ascend350/ 下的二进制配置 JSON 2. **注册 Ascend350 平台**:在各算子 _def.cpp 中添加 his->AICore().AddConfig(ascend350, aicoreConfig) 3. **更新编译配置**:修改各算子 CMakeLists.txt,添加 Ascend350 编译选项;更新 scendc_config.json 中对应算子的 compute_units 列表,将 [ascend950] 扩展为 [ascend950, ascend350] 4. **更新 Fusion Pass 平台判断**:在 bucketize_v2_fusion_pass、inplace_add_fusion_pass、gather_fusion_pass、tensor_scatter_add_fusion_pass、sorted_sparse_segment_mean_grad_fusion_pass 中将 Ascend350 加入平台白名单 涉及算子(35+): - index: bucketize_v2, concat_offset, gather_elements, gather_nd, gather_v2, index_fill, index_fill_d, index_put_v2, inplace_index_add, inplace_index_fill, linear_index_v2, masked_scatter, repeat_interleave, reverse_sequence, reverse_v2, scatter, scatter_add, scatter_add_with_sorted, scatter_elements, scatter_elements_v2, scatter_nd, scatter_nd_add, scatter_nd_max, scatter_nd_min, scatter_nd_update, scatter_sub, scatter_update, segment_sum, sorted_sparse_segment_mean_grad, sparse_segment_mean, sparse_to_dense, unsorted_segment_max, unsorted_segment_min - pooling: avg_pool, avg_pool_v2 - 公共库: scatter_nd_common, unsorted_segment_common, sort_lib ## 关联的Issue - #5651 ## 测试 obp冒烟、david冒烟已通过 ## 文档更新 NA ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!9754 | 6 天前 | |
feat(segment_sum): 新增算子README.md及geir调用样例 Co-authored-by: zhang-wenbo-beat<zhangwenbo67@huawei.com> # message auto-generated for no-merge-commit merge: !9290 merge segment_sum_example into master feat(segment_sum): 新增算子README.md及geir调用样例 Created-by: zhang-wenbo-beat Commit-by: zhang-wenbo-beat Merged-by: cann-robot Description: ## 描述 本 PR 为 SegmentSum 算子补齐对外文档与可运行调用样例,便于用户理解算子语义并快速上手: - ** index/segment_sum/README.md**:新增算子使用文档,涵盖产品支持情况(仅 Ascend 950PR/950DT 支持)、功能说明(分段求和计算公式与示例)、参数说明(x / segment_ids / y 的数据类型与格式)、约束说明、以及调用方式索引。 - **index/segment_sum/examples/test_geir_segment_sum.cpp**:新增图模式(GEIR)调用样例,通过 ge::Session 构建并运行 SegmentSum 计算图,演示输入 x(shape {4,2},填充 2.0)与分段索引 segment_ids({0, 0, 1, 2})的构图、图编译与执行流程,并将输出落盘为 bin 文件用于验证。 改动原因:SegmentSum 算子此前缺少对外文档与可运行示例,本 PR 补齐这两部分,降低使用门槛。 ## 关联的Issue https://gitcode.com/cann/ops-nn/issues/5053 ## 测试 - **样例验证**:样例本身为图模式可运行用例,输入 x = {4,2} 全 2.0、segment_ids = {0, 0, 1, 2},按分段求和语义输出 y shape 为 {3,2}: - y[0] = x[0] + x[1] = [4, 4] - y[1] = x[2] = [2, 2] - y[2] = x[3] = [2, 2] ## 文档更新 - 新增 index/segment_sum/README.md:SegmentSum 算子说明文档。 - 新增 index/segment_sum/examples/test_geir_segment_sum.cpp:图模式调用样例。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [x] AI辅助编写 See merge request: cann/ops-nn!9290 | 26 天前 |
SegmentSum
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | × |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | × |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | × |
| Atlas 训练系列产品 | × |
功能说明
-
算子功能:对输入tensor按分段索引求和。
-
计算公式:
y[i]=∑jsegment_ids[j]=ix[j]y[i] = \sum_{\substack{j\\ \text{segment\_ids}[j] = i}} x[j] y[i]=jsegment_ids[j]=i∑x[j]
其中,求和遍历所有满足
segment_ids[j] == i的索引j,将对应的x[j]累加到y[i]。若某个段i没有对应的元素,则y[i] = 0。 -
用例:
输入tensor x=[[12][34][56][78]]x = \begin{bmatrix} [1 & 2] \\ [3 & 4] \\ [5 & 6] \\ [7 & 8] \end{bmatrix}x=⎣⎢⎢⎢⎡[1[3[5[72]4]6]8]⎦⎥⎥⎥⎤, 分段索引tensor segment_ids=[0,0,1,2]segment\_ids = [0, 0, 1, 2]segment_ids=[0,0,1,2],
输出tensor y=[[46][56][78]]y = \begin{bmatrix} [4 & 6] \\ [5 & 6] \\ [7 & 8] \end{bmatrix}y=⎣⎢⎡[4[5[76]6]8]⎦⎥⎤
segment_ids必须按升序排序segment_ids为分段索引,指示当前分段的值归属于哪个段segment_ids值必须 >= 0- 输出shape为
[max(segment_ids) + 1, x.shape[1:]]
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x | 输入 | 输入数据,即公式中的 x |
FLOAT32、FLOAT16、BFLOAT16、INT32、INT64、UINT32、UINT64 | ND |
| segment_ids | 输入 | 分段索引,即公式中的 segment_ids |
INT32、INT64 | ND |
| y | 输出 | 输出值信息,即公式中的 y |
FLOAT32、FLOAT16、BFLOAT16、INT32、INT64、UINT32、UINT64 | ND |
约束说明
x:
- 维度至少 1(rank >=1)。
segment_ids:
- 必须是 INT32 或 INT64 类型。
- 必须为 1D tensor,且
segment_ids.shape[0] = x.shape[0]。 - 值必须按升序排序,且
segment_ids.value >= 0。
y:
- 类型必须与 x 相同。
- 维度与 x 相同,shape 为
[max(segment_ids) + 1, x.shape[1:]]。
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| GE图模式 | test_geir_segment_sum | 通过算子IR构图方式调用SegmentSum算子。 |