| Files | Last commit | Last update |
|---|---|---|
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago | |
refactor: 将 hard_swish_grad/hard_swish_grad_v2/heaviside 的 op_api 从 op_host 迁移到算子根目录 Co-authored-by: luoyufan7<luoyufan7@h-partners.com> # message auto-generated for no-merge-commit merge: !9427 merge refactor/op-api-move-hardswish-heaviside into master refactor: 将 hard_swish_grad/hard_swish_grad_v2/heaviside 的 op_api 从 op_host 迁移到算子根目录 Created-by: luoyufan7 Commit-by: luoyufan7 Merged-by: cann-robot Description: ## 描述 将 activation/hard_swish_grad、hard_swish_grad_v2、heaviside 三个算子的 op_api 文件从 op_host 目录下迁移到算子根目录,删除 op_host/CMakeLists.txt,改为使用算子根目录的 add_modules_sources 机制。 ### 具体改动 - **hard_swish_grad**: op_host/op_api/ → op_api/,删除 op_host/CMakeLists.txt - **hard_swish_grad_v2**:op_host/op_api/ → op_api/,删除 op_host/CMakeLists.txt - **heaviside**:op_host/op_api/ → op_api/,删除 op_host/CMakeLists.txt ## 关联的Issue #5332 ## 测试 - 单算子包构建成功:bash build.sh --ops=hard_swish_grad,hard_swish_grad_v2,heaviside --soc=ascend910b --pkg - 安装后三个算子的 example 测试均运行成功(ascend910b 环境) - pre-commit 全部通过(含 OAT 合规检查) ## 文档更新 无 ## 类型标签 - [x] 重构 ## AI/Agent生成声明 - [x] AI辅助编写 See merge request: cann/ops-nn!9427 | 2 months ago | |
fix(heaviside): 补充input维度上限校验与values异常形态报错,同步README约束 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13710 merge master-fused into master fix(heaviside): 补充input维度上限校验与values异常形态报错,同步README约束 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本次提交围绕 Heaviside 算子 tiling 校验增强与三个算子的 README 约束说明对齐展开: **Heaviside tiling 校验增强(op_host/heaviside_tiling.cpp)** - 新增 MAX_INPUT_DIM_NUM = 8 上限常量,在 RunBigKernelTiling 中校验 input 维度数,超过 8 维直接返回 GRAPH_FAILED,防止 kernel 处理超出支持范围的高维输入。 - 完善 GetValuesType 异常分支日志: - values 为空 Tensor(shape size 为 0)时显式拒绝并输出错误日志(图模式不支持空 Tensor); - input/values 不满足标量或同 shape 关系时明确拒绝并输出错误日志(图模式 kernel 不做 broadcast)。 **Heaviside tiling UT 补充(tests/ut/op_host/test_heaviside_tiling.cpp)** - HeavisideTilingData_08_input_dim_over_8:9 维 input 场景 tiling 应失败; - HeavisideTilingData_09_input_0d_scalar_values:input 0 维标量 + values 标量场景 tiling 应成功。 **README 约束说明对齐** - activation/heaviside/README.md:明确 input 支持 1~8 维(values 为单元素时额外支持 0 维标量)、values 仅支持单元素或与 input 同 shape、图模式不支持一般广播及空 Tensor; - optim/fused_mul_apply_momentum_extern/README.md:修正 var/accum/var_copy 输入说明(去除 inplace 双重标注)、属性顺序调整、调用方式改为 GE图模式; - quant/fake_quant_with_min_max_args/README.md:明确 round-half-away 语义、q_offset 计算公式、min/max 有限值约束及溢出校验、调用方式改为 GE图模式。 ## 关联的Issue - #8206(https://gitcode.com/cann/ops-nn/issues/8206) ## 测试 - 新增 2 条 Heaviside tiling UT(维度超限失败、0维标量成功)通过。 - git diff --check 通过。 ## 文档更新 - 更新 activation/heaviside/README.md、optim/fused_mul_apply_momentum_extern/README.md、quant/fake_quant_with_min_max_args/README.md。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13710 | 16 days ago | |
fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Co-authored-by: tan_xin<tanxin44@huawei.com> # message auto-generated for no-merge-commit merge: !13876 merge master-fused into master fix(heaviside): 补全tiling入参/dtype校验与溢出防护,整改静态检查问题 Created-by: tan_xin Commit-by: tan_xin Merged-by: cann-robot Description: ## 描述 本条PR针对 heaviside 算子静态检查发现的问题进行修复,分为功能加固与规范整改两类: 1. 功能加固(op_host) - heaviside_tiling.cpp: - CeilA2B 改为 (a-1)/b + 1 形式,避免 a 接近 INT64_MAX 时 (a+b-1) 有符号溢出;a<=0 时直接返回 0。 - 新增 inputDesc / valuesDesc 空校验,并校验 values 与 input dtype 一致,不一致时报错返回 GRAPH_FAILED。 - 新增 input/values shape、PlatformInfo、workspace、RawTilingData 空指针校验。 - 对 GetShapeSize 返回的 INT64_MIN 无效哨兵值做溢出防护。 - 新增 coreNum 为 0 的校验。 - heaviside_infershape.cpp:InferDataType 增加 values dtype 读取与校验(input/values dtype 非 UNDEFINED 且必须一致),否则返回 GRAPH_FAILED。 2. 文档与接口注释(op_api / docs / README) - op_api/aclnn_heaviside.h:out 参数由 @param [in] 修正为 @param [out];修正 GetWorkspaceSize 接口名笔误(ForeachAbs→Heaviside)。 - docs/aclnnHeaviside_en.md:错误码表表头 Error Code→Return Code;新增"input 与 values dtype 不一致"错误行(rowspan 3→4)。 - README_en.md:公式条件分支文案由中文"如果"改为英文"if"。 3. 示例资源释放 - examples/test_aclnn_heaviside.cpp:各失败分支补充 aclDestroyTensor / aclrtFree / aclrtResetDevice / aclFinalize,修复异常路径资源泄漏。 4. 静态检查规范整改 - CMakeLists、config binary json、proto/tiling/kernel 头文件、UT 源码等补充文件末尾换行、去除行尾空格。 - tests/ut/op_kernel/heaviside_tiling_def.h:elementNum 类型 int32_t→int64_t,与 tiling 结构对齐。 - gen_data.py / compare_data.py:移除未使用 import(re/math/torch),代码风格修正。 ## 关联的Issue - https://gitcode.com/cann/ops-nn/issues/8397 ## 测试 - 现有 UT 全量回归:op_host infershape/tiling、op_kernel、op_api、ST(含更新后的 atk 用例与 tiling_def 类型对齐)。 ## 文档更新 - activation/heaviside/docs/aclnnHeaviside_en.md:错误码表头与 dtype 一致性错误行。 - activation/heaviside/README_en.md:公式文案英文化。 - activation/heaviside/op_api/aclnn_heaviside.h:参数方向与接口名注释修正。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 - [ ] AI辅助编写 See merge request: cann/ops-nn!13876 | 12 days ago |
Heaviside
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 | × |
| kirin X90 processor series products | √ |
| Kirin 9030 processor series products | √ |
Function
-
Description: Computes the Heaviside step function of each element in the input input, serving as the activation function of the model.
-
Formula:
Heaviside(input,values)={0,if input<0values,if input=01,if input>0\text{Heaviside}(\text{input}, \text{values}) = \begin{cases} 0, & \text{if input} < 0 \\ \text{values}, & \text{if input} = 0 \\ 1, & \text{if input} > 0 \end{cases} Heaviside(input,values)=⎩⎪⎪⎨⎪⎪⎧0,values,1,if input<0if input=0if input>0
Parameters
| Parameter name | Input/Output/Attribute | Description | Data type | Data format |
|---|---|---|---|---|
| input | Input | Input input in the formula. | BFLOAT16, FLOAT16, FLOAT | ND |
| values | Input | Input values in the formula. | BFLOAT16, FLOAT16, FLOAT | ND |
| out | Output | Heaviside in the formula. | BFLOAT16, FLOAT16, FLOAT | ND |
- kirin X90 processor series products and Kirin 9030 processor series products: BFLOAT16 is not supported.
Constraints
- The data types of input, values, and out must be consistent.
- input supports 1~8 dims. When values is a single-element tensor (scalar), input additionally supports 0 dims (scalar).
- values supports only the following two forms:
- A single-element tensor (with a total element count of 1, processed as a scalar);
- The exact same shape as input, with the total element counts of both input and values greater than 0 (graph mode does not support empty tensors with a total element count of 0).
- In graph mode (operator IR), the kernel does not perform broadcast internally and reads values only as a scalar or at the same linear offset. Therefore, a general broadcast relationship between input and values is not supported (for example, input is a 0-dim scalar while values is a multi-dim tensor).
Invocation Description
| Invocation method | Invocation sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_heaviside | Calls the Heaviside operator through the aclnnHeaviside interface. |
| Graph-mode invocation | - | Calls the Heaviside operator by constructing a graph through the operator IR. |