已合并
补充 strided_slice_v3 infershape UT 用例 #4472
andong_hw创建于 6 天前
补充 strided_slice_v3 infershape UT 用例 #4472
已合并
andong_hw创建于 6 天前
andong_hw成员
6 天前

关联 Issue

Closes #2533

背景

strided_slice_v3_infershape.cpp 覆盖率仅 71.26%(167 行)。现有测试只用 DT_INT64,未覆盖 DT_INT32 路径、负轴、未知秩、非 const 输入、stride==0、动态 shape 等场景。

修改内容

新增 6 个 UT 用例:

  • strided_slice_v3_int32_with_negative_axes:DT_INT32 + 负轴
  • strided_slice_v3_unknown_rank:未知秩输入 {-2}
  • strided_slice_v3_non_const_end_strides:非 const end 和 strides
  • strided_slice_v3_stride_zero:stride==0 → GRAPH_FAILED
  • strided_slice_v3_dynamic_shape:动态 shape (-1)
  • strided_slice_v3_non_const_axes:非 const axes → SetAllUnknownDim
  • strided_slice_v3_negative_step_clip:负 step + begin/end 超出范围,覆盖 clipLower/clipUpper

验证

  • 16 个用例全部通过
  • 覆盖率从 71.26% 提升至 90.42%(167 行)
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 andong_hw 的贡献)
Aandong_hw成员
6 天前 创建了 pull request,commit cee48283
Aandong_hw成员
6 天前 关联了issue:strided_slice_v3 infershape UT 覆盖率不达标
atomgit-bot
atomgit-bot
6 天前 评论:

变更摘要

此 PR 主要针对 strided_slice_v3_infershape 算子的形状推导逻辑补充单元测试覆盖率,新增 8 个测试用例,覆盖之前缺失的 DT_INT32 路径、负轴、未知秩、非 const 输入、stride 为零、动态 shape 以及异常分支(无效 axes dtype、axes 越界)等场景,将覆盖率从 71.26% 提升至 94.01%。同时附带了对测试夹具中 SetUpTestCase / TearDownTestCase 的格式整理。

主要改动

  • 新增 strided_slice_v3_int32_with_negative_axes 用例:验证 DT_INT32 类型的 begin/end/axes/strides 输入与负轴场景下的形状推导正确性。
  • 新增 strided_slice_v3_unknown_rank 用例:验证输入秩为 -2(未知秩)时,推导输出 shape 仍为 {-2}
  • 新增 strided_slice_v3_non_const_axesstrided_slice_v3_non_const_end_strides 用例:分别覆盖非 const 的 axes 和非 const 的 end/strides 输入,验证推导结果回退为 SetAllUnknownDim(即输出 shape 为 {-1, ...})。
  • 新增 strided_slice_v3_stride_zerostrided_slice_v3_invalid_axes_dtypestrided_slice_v3_axes_out_of_range 用例:覆盖 stride 为 0、axes 的 dtype 非 INT32/INT64、axes 值超出有效范围三种异常路径,均期望返回 GRAPH_FAILED
  • 新增 strided_slice_v3_dynamic_shape 用例:覆盖输入 shape 含动态维度(-1)时,curAxisInputSize == UNKNOWN_DIM_VALUE_ 分支的推导行为。
likedislike
atomgit-bot
atomgit-bot
6 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
6 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
6 天前 评论:

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
conversion/strided_slice_v3 jia0liang, zhanw_coding (2/2) zhanw_coding (1/1)

💡 Tip:

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

CLA Signature Pass

andong_hw, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
6 天前 将FelixTang7,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng,xuejinghui,zhanw_coding设为评审人
此处折叠了6条事件消息 查看更多
CANN-robotCANN-robot成员
6 天前 添加了label:cann-cla/yes
andong_hw成员
6 天前 评论:

compile

likedislike
Aandong_hw成员
6 天前 update merge request[project id: 7649531, iid: 4472, commit_id: 7a54d128f6c808c533e71f2789f28a9109c84d30] virtual merging success
CANN-robotCANN-robot成员
6 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6 天前 评论:

流水线任务触发成功
任务链接 [fc7cb53d5e3a4fa292db9dfc03208f22][流水线指导]

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_9030_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>
UT_Test_harmony-infer-chs-math ✅ SUCCESS
UT_Test_harmony-infer-cpro-math ✅ SUCCESS

[2026-08-05 18:15:52]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
6 天前 评论:

流水线任务触发成功
任务链接 [4ef49eda58294a7b813d54ad28846f93][流水线指导]

任务名称状态日志下载链接
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_precommit ✅ SUCCESS >>>>>

[2026-08-05 18:06:57]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
6 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6 天前 添加了label:ci-pipeline-passed
陈佳良成员
5 天前 评论:

/lgtm
/approve

likedislike
zhanw_coding
zhanw_coding成员
5 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
5 天前 添加了label:lgtmapproved
CANN-robotCANN-robot成员
5 天前 关闭了关联的issue
CANN-robotCANN-robot成员
5 天前 合入了pull request