已合并
feat: Add batch_norm_reduce API documentation and enhance unit tests. #5251
feat: Add batch_norm_reduce API documentation and enhance unit tests. #5251
已合并
fgd_dragon创建于 6月24日
fgd_dragon
6月24日

【合入来源】

【修改方案】

  • 新增 torch_npu.batch_norm_reduce 自定义接口文档,补充产品支持、功能说明、函数原型、参数说明、返回值说明、约束说明和调用示例。
  • 同步更新 torch_npu 自定义接口索引与 PyTorch API 菜单入口。
  • _op_plugin_docs.py 中补充 torch_npu.batch_norm_reduce 运行时 docstring,使 help(torch_npu.batch_norm_reduce) 可展示接口说明。
  • 增强 batch_norm_reduce UT:
    • 覆盖多 shape、float32float16 正常路径。
    • 增加 bfloat16 用例,并使用设备约束。
    • 增加 eps 不影响输出结果的测试。
    • 增加输入维度非法场景测试。
  • 修正 batch_norm_reduce_meta 输出 dtype 为 float32,并同步修正 FakeTensor 测试断言。原因是 C++ 实现中 sumsquare_sum 均通过 self.options().dtype(at::kFloat) 创建,真实执行输出 dtype 固定为 float32;原 meta 实现使用 self.dtype 构造输出,在 float16/bfloat16 输入场景下会与真实接口行为不一致。

【资料变更】

涉及资料变更。

新增 torch_npu.batch_norm_reduce 接口文档,并同步更新自定义接口列表、菜单入口和运行时 docstring。

【接口变更】

不涉及新增或修改已有接口签名。

本次补充的是已存在接口 torch_npu.batch_norm_reduce(input, eps) -> (Tensor, Tensor) 的文档、运行时说明和 UT 看护;未修改接口参数、返回值数量或调用方式。

【功能验证】

  • python test/test_base_ops/test_batch_norm_reduce.py
    image.png
  • python test/core_tests/test_fake_tensor.py -k batch_norm_reduce
    image.png

新增/变更内容已补充 UT 看护,覆盖基础数值语义、shape、dtype、eps行为、非法维度和 FakeTensor meta 行为。

【CheckList】

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 fgd_dragon 的贡献)
Ffgd_dragon
6月24日 创建了 pull request,commit 70f2db1b
ascend-robotascend-robot成员
6月24日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
6月24日 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here
You can get sig-info at here


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
docs htchu, molly123321, liangsongwei (3/2) liangsongwei, htchu (2/1)
repo-Ascend/op-plugin liangsongwei, htchu (2/2) liangsongwei, htchu (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

wang-ziqi-code, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ascend-robotascend-robot成员
6月24日 添加了label:needs-issue
此处折叠了208条消息 查看更多
htchu成员
7月2日 评论:

/approve

likedislike
ascend-robotascend-robot成员
7月2日 添加了label:lgtm
ascend-robotascend-robot成员
7月2日 关闭了关联的issue
ascend-robotascend-robot成员
7月2日 合入了pull request
ascend-robot
ascend-robot成员
7月2日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike