Pull Request has been successfully merged by CANN-robot.
(Thank you for 刘奕哲's contribution.)变更摘要
本 PR 旨在修复 Round 算子行为,使其与 AscendC 保持一致。核心改动集中在三处:在 C++ 接口 Round 中从内核支持的数据类型集合里移除 DT_INT16(仅保留 DT_FP32、DT_FP16、DT_BF16、DT_INT32 及按架构区分的 DT_INT64);在 Python 接口 round 中针对整数张量(DT_INT32、DT_INT64)新增约束——decimals 必须为 0,否则抛出 PyptoError,且 decimals == 0 时直接返回 add(input, 0)(恒等操作)而不再调用内核 Round;并同步更新/删除了对应的测试用例。
主要改动
- 移除
DT_INT16内核支持:在framework/src/interface/operation/vector/unary_basic.cpp的Round中,将DT_INT16从ROUND_A2A3_TYPES与ROUND_A5_TYPES两个支持类型集合中删除,收窄内核支持范围以对齐 AscendC 行为。 - Python 侧整数
round走恒等路径:在python/pypto/op/math.py的round中新增判断,当输入为DT_INT32/DT_INT64时要求decimals == 0,否则以ValueError抛出PyptoError;decimals == 0时直接返回add(input, 0),不再进入pypto_impl.Round。 - 调整并删除测试用例:在
round_test_case.py中将 int32 用例的decimals由-1改为0,并将data_range扩为 int32 全取值范围(-2147483648至2147483647);同时删除使用int16、decimals: -2的原Round_test_14用例。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| docs | ✅ lyz0328, 尹杰 (2/2) | ✅ lyz0328 (1/1) |
| framework/src/interface/operation | ✅ shi-dingkun, 尹杰 (2/2) | ✅ shi-dingkun (1/1) |
| python/pypto/op | ✅ shi-dingkun, 尹杰 (2/2) | ✅ shi-dingkun (1/1) |
| repo-cann/pypto | ✅ 尹杰, shi-dingkun (2/2) | ✅ shi-dingkun (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
Creeeeper, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/lgtm


/approve


/approve


描述
Round算子与AscendC对齐:
测试
完成冒烟测试
关联Issue
#3211
类型标签