| Files | Last commit | Last update |
|---|---|---|
master分支alcnn文档英文合入 Co-authored-by: y60124828<yanglou1@h-partners.com> # message auto-generated for no-merge-commit merge: !13019 merge master into master master分支alcnn文档英文合入 Created-by: yanglu-1 Commit-by: y60124828 Merged-by: cann-robot Description: ## 描述 master分支alcnn文档英文合入 ## 关联的Issue 关联Issue [#6089](https://gitcode.com/cann/ops-nn/issues/6089) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!13019 | 23 days ago | |
fix: 修复7个算子文档示例代码静态检查问题 Co-authored-by: shilulu<shilulu8@huawei.com> # message auto-generated for no-merge-commit merge: !10472 merge clean_code into master fix: 修复7个算子文档示例代码静态检查问题 Created-by: shilulu Commit-by: shilulu Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> fix: 修复7个算子文档示例代码静态检查问题 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/ops-nn/issues/5901 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 更新了: aclnnHardsigmoid&aclnnInplaceHardsigmoid.md aclnnLogSoftmax.md aclnnSeluBackward.md aclnnSigmoid&aclnnInplaceSigmoid.md(activation) aclnnSigmoid&aclnnInplaceSigmoid.md(experimental) aclnnSwiGluGrad.md aclnnGroupNormSilu.md aclnnGroupNormSiluV2.md ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!10472 | 2 months ago | |
refactor: NpuArch整改——activation类39算子注册迁移AddConfigByArch,CMake arch折叠,op_api枚举统一 Co-authored-by: ywx1080114<yuanbin22@huawei.com> # message auto-generated for no-merge-commit merge: !11992 merge npuarch-migration into master refactor: NpuArch整改——activation类39算子注册迁移AddConfigByArch,CMake arch折叠,op_api枚举统一 Created-by: yuanbin_22 Commit-by: ywx1080114 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 基础与扩展算子 NpuArch 整改第一批(activation 39 个),共 107 个文件(+306 -268): **1. 注册面迁移(39 个 activation 类 _def.cpp):** - 算子注册从 this->AICore().AddConfig("ascend950"/"ascend350"/"ascend960dt"/"ascend960pr", aicoreConfig) 迁移为 **opbase::ArchConfigHelper::AddConfigByArch(this->AICore(), Ops::Base::DAV_3510/DAV_9201/DAV_9202, aicoreConfig)**(include op_common/op_host/util/op_arch_helper.h); - 147 处旧 AddConfig 收敛为 108 处 AddConfigByArch:**Ascend950/Ascend350 折叠到 DAV_3510**(同 arch 共享一份注册),960dt=DAV_9201、960pr=DAV_9202 保留显式注册; - 涉及算子(39 个):elu、elu_grad、elu_grad_v2、erfinv、fast_gelu、fast_gelu_grad、ge_glu_grad_v2、ge_glu_v2、gelu、gelu_grad、gelu_grad_v2、gelu_quant、gelu_v2、glu_grad、hardtanh_grad、leaky_relu、leaky_relu_grad、log_sigmoid、logsigmoid_grad、mish、mish_grad、p_relu、p_relu_grad_reduce、p_relu_grad_update、relu、relu_grad、relu_grad_v2、relu_v2、sigmoid、sigmoid_grad、silu_grad、softmax_grad_ext、softplus、swi_glu_grad、swish、swish_grad、threshold、threshold_grad_v2、threshold_grad_v2_d。 **2. CMake arch 折叠同步(35 个 CMakeLists.txt):** - SUPPORT_COMPUTE_UNIT 由 soc 名折叠为 arch 名(ascend950/ascend350 → dav_3510,ascend960dt → dav_9201,ascend960pr → dav_9202),保留各算子原有其他 soc(mc62 等);SUPPORT_TILING_DIR 相应调整。 **3. op_api / op_host tiling 枚举统一(33 个文件,低风险面):** - 运行时 NpuArch::DAV_* 判断统一替换为 Ops::Base::DAV_*(约 51 处,include op_common/op_host/util/op_const_def.h,枚举同值纯改名),分支逻辑与 dtype 支持列表不变。 **三批拆分说明:** activation 批 39 个(本 PR)、quant/index 批 26 个(!14673)、长尾批 43 个(!14522)。拆分依据:Compile_single 逐算子串行构建实测 49 算子 57.0min(70s/算子,上限 3600s),65 算子合并必超时。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> - 关联 Issue #9085 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> - 注册迁移为等价替换(AddConfigByArch(DAV_3510) 展开覆盖 950/350 两个 soc,9201/9202 显式注册不变),编译期配置产物一致; - op_api/tiling 侧仅枚举命名空间统一(NpuArch::DAV_* → Ops::Base::DAV_*,枚举同值),分支逻辑不变; - 本地构建回归通过;CI compile 待触发。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> - 无需文档更新。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述:重构(注册面/平台判断统一) ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!11992 | 3 days ago | |
feat: Infershape整改,30个算子InferDataType注册迁移至op_graph目录(IMPL_OP独立链)及UT看护 Co-authored-by: ywx1080114<yuanbin22@huawei.com> # message auto-generated for no-merge-commit merge: !11929 merge infershape-dtype into master feat: Infershape整改,30个算子InferDataType注册迁移至op_graph目录(IMPL_OP独立链)及UT看护 Created-by: yuanbin_22 Commit-by: ywx1080114 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 作为 Infershape 整改的一部分,为 30 个算子在 op_graph/ 目录新增 InferDataType(输出数据类型推导)独立注册及 UT 看护,共 103 个文件(+2848 -1),对齐仓内方案(threshold 样板): **注册方案(IMPL_OP 独立链):** - 每个算子新增 op_graph/<op>_graph_infer.cpp,通过 IMPL_OP(X).InferDataType(InferDataTypeX) 独立注册链注册,与 op_host 的 IMPL_OP_INFERSHAPE(InferShape)链解耦; - 13 个原本无 op_graph/ 目录的算子(erfinv、fast_gelu、fast_gelu_grad、hardtanh_grad、leaky_relu、leaky_relu_grad、log_sigmoid、p_relu、sigmoid_grad、softplus、swish、swish_grad、quant_update_scatter)配套新增 op_graph/CMakeLists.txt(add_graph_plugin_sources()); - 涉及 30 个算子:elu、elu_grad、elu_grad_v2、erfinv、fast_gelu、fast_gelu_grad、ge_glu_v2、gelu、gelu_grad、gelu_grad_v2、gelu_v2、glu_grad、hardtanh_grad、leaky_relu、leaky_relu_grad、log_sigmoid、logsigmoid_grad、mish、mish_grad、p_relu、relu、relu_grad、relu_grad_v2、sigmoid、sigmoid_grad、softplus、swish、swish_grad、ge_glu_grad_v2 及 quant_update_scatter; **实现分类:** - 27 个算子输出 dtype 与第一个输入一致(SetOutputDataType(0, GetInputDataType(0)),含 QuantUpdateScatter); - 3 个梯度类算子按各自契约推导: - GeGluGradV2:输出 dx 随输入 x(输入1); - GeluGradV2:dy 与 x dtype 一致时输出随 x,不一致(混合 dtype)时输出 FLOAT(与 aclnn 层 isMixDataType 契约一致); - GLUGrad:输出 out 随输入 self(输入1)。 **UT 看护(30 个测试文件,30 个参数化用例):** - 每算子新增 tests/ut/op_graph/test_<op>_graph_infer_pass.cpp,直接调用导出的 ops::InferDataTypeX 函数,通过 OpInferDataTypeContextBuilder 构造上下文,参数化覆盖 DT_BF16/DT_FLOAT16/DT_FLOAT(GeluGradV2 等梯度类覆盖混合 dtype 组合),断言推导返回 GRAPH_SUCCESS 且输出 dtype 符合预期; - 29 个算子配套新增 tests/ut/op_graph/CMakeLists.txt 纳入构建(gelu_v2 沿用既有收集机制,无需新增)。 **顺带修正:** - activation/elu/CMakeLists.txt:DEPENDENCIES 由 threshold 修正为 threshold_v2。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> - 关联 Issue #7149 ## 补充说明(冒烟依赖修正) - activation/elu/CMakeLists.txt 的 DEPENDENCIES 由 threshold 改为 threshold_v2:上游 c105aafb0([Threshold] 算子质量加固)将 threshold 的 op_api 整体迁移至 threshold_v2/op_api/,threshold 本体不再提供 l0op::Threshold 符号,但漏改 elu 的依赖声明,导致 elu 单算子包示例链接失败(undefined reference to l0op::Threshold,即此前 PreSmoke_A2 失败根因,非本 PR 引入)。实测改后包内 U 引用消除,aclnn_threshold.h 与 ThresholdV2 kernel 均随包。 - UT 按真实契约对齐:GeGluV2 双输出断言;relu_grad_v2/quant_update_scatter 等多输入算子补混合 dtype 参数化;GeluGrad/SigmoidGrad/HardtanhGrad 按 def 签名补多输入(IONum 3/2/2)。 ## 测试 <!--描述进行了哪些测试来验证你的改动。--> - 30 个算子各新增 InferDataTypeTest 参数化 UT 用例(直接函数调用),全部通过; - 用例逐一断言 InferDataTypeX 返回 GRAPH_SUCCESS 且输出 dtype 符合预期(27 个等于第一个输入、3 个梯度类按各自契约),覆盖各算子支持的输入 dtype 集合。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> - 无需文档更新。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [x] AI辅助编写 See merge request: cann/ops-nn!11929 | 18 days ago | |
refactor: NpuArch整改——activation类39算子注册迁移AddConfigByArch,CMake arch折叠,op_api枚举统一 Co-authored-by: ywx1080114<yuanbin22@huawei.com> # message auto-generated for no-merge-commit merge: !11992 merge npuarch-migration into master refactor: NpuArch整改——activation类39算子注册迁移AddConfigByArch,CMake arch折叠,op_api枚举统一 Created-by: yuanbin_22 Commit-by: ywx1080114 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 基础与扩展算子 NpuArch 整改第一批(activation 39 个),共 107 个文件(+306 -268): **1. 注册面迁移(39 个 activation 类 _def.cpp):** - 算子注册从 this->AICore().AddConfig("ascend950"/"ascend350"/"ascend960dt"/"ascend960pr", aicoreConfig) 迁移为 **opbase::ArchConfigHelper::AddConfigByArch(this->AICore(), Ops::Base::DAV_3510/DAV_9201/DAV_9202, aicoreConfig)**(include op_common/op_host/util/op_arch_helper.h); - 147 处旧 AddConfig 收敛为 108 处 AddConfigByArch:**Ascend950/Ascend350 折叠到 DAV_3510**(同 arch 共享一份注册),960dt=DAV_9201、960pr=DAV_9202 保留显式注册; - 涉及算子(39 个):elu、elu_grad、elu_grad_v2、erfinv、fast_gelu、fast_gelu_grad、ge_glu_grad_v2、ge_glu_v2、gelu、gelu_grad、gelu_grad_v2、gelu_quant、gelu_v2、glu_grad、hardtanh_grad、leaky_relu、leaky_relu_grad、log_sigmoid、logsigmoid_grad、mish、mish_grad、p_relu、p_relu_grad_reduce、p_relu_grad_update、relu、relu_grad、relu_grad_v2、relu_v2、sigmoid、sigmoid_grad、silu_grad、softmax_grad_ext、softplus、swi_glu_grad、swish、swish_grad、threshold、threshold_grad_v2、threshold_grad_v2_d。 **2. CMake arch 折叠同步(35 个 CMakeLists.txt):** - SUPPORT_COMPUTE_UNIT 由 soc 名折叠为 arch 名(ascend950/ascend350 → dav_3510,ascend960dt → dav_9201,ascend960pr → dav_9202),保留各算子原有其他 soc(mc62 等);SUPPORT_TILING_DIR 相应调整。 **3. op_api / op_host tiling 枚举统一(33 个文件,低风险面):** - 运行时 NpuArch::DAV_* 判断统一替换为 Ops::Base::DAV_*(约 51 处,include op_common/op_host/util/op_const_def.h,枚举同值纯改名),分支逻辑与 dtype 支持列表不变。 **三批拆分说明:** activation 批 39 个(本 PR)、quant/index 批 26 个(!14673)、长尾批 43 个(!14522)。拆分依据:Compile_single 逐算子串行构建实测 49 算子 57.0min(70s/算子,上限 3600s),65 算子合并必超时。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> - 关联 Issue #9085 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> - 注册迁移为等价替换(AddConfigByArch(DAV_3510) 展开覆盖 950/350 两个 soc,9201/9202 显式注册不变),编译期配置产物一致; - op_api/tiling 侧仅枚举命名空间统一(NpuArch::DAV_* → Ops::Base::DAV_*,枚举同值),分支逻辑不变; - 本地构建回归通过;CI compile 待触发。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> - 无需文档更新。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述:重构(注册面/平台判断统一) ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!11992 | 3 days ago | |
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 | 2 months ago | |
test: 恢复被注释的UT断言与用例(Issue #7688责任田,13文件58处) Co-authored-by: ywx1080114<yuanbin22@huawei.com> # message auto-generated for no-merge-commit merge: !14375 merge fix-commented-assertions into master test: 恢复被注释的UT断言与用例(Issue #7688责任田,13文件58处) Created-by: yuanbin_22 Commit-by: ywx1080114 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 恢复 Issue #7688 责任田内被注释的 UT 断言与测试用例,共 13 个文件(+175 -166),恢复断言/校验 58 处: **恢复被注释的断言(12 个文件,49 处):** | 文件 | 恢复数 | |------|--------| | quant/dynamic_quant_v2/tests/ut/op_host/test_dynamic_quant_v2_tiling.cpp | 18 | | quant/ascend_quant_v2/tests/ut/op_api/test_aclnn_ascend_quant.cpp | 7 | | quant/ascend_anti_quant_v2/tests/ut/op_host/op_api/test_aclnn_ascend_anti_quant.cpp | 5 | | activation/ge_glu_grad_v2/tests/ut/op_host/op_api/test_aclnn_geglu_backward.cpp | 4 | | activation/sigmoid/tests/ut/op_host/arch35/test_sigmoid_tiling.cpp | 3 | | activation/silu_grad/tests/ut/op_api/test_aclnn_silu_backward.cpp | 3 | | activation/ge_glu_v2/tests/ut/op_host/test_aclnn_geglu.cpp | 2 | | activation/gelu_quant/tests/ut/op_host/test_gelu_quant_tiling.cpp | 2 | | quant/ascend_quant_v2/tests/ut/op_host/test_ascend_quant_v2_tiling.cpp | 2 | | activation/swish_grad/tests/ut/op_api/test_aclnn_swish_backward.cpp | 1 | | norm/deep_norm/tests/ut/op_host/test_DeepNorm_infershape.cpp | 1 | | quant/quantize/tests/ut/op_api/test_aclnn_quantize.cpp | 1 | **恢复被注释的整段测试用例:** - index/sparse_slice/tests/ut/op_host/test_sparse_slice_infershape.cpp(9 处):恢复整段被注释的 TEST_F 用例(含 InferShapeRange_success 等)。 **适配处理:** - test_sigmoid_tiling.cpp:原注释断言使用已废弃的 to_string<int64_t>(...) 接口,新增本地 TilingData2Str 辅助函数读取 tiling data,并按当前 tiling 行为修正期望值(如 15800 15480 → 15872 10944),断言恢复为 EXPECT_NE(TilingData2Str(tilingData).find(...), string::npos)。 **改动原因:** 历史整改中被注释的 UT 断言长期失去看护作用,按 Issue #7688 责任田清单批量恢复,重建 UT 对 tiling key、tiling data、输出 dtype/shape 等的校验能力。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> - 关联 Issue #7688(仅关联,合并后不自动关闭该 Issue) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> - 恢复的 58 处断言随对应 UT 套件执行通过(tiling key、tiling data、infershape、aclnn 输出校验等)。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> - 无需文档更新。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:测试(恢复被注释的UT断言) ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [x] AI辅助编写 See merge request: cann/ops-nn!14375 | 5 days ago | |
refactor: NpuArch整改——activation类39算子注册迁移AddConfigByArch,CMake arch折叠,op_api枚举统一 Co-authored-by: ywx1080114<yuanbin22@huawei.com> # message auto-generated for no-merge-commit merge: !11992 merge npuarch-migration into master refactor: NpuArch整改——activation类39算子注册迁移AddConfigByArch,CMake arch折叠,op_api枚举统一 Created-by: yuanbin_22 Commit-by: ywx1080114 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 基础与扩展算子 NpuArch 整改第一批(activation 39 个),共 107 个文件(+306 -268): **1. 注册面迁移(39 个 activation 类 _def.cpp):** - 算子注册从 this->AICore().AddConfig("ascend950"/"ascend350"/"ascend960dt"/"ascend960pr", aicoreConfig) 迁移为 **opbase::ArchConfigHelper::AddConfigByArch(this->AICore(), Ops::Base::DAV_3510/DAV_9201/DAV_9202, aicoreConfig)**(include op_common/op_host/util/op_arch_helper.h); - 147 处旧 AddConfig 收敛为 108 处 AddConfigByArch:**Ascend950/Ascend350 折叠到 DAV_3510**(同 arch 共享一份注册),960dt=DAV_9201、960pr=DAV_9202 保留显式注册; - 涉及算子(39 个):elu、elu_grad、elu_grad_v2、erfinv、fast_gelu、fast_gelu_grad、ge_glu_grad_v2、ge_glu_v2、gelu、gelu_grad、gelu_grad_v2、gelu_quant、gelu_v2、glu_grad、hardtanh_grad、leaky_relu、leaky_relu_grad、log_sigmoid、logsigmoid_grad、mish、mish_grad、p_relu、p_relu_grad_reduce、p_relu_grad_update、relu、relu_grad、relu_grad_v2、relu_v2、sigmoid、sigmoid_grad、silu_grad、softmax_grad_ext、softplus、swi_glu_grad、swish、swish_grad、threshold、threshold_grad_v2、threshold_grad_v2_d。 **2. CMake arch 折叠同步(35 个 CMakeLists.txt):** - SUPPORT_COMPUTE_UNIT 由 soc 名折叠为 arch 名(ascend950/ascend350 → dav_3510,ascend960dt → dav_9201,ascend960pr → dav_9202),保留各算子原有其他 soc(mc62 等);SUPPORT_TILING_DIR 相应调整。 **3. op_api / op_host tiling 枚举统一(33 个文件,低风险面):** - 运行时 NpuArch::DAV_* 判断统一替换为 Ops::Base::DAV_*(约 51 处,include op_common/op_host/util/op_const_def.h,枚举同值纯改名),分支逻辑与 dtype 支持列表不变。 **三批拆分说明:** activation 批 39 个(本 PR)、quant/index 批 26 个(!14673)、长尾批 43 个(!14522)。拆分依据:Compile_single 逐算子串行构建实测 49 算子 57.0min(70s/算子,上限 3600s),65 算子合并必超时。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> - 关联 Issue #9085 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> - 注册迁移为等价替换(AddConfigByArch(DAV_3510) 展开覆盖 950/350 两个 soc,9201/9202 显式注册不变),编译期配置产物一致; - op_api/tiling 侧仅枚举命名空间统一(NpuArch::DAV_* → Ops::Base::DAV_*,枚举同值),分支逻辑不变; - 本地构建回归通过;CI compile 待触发。 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> - 无需文档更新。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述:重构(注册面/平台判断统一) ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!11992 | 3 days 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 |
SwishGrad
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: the backpropagation of the Swish activation function, used to compute the gradient of the Swish activation function.
-
Formula:
- Formula of the Swish function
s(x)=x∗σ(βx)s(x) = x*\sigma(\beta x) s(x)=x∗σ(βx)
- Derivative implementation of the Swish function formula
s′(x)=βs(x)+σ(βx)(1−βs(x))=σ(βx)∗(1+βx(1−σ(βx))) s^\prime(x)= \beta s(x)+\sigma(\beta x)(1-\beta s(x))= \sigma(\beta x)*(1+\beta x(1-\sigma(\beta x))) s′(x)=βs(x)+σ(βx)(1−βs(x))=σ(βx)∗(1+βx(1−σ(βx)))
gradInput=gradOutput∗s′(x)gradInput = gradOutput * s^\prime(x) gradInput=gradOutput∗s′(x)
σ(x)=11+e−x\sigma(x) = {\frac{1} {1+{e}^{-x}}} σ(x)=1+e−x1
Here σ(x)\sigma(x)σ(x) is the Sigmoid function, s(x)s(x)s(x) is the Swish function, and s′(x)s^\prime(x)s′(x) is the derivative of the Swish function.
Parameters
| Parameter name | Input/Output/Attribute | Description | Data type | Data format |
|---|---|---|---|---|
| grad | Input | Denotes the gradient of the forward output of the Swish activation function, gradOutput in the formula. | BFLOAT16, FLOAT16, FLOAT | ND |
| x | Input | Denotes the tensor used to compute the activation function, x in the formula. | BFLOAT16, FLOAT16, FLOAT | ND |
| y | Input | Denotes the forward output result of the Swish activation function, σ(x) in the formula. | BFLOAT16, FLOAT16, FLOAT | ND |
| grad_x | Output | Denotes the gradient value of the Swish forward input, that is, the result after differentiating the input. | BFLOAT16, FLOAT16, FLOAT | ND |
| scale | Optional attribute | Denotes an adjustable parameter, a scalar used to control the shape and slope of the Swish function, β in the formula. | FLOAT32 | - |
Constraints
None
Invocation Description
| Invocation method | Sample code | Description |
|---|---|---|
| aclnn interface | test_aclnn_swish_grad | Calls the SwishGrad operator through the aclnnSwishBackward interface. |
| Graph mode | - | Calls the SwishGrad operator by building a graph through operator IR. |