| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 | |
fix(experimental/reduce_std_v2): 空tensor及corner case路径workspaceSize未正确获取 Co-authored-by: andong_hw<andong2@huawei.com> # message auto-generated for no-merge-commit merge: !4546 merge fix-std-workspace-size-exp into master fix(experimental/reduce_std_v2): 空tensor及corner case路径workspaceSize未正确获取 Created-by: andong_hw Commit-by: andong_hw Merged-by: cann-robot Description: Closes #2566 ## 问题 experimental/aclnnStd 的 GetWorkspaceSize 中,空tensor及 shapeProd<=correction 等 corner case 路径调用了 CheckFillScalarShapeStdAndVar,该函数内部使用 AllocIntArray/l0op::Fill/l0op::ViewCopy,均需要 workspace 中转,但后续误写 *workspaceSize = 0,导致 workspace 不足。 ## 修复 将 *workspaceSize = 0 改为 *workspaceSize = uniqueExecutor->GetWorkspaceSize()。 ## 涉及文件 - experimental/math/reduce_std_v2/op_api/aclnn_std.cpp (3处) ## 备注 pre-commit clang-format 对全文件做了格式化,格式化变更为附带影响。 See merge request: cann/ops-math!4546 | 20 天前 | |
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 | |
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 | |
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 | |
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 | |
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 | |
新增Ascend C实现的reduce_std_v2算子 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3126 merge upload-reduce-std-v2-20260604 into master 新增Ascend C实现的reduce_std_v2算子 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 experimental/math/reduce_std_v2路径下ReduceStdV2算子的Ascend C实现与配套工程文件。 主要改动包括: - 新增 ReduceStdV2 L0 op_api、op_host、op_kernel、op_graph 相关文件。 - 支持 dim、correction、keepdim 参数校验与 shape 推导。 - 支持空 tensor、0 维 tensor、shapeProd <= correction 等特殊场景处理。 - 910B 系列通过 ReduceMean + Expand + ReduceStdWithMean + Cast + ViewCopy 组合路径实现。 - arch35 路径保留 ReduceStdV2 AICore kernel、tiling 与 ascend950 配置。 - 新增 op_host / op_api UT,覆盖参数校验、shape 推导和接口构图路径。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1837 ## 测试 已完成以下验证: 套件 用例数 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━ Accu_Generalization 2103 Pass ────────────────────────── Accu_RL 3 Pass ────────────────────────── Accu_pangu 3 Pass ────────────────────────── Special 103 Pass ────────────────────────── Abnormal 3 Pass,3 条均为预期错误匹配 ────────────────────────── Sanitizer_Generalization 180 Pass ────────────────────────── Perf_Generalization 6 Pass CI/工程验证: 项目 结果 ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 环境检查 Pass ─────────────────────────── experimental package 编译 Pass ─────────────────────────── custom package 安装 Pass ─────────────────────────── op_host UT Pass,1 test ─────────────────────────── op_api UT Pass,43 tests ─────────────────────────── op_graph UT Pass,0 tests ─────────────────────────── NPU 示例运行 Pass ## 文档更新 已更新/新增以下文档: - experimental/math/reduce_std_v2/README.md ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3126 | 2 个月前 |
ReduceStdV2
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
功能说明
-
算子功能:计算指定维度(dim)的标准差和均值,这个dim可以是单个维度、维度列表或者None。
-
计算公式: 假设 dim 为 iii,则对该维度进行计算。NNN为该维度的 shape。取 xix_{i}xi,求出该维度上的平均值 xiˉ\bar{x_{i}}xiˉ。
std=1max(0,N−δN)∑j=0N−1(xij−xiˉ)2std = \sqrt{\frac{1}{max(0, N - \delta N)}\sum_{j=0}^{N-1}(x_{ij}-\bar{x_{i}})^2} std=max(0,N−δN)1j=0∑N−1(xij−xiˉ)2
当
keepdim = true时,reduce 后保留该维度,且输出 shape 中该维度值为 1;当keepdim = false时,不保留。
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x | 输入 | 待进行ReduceStdV2计算的输入Tensor,公式中的x。 | FLOAT、FLOAT16、BFLOAT16 | ND |
| dim | 属性 | 参与Reduce计算的维度,公式中的i。默认值为空列表,表示对所有维度做Reduce。 | LIST_INT | - |
| correction | 属性 | 修正值,公式中的delta。 | INT64 | - |
| keepdim | 属性 | 是否在输出张量中保留输入张量的维度。 | BOOL | - |
| is_mean_out | 属性 | 是否输出均值。true表示输出mean,false表示不输出mean。 | BOOL | - |
| std | 输出 | ReduceStdV2计算的标准差出参,公式中的std。 | FLOAT、FLOAT16、BFLOAT16 | ND |
| mean | 输出 | ReduceStdV2计算的均值出参,公式中的平均值。 | FLOAT、FLOAT16、BFLOAT16 | ND |
- Atlas 训练系列产品、Atlas 推理系列产品: 不支持BFLOAT16。
约束说明
dim中的每个维度值必须在[-rank(x), rank(x))范围内,支持负数维度;同一维度归一化后不能重复。- 当
dim为空列表时,对x的所有维度进行Reduce。 std和mean的shape由dim和keepdim推导:keepdim = true时保留被Reduce维度且维度值为1,keepdim = false时删除被Reduce维度。- aclnnStd接口中
out的shape必须与dim和keepdim推导结果一致。 - aclnnStd接口中
x和out的数据类型均需在支持列表内,且x的数据类型需支持转换为out的数据类型;ReduceStdV2图算子的std、mean与x支持相同的数据类型范围。 - 空Tensor场景返回NaN;当被Reduce维度的元素数
shapeProd为1且shapeProd <= correction时返回NaN;当correction > 1且shapeProd <= correction时返回Inf。
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| aclnn调用 | test_aclnn_std.cpp | 通过aclnnStd接口方式调用ReduceStdV2算子。 |