| Files | Last commit | Last update |
|---|---|---|
修正 Celu ACLNN 输出 dtype 文档遗漏 Co-authored-by: KaranocaVe<karanocave@qq.com> # message auto-generated for no-merge-commit merge: !14000 merge fix/2026-10-17-ops-nn-round240-api-contract-scan-01 into master 修正 Celu ACLNN 输出 dtype 文档遗漏 Created-by: KaranocaVe Commit-by: KaranocaVe Merged-by: cann-robot Description: ## 问题 aclnnCeluGetWorkspaceSize 文档称 out 的 dtype 可以是 self 可转换到的类型,但参数表仅列 FLOAT、FLOAT16 和 BFLOAT16。同一接口的类型校验按输入到输出的转换关系检查,现有 API UT 还覆盖 FLOAT 输入配 COMPLEX64 输出并期望接口校验成功。该遗漏会使调用者误以为 COMPLEX64 输出不受支持。 ## 修改 在 ACLNN Celu 中文 API 文档 out 参数的 dtype 列补充 COMPLEX64,使枚举与文档约束和现有 API 用例一致。补丁不修改计算实现、类型转换规则或测试代码。 关联 Issue: https://gitcode.com/cann/ops-nn/issues/8438 See merge request: cann/ops-nn!14000 | 5 days ago | |
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 | 4 months ago | |
算子插件迁移 Co-authored-by: welt_lester<songlizhe1@h-partners.com> Co-authored-by: x00842564<xuyanke@huawei.com> # message auto-generated for no-merge-commit merge: !8474 merge master into master 算子插件迁移 Created-by: welt_lester Commit-by: x00842564;welt_lester Merged-by: cann-robot Description: ## 描述 落实issue #4279,将adaptive_avg_pool2d、adaptive_max_pool2d、ascend_anti_quant、ascend_dequant、ascend_quant、batch_mat_mul_v3、batch_norm、celu_v2、instance_norm_v3、ascend_quant、log_softmax_v2、mat_mul_v3、unique_with_counts_and_sorting这13个算子对应的插件从common\src\framework迁出到各自算子目录新建的\framework目录下。 ## 关联的Issue [Bug-Report|缺陷反馈]: 有对应算子的插件不应该放到公共目录 [#4279](https://gitcode.com/cann/ops-nn/issues/4279) ## 测试 compile、本地验证build通过 ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码重构(算子插件归属迁移,落实 #4279 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!8474 | 3 months ago | |
fix(e9): 基础激活与Logit算子内部错误码整改为注册错误码 Co-authored-by: luoyufan7<luoyufan7@h-partners.com> # message auto-generated for no-merge-commit merge: !12775 merge fix/e9-errcode-basic-activation-logit into master fix(e9): 基础激活与Logit算子内部错误码整改为注册错误码 Created-by: luoyufan7 Commit-by: luoyufan7 Merged-by: cann-robot Description: ## 描述 基础激活与 Logit 系列算子中已登记的参数/元数据校验失败落入通用内部错误码(EZ9999 等),上报为自由文本,无法归类定位;部分 API 包装层还会重复报告已存在的底层错误,覆盖首报。 整改方法(对应 #7371 设计方案): - 保留原有判定条件、返回状态与资源清理逻辑,仅替换错误上报方式; - 空指针/参数类失败携带注册参数名(input_x、y 等)映射参数错误码(EZ0004 等); - 框架对象/推导阶段失败携带 opName/reason 上报(EZ1014 等); - 包装层在底层已上报正式码时改用 OP_LOGE_WITHOUT_REPORT,不再覆盖首报。 本 PR 覆盖 40 个生产文件(celu_v2、elu、erfinv、fast_gelu、gelu_v2/grad、hard_shrink/sigmoid/swish、leaky_relu、log_sigmoid、logit/logit_grad 等),对应最终表登记点 65 个。 开发基于冻结基线 ec2a78c2,已 rebase 至当前 master 并与期间上游改动合并(如 relu_v2 平台列表扩展、hard_sigmoid unknown-rank 支持均保留上游行为)。 ## 关联的Issue - Refs #7371(本系列共 4 个 PR,本 PR 为第 1 批) ## 测试 A2 / CANN 9.2.0 上对组合工作区(本系列 4 组生产代码合并态、冻结基线 ec2a78c2)完成验证:910B Host UT 144/144、API UT 19/19、950 SituMxQuant Host/InferShape UT 6/6 共 169 个定向用例通过,Host/API 包构建通过。该结果来自组合工作区且基于冻结基线,rebase 至 master 后未单独重跑,以 CI 流水线为准。未执行 Kernel 数值/设备验证。 ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [x] AI辅助编写 See merge request: cann/ops-nn!12775 | 24 days ago | |
修正 CeluV2 Proto 注释遗漏 BF16 输入类型 Co-authored-by: KaranocaVe<karanocave@qq.com> # message auto-generated for no-merge-commit merge: !12208 merge fix/2026-10-16-celu-v2-proto-bf16-doc into master 修正 CeluV2 Proto 注释遗漏 BF16 输入类型 Created-by: KaranocaVe Commit-by: KaranocaVe Merged-by: cann-robot Description: # 修正 CeluV2 Proto 注释遗漏 BF16 输入类型 CeluV2 的 x 输入在 Proto 注释中只列出 float16、float32,但 REG_OP 和 OpDef 均注册了 DT_BF16。这使公开接口说明与已注册类型不一致,并可能让调用方误判 BF16 不受支持。 预期是注释列出已注册支持的类型。此修复在 x 的类型说明中补充 bfloat16,不改变算子注册或执行行为。 静态核对 Proto、OpDef、tiling 和 README 后确认均已声明 BF16,修正后的注释与注册类型一致。 ## 验证 - 静态核对确认 Proto 注释、注册定义和 OpDef 均包含 BF16;修复后输入类型说明与注册集合一致。 关联 Issue: https://gitcode.com/cann/ops-nn/issues/6840 See merge request: cann/ops-nn!12208 | 1 month ago | |
fix(e9): 基础激活与Logit算子内部错误码整改为注册错误码 Co-authored-by: luoyufan7<luoyufan7@h-partners.com> # message auto-generated for no-merge-commit merge: !12775 merge fix/e9-errcode-basic-activation-logit into master fix(e9): 基础激活与Logit算子内部错误码整改为注册错误码 Created-by: luoyufan7 Commit-by: luoyufan7 Merged-by: cann-robot Description: ## 描述 基础激活与 Logit 系列算子中已登记的参数/元数据校验失败落入通用内部错误码(EZ9999 等),上报为自由文本,无法归类定位;部分 API 包装层还会重复报告已存在的底层错误,覆盖首报。 整改方法(对应 #7371 设计方案): - 保留原有判定条件、返回状态与资源清理逻辑,仅替换错误上报方式; - 空指针/参数类失败携带注册参数名(input_x、y 等)映射参数错误码(EZ0004 等); - 框架对象/推导阶段失败携带 opName/reason 上报(EZ1014 等); - 包装层在底层已上报正式码时改用 OP_LOGE_WITHOUT_REPORT,不再覆盖首报。 本 PR 覆盖 40 个生产文件(celu_v2、elu、erfinv、fast_gelu、gelu_v2/grad、hard_shrink/sigmoid/swish、leaky_relu、log_sigmoid、logit/logit_grad 等),对应最终表登记点 65 个。 开发基于冻结基线 ec2a78c2,已 rebase 至当前 master 并与期间上游改动合并(如 relu_v2 平台列表扩展、hard_sigmoid unknown-rank 支持均保留上游行为)。 ## 关联的Issue - Refs #7371(本系列共 4 个 PR,本 PR 为第 1 批) ## 测试 A2 / CANN 9.2.0 上对组合工作区(本系列 4 组生产代码合并态、冻结基线 ec2a78c2)完成验证:910B Host UT 144/144、API UT 19/19、950 SituMxQuant Host/InferShape UT 6/6 共 169 个定向用例通过,Host/API 包构建通过。该结果来自组合工作区且基于冻结基线,rebase 至 master 后未单独重跑,以 CI 流水线为准。未执行 Kernel 数值/设备验证。 ## 文档更新 无 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [x] AI辅助编写 See merge request: cann/ops-nn!12775 | 24 days ago | |
celuV2算子精度修改 Co-authored-by: gcw_YBIAEfqJ<wangweidong15@huawei.com> # message auto-generated for no-merge-commit merge: !7130 merge celu_v2_precision_fix into master celuV2算子精度修改 Created-by: gcw_YBIAEfqJ Commit-by: gcw_YBIAEfqJ Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 数值稳定的 CeluV2 负分支 expm1 实现(Kahan 恒等式 + |u| 双重 guard),修复 v1 在小 alpha 尾部 e 溢出导致 NaN/-0 污染正分支的精度问题。附带:Compute 拆分为可读子阶段;tiling UB 逻辑缓冲数以具名常量表达(消除魔鬼数字)。逻辑已真调 NPU 验收。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/ops-nn/issues/3900 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!7130 | 4 months ago | |
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 | 4 months ago | |
[CANNBOT]celu_v2 和 fast_gelu_v2 算子适配Ascend950 Ascendc实现 Co-authored-by: gcw_YBIAEfqJ<wangweidong15@huawei.com> # message auto-generated for no-merge-commit merge: !5149 merge 0520 into master [CANNBOT]celu_v2 和 fast_gelu_v2 算子适配Ascend950 Ascendc实现 Created-by: gcw_YBIAEfqJ Commit-by: gcw_YBIAEfqJ Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> CeluV2 $$ CELU(x) = \max(0, x) + \min(0, \alpha \cdot (\exp(x / \alpha) - 1)) $$ - x: 输入张量 - alpha: 激活系数,默认1.0,不能为0 - 当 x ≥ 0 时输出 x;当 x < 0 时输出 α·(exp(x/α) - 1),趋近于 -α --- FastGeluV2 $$ FastGeluV2(x) = x \cdot \left( sgn(x) \cdot \left[ -0.1444 \cdot \left( \text{clip}(|0.7071 \cdot x|, \max=1.769) - 1.769 \right)^2 + 0.5 \right] + 0.5 \right) $$ 其中: $$ sgn(x) = \frac{x + 10^{-12}}{|x + 10^{-12}|} $$ - x: 输入张量 - 通过分段多项式逼近标准 GeLU,避免 exp/erf 调用 - clip 将 |0.7071·x| 限制在 [0, 1.769] 范围内,超出后输出趋于线性 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/ops-nn/issues/2561 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> CeluV2 共 165 条测试用例,汇总如下: 按数据类型 ┌──────────┬───────┐ │ 数据类型 │ 数量 │ ├──────────┼───────┤ │ fp32 │ 86 条 │ ├──────────┼───────┤ │ fp16 │ 79 条 │ └──────────┴───────┘ 按测试类别 ┌───────────┬───────┬─────────────────────────────────────────────────────────────────────────────┐ │ 类别 │ 数量 │ 说明 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ alpha变参 │ 67 条 │ alpha=0.1/0.5/2.0/10/100/1000/-0.5/-1/-2/-0.001/1e-6 等,覆盖正负、极大极小 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 边界对齐 │ 28 条 │ shape=15/16/31/32/33/63/64/65/127/128/129/255/256/257,测试 block 对齐边界 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 基础shape │ 25 条 │ 1D~8D 标准 shape,alpha=1.0 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 非对齐 │ 16 条 │ shape=3/5/13/17/37/97/500/1000,非2的幂次 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 大shape │ 7 条 │ 500K/1M/100x100x100 等大张量 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 标量shape │ 6 条 │ shape=1/2/7 的极小张量 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 奇异shape │ 6 条 │ 1x1/1x1x1/1x1x1x1 等全1维度 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 特殊值 │ 5 条 │ 零值输入、极大值输入、极小值输入 │ ├───────────┼───────┼─────────────────────────────────────────────────────────────────────────────┤ │ 压力测试 │ 5 条 │ 2M/5M/512x1024 等超大张量 │ └───────────┴───────┴─────────────────────────────────────────────────────────────────────────────┘ FastGeluV2 测试覆盖总结 ┌────────────┬─────────────────────────────────────────────────┐ │ 维度 │ 覆盖情况 │ ├────────────┼─────────────────────────────────────────────────┤ │ 总用例数 │ 248(TTK Kernel 直调) │ ├────────────┼─────────────────────────────────────────────────┤ │ 数据类型 │ float32, float16, bfloat16 │ ├────────────┼─────────────────────────────────────────────────┤ │ Shape 维度 │ 空张量 [0] ~ 5D,含 53 种 unique shape │ ├────────────┼─────────────────────────────────────────────────┤ │ 元素数量 │ 0 ~ 50,000,000(五千万) │ └────────────┴─────────────────────────────────────────────────┘ 数据值域: ┌─────────────────────────────────────────┬────────────────────────────────────┐ │ 区间 │ 说明 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [-0.01, 0.01] / [-0.001, 0.001] │ 极小值,近零区域 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [-0.1, 0.1] │ 小值区域 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [-1.0, 1.0] │ clip 阈值内(0.7071*x < 1.769) │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [-3.0, 3.0] / [-5.0, 5.0] │ 标准范围(主测试区间) │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [-10.0, 0.0] / [0.0, 10.0] │ 单侧值域(全负/全正) │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [0.5, 5.0] / [1.0, 100.0] │ 正值偏移/大正值 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ [-50.0, 50.0] / [-100.0, 100.0] │ 宽范围(clip 饱和区) │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ (3.4e+37, 3.4e+38) / (-3.4e+38, -3.4e+37) │ fp32 极大/极小值 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ (6.0e+4, 6.55e+4) / (-6.55e+4, -6.0e+4) │ fp16 极大/极小值 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ (3.3e+37, 3.39e+38) / (-3.39e+38, -3.3e+37) │ bf16 极大/极小值 │ ├─────────────────────────────────────────┼────────────────────────────────────┤ │ denormal: 1e-40~1e-38(fp32), │ 次正规数 │ │ 5.96e-8~6.1e-5(fp16), 9.2e-41~1.17e-38(bf16) │ │ └─────────────────────────────────────────┴────────────────────────────────────┘ 测试场景: - 空张量 [0] → 空输出(fp32/fp16/bf16 各 1 条) - 单元素 [1] / [1,1] → 最小有效输入 - 对齐 shape(8 的倍数)→ 无 padding 路径 - 非对齐 shape(4,7,13,15,31,127,255,1023)→ tail 处理路径 - 多维 2D~5D → 高维张量展平处理 - 大规模 5000×10000 / 50000000 → 多核并行 + 内存压力 - 极大值(接近 dtype max)→ 溢出/饱和行为 - 极小值(接近 dtype min)→ 溢出/饱和行为 - 次正规数(denormal)→ 精度下限行为 - 11 种数据分布 × 3 种 dtype 交叉覆盖 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-nn!5149 | 5 months ago | |
修改产品名 Co-authored-by: fwx1169505<fengying27@h-partners.com> # message auto-generated for no-merge-commit merge: !11017 merge master into master 修改产品名 Created-by: fengying555682 Commit-by: fwx1169505 Merged-by: cann-robot Description: ## 描述 修改quant和activation文件夹中的md文档涉及的产品名称 ## 关联的Issue [#6056](https://gitcode.com/cann/ops-nn/issues/6056) ## 测试 已经完成文档语法和链接一致性检测 ## 文档更新 quant和activation文件夹中的md文档 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!11017 | 1 month ago | |
docs: add English translations for operator READMEs and repo docs Co-authored-by: jenny_xiang<jenny.xiang@huawei.com> # message auto-generated for no-merge-commit merge: !13351 merge docs/add-english-docs into master docs: add English translations for operator READMEs and repo docs Created-by: jenny_xiang Commit-by: jenny_xiang Merged-by: cann-robot Description: ## Description Add English translations for 652 markdown documents: - Repo-level guides: README_en.md, CONTRIBUTING_en.md, SECURITY_en.md, CHANGELOG_en.md, codearts_check_rule_config_en.md - Operator READMEs under activation/, conv/, control/, foreach/, hash/, index/, loss/, matmul/, norm/, optim/, pooling/, quant/, rnn/, vfusion/, etc. - API and design docs under docs/ (aclnn_*, ascendir_*, fusion pass docs) - examples/ and torch_extension/ guides Note: a few cross-reference links whose English targets are not published yet temporarily point to their Chinese counterparts to keep links valid; they will be switched back to the English docs in a follow-up PR after this one is merged. ## Related Issue N/A ## Test - Verified all 1,344 intra-repo markdown links in the added files resolve against master: 0 broken links, 0 missing targets. ## Documentation Update - This PR only adds English documentation files (*_en.md); no existing Chinese documents are modified. ## Type Labels - [ ] Bug fix - [ ] New feature - [ ] Performance optimization - [x] Documentation update - [ ] Other, please describe: ## AI/Agent-Generated Declaration - [x] AI-assisted authoring See merge request: cann/ops-nn!13351 | 17 days ago |
CeluV2
English | 简体中文
Applicable Products
| Product | Support |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | √ |
| Atlas inference products | √ |
| Atlas training products | √ |
Function
- Operator function: Activation function Celu (Continuously Differentiable Exponential Linear Units).
- Formula:
CELU(x)=max(0,x)+min(0,α∗(exp(x/α)−1))CELU(x) = \max(0,x) + \min(0, \alpha \ast (\exp(x/\alpha) - 1)) CELU(x)=max(0,x)+min(0,α∗(exp(x/α)−1))
where:
-
x: Input tensor
-
alpha: Activation coefficient in the CELU formula, with the default value 1.0
Parameters
| Parameter name | Input/Output | Description | Data type | Data format |
|---|---|---|---|---|
| x | Input | 'x' in the formula, the input tensor of the CELU activation function. Empty tensors are supported, non-contiguous tensors are supported, and 0 to 8 dimensions are supported. | FLOAT16, FLOAT32, DT_BF16 | ND |
| alpha | Attribute | Activation coefficient in the CELU formula, with the default value 1.0, and it cannot be 0. | FLOAT | - |
| y | Output | Output tensor of x computed by CELU, with the shape and dtype the same as the input x. Non-contiguous tensors are supported. | FLOAT16, FLOAT32, DT_BF16 | ND |
Constraints
None.
Invocation Description
| Invocation method | Sample code | Description |
|---|---|---|
| aclnn API | test_aclnn_celu.cpp | Calls the CeluV2 operator through the aclnnCelu&aclnnInplaceCelu API. |