已合并
[feat] add new aten #5718
culechan创建于 8 天前
[feat] add new aten #5718
已合并
culechan创建于 8 天前
culechan
culechan成员
8 天前

【合入来源】

如有社区issue,请关联issue链接
请勿携带内部流程信息(需求链接、问题单、内部issue等)

【修改方案】

新增一个aten.repeat_interleave.Tensor,因为repeat_interleave在图模式中走的是小算子拼接最后会依赖到这个aten的实现,所以这里补充实现。

【资料变更】

不涉及

【接口变更】

不涉及

【功能验证】

img_v3_0214j_3b454423-2fe0-4f89-a32c-a5e5971c57ag.jpg

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 culechan 的贡献)
culechanculechan成员
8 天前 创建了 pull request,commit 2da9a07f
atomgit-bot
atomgit-bot
8 天前 评论:

变更摘要

此 PR 新增了对 repeat_interleave.Tensor 算子的支持,该算子的输入为重复次数张量(而非标量重复次数),根据 repeats 张量中的每个元素值来重复张量的对应元素。变更涉及算子配置注册、NPU 内核实现以及测试 Schema 文件的更新。

主要改动

  • 新增算子配置注册:在 op_plugin/config/op_plugin_functions.yamlofficialsymint 两个分区中分别注册了 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"]
likedislike
atomgit-bot
atomgit-bot
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

💬 仅评论

likedislike
ascend-robotascend-robot成员
8 天前 添加了label:needs-issue
此处折叠了123条消息 查看更多
chengpeng25成员
5 天前 评论:

/lgtm

likedislike
ascend-robotascend-robot成员
5 天前 添加了label:lgtm
ascend-robotascend-robot成员
5 天前 关闭了关联的issue
ascend-robotascend-robot成员
5 天前 合入了pull request
ascend-robot
ascend-robot成员
5 天前 评论:

Pull Request 已合并或已关闭。

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

likedislike