Pull Request已成功合入, 合并人@CANN-robot
(感谢 黄晓彬 的贡献)变更摘要
本 PR 用于对齐 BatchMultiClassNonMaxSuppression 与 SortedNMS 的旧 InferShape 协议:BatchMultiClassNonMaxSuppression 的原 InferShape 固定输出 boxes [B,M,4]、count [B],与旧融合内部 transpose_box=true 所需的 boxes [B,4,M]、count [B,8] 不一致,本次按 transposeBox 恢复对应推导,并同步调整 Ascend950 tiling 的 scores 轴解析及 kernel 的 scores 索引、输出步长和 count padding 清零;同时对齐 Batch 旧 GE 的动态 Shape 推导(batch 取自 scores,存在未知维度时保守推导为未知,浮点输出 dtype 跟随 scores),并放宽 SortedNMS 推导阶段过强的 rank/已知上界限制,具体输入合法性交由 tiling 检查。正常 false 输入的计算协议和 NMS 筛选算法保持不变,并补充了 Batch 的 InferShape UT。
主要改动
- Batch InferShape 按
transposeBox恢复旧输出协议(batch_multi_class_non_max_suppression_infershape.cpp):transposeBox=true时 boxes 输出为[B,4,M]、count 输出为[B,8],否则维持[B,M,4]/[B];batch 改为取自scores的 dim 0,且 scores 任一维度为未知时保守推导为ge::UNKNOWN_DIM。 - Batch 浮点输出 dtype 跟随 scores(
batch_multi_class_non_max_suppression_infershape.cpp):InferDataTypeForBatchMultiClassNonMaxSuppression由读取 boxes 类型改为读取 scores 类型推导 boxes/scores/classes 三个浮点输出的 dtype,count 仍为DT_INT32。 - 950 tiling 按
transposeBox解析 scores 轴并校验转置输出契约(batch_multi_class_non_max_suppression_tiling_arch35.cpp):classesNum与boxesNum在 scores 的 dim 1/dim 2 之间按transposeBox互换解析;ValidateOutputContract新增对[B,4,M]boxes 与[B,8]count 的校验分支。 - 950 kernel 适配
[B,C,N]scores 与转置输出布局(batch_multi_class_non_max_suppression_kernel.h):scores 偏移改为(batchIndex * classesNum + classIndex) * boxesNum + boxIndex,boxes 输出按坐标维 stridemaxTotalSize写转置布局,count 写入使用kPaddedCountStride(8)/kUnpaddedCountStride(1)偏移并对 padding 位清零,nmsedNumGm_缓冲长度同步扩展。 - SortedNMS 放宽 InferShape 限制(
sorted_nms_infershape.cpp):移除 boxes rank 必须为 2、第二维必须为 4、shape range 首维必须已知等过强校验,输出保持[-1]、ShapeRange[0,N],具体输入合法性交由 tiling 检查;同时补充 Batch 旧协议(转置输出、未知 batch、dtype 跟随 scores)的 UT 用例。


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 |
|---|---|---|
| repo-cann/ops-cv | ✅ 刘伟, 汤平川 (2/2) | ✅ 汤平川, 刘伟 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


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


/lgtm
/approve


/lgtm
/approve


描述
BatchMultiClassNonMaxSuppression 的原 InferShape 固定输出 boxes
[B,M,4]、count[B],与旧融合内部transpose_box=true需要的 boxes[B,4,M]、count[B,8]不一致。本次按 transpose_box 恢复对应推导,并同步调整 Ascend950 tiling 的 scores 轴解析及 kernel 的 scores 索引、输出步长和 count padding 清零。正常 false 输入的计算协议和 NMS 筛选算法保持不变。同时对齐 Batch 旧 GE 的动态 Shape 推导:batch 来自 scores,存在未知维度时保守推导为未知,浮点输出 dtype 跟随 scores;SortedNMS 保留输出
[-1]、ShapeRange[0,N],移除推导阶段过强的 rank/已知上界限制。具体输入合法性仍由 tiling 检查。关联的Issue
https://gitcode.com/cann/ops-cv/issues/888
测试
文档更新
不涉及
类型标签