已合并
[feat] add new aten #5718
culechan创建于 8 天前
[feat] add new aten #5718
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 culechan 的贡献)atomgit-bot
8 天前 评论:
8 天前 评论:
变更摘要
此 PR 新增了对 repeat_interleave.Tensor 算子的支持,该算子的输入为重复次数张量(而非标量重复次数),根据 repeats 张量中的每个元素值来重复张量的对应元素。变更涉及算子配置注册、NPU 内核实现以及测试 Schema 文件的更新。
主要改动
- 新增算子配置注册:在
op_plugin/config/op_plugin_functions.yaml的official和symint两个分区中分别注册了repeat_interleave.Tensor(Tensor repeats, *, SymInt? output_size=None) -> Tensor,均绑定op_api版本为[v2.2, newest]。 - 新增 NPU 内核实现:在
RepeatInterLeaveKernelNpuOpApi.cpp中新增了repeat_interleave_symint重载,接受repeats张量和可选的output_size,内部通过cumsum计算输出总长度,并调用aclnnRepeatInterleaveTensor执行 NPU 计算。 - 测试 Schema 同步:在
test/core_tests/torch_npu_OpApi_schema_all.json中新增repeat_interleave.Tensor的版本声明条目,版本范围为["v2.2", "newest"]。


ascend-robot
8 天前 评论:
8 天前 评论:
atomgit-bot
8 天前 评论:
8 天前 评论:
代码审查
YAML 和 JSON 文件均无拼写错误或不一致。以下是最终总结。
审查总结
| 文件 | 结果 |
|---|---|
op_plugin/config/op_plugin_functions.yaml |
无问题 |
op_plugin/ops/opapi/RepeatInterLeaveKernelNpuOpApi.cpp |
4 个问题(3 P2 + 1 P3) |
test/core_tests/torch_npu_OpApi_schema_all.json |
无问题 |
按优先级统计:P0: 0,P1: 0,P2: 3,P3: 1
整体风险判断:中等。新增的 repeat_interleave_symint 重载(仅接受 repeats 张量,无 self)存在多处逻辑缺口——负数校验在 output_size 路径被跳过、output_size 与实际 repeats 之和缺少一致性校验、空张量可触发越界崩溃。YAML 配置和 JSON schema 条目本身无问题,签名一致。建议在合入前修复 C++ 中的校验缺失问题。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 0 |
| 🟡 建议 | 3 |
💬 仅评论


8 天前 添加了label:needs-issue
此处折叠了123条消息 查看更多
chengpeng25
5 天前 评论:
5 天前 评论:
/lgtm


5 天前 添加了label:lgtm
5 天前 关闭了关联的issue
5 天前 合入了pull request
ascend-robot
5 天前 评论:
5 天前 评论:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


【合入来源】
【修改方案】
新增一个aten.repeat_interleave.Tensor,因为repeat_interleave在图模式中走的是小算子拼接最后会依赖到这个aten的实现,所以这里补充实现。
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
【CheckList】