已关闭
[Bug-Report|缺陷反馈]: Index算子InferShape不支持动态shape(-1/-2/混合),indices广播误拦截未知维 #5915
xuejinghui创建于 25 天前关闭于 25 天前
25 天前 添加了label:bug-report
25 天前 修改了issue 的描述
xuejinghui
25 天前 评论:
25 天前 评论:
/assign


25 天前 将 xuejinghui 设为负责人
25 天前 关闭了 issue
25 天前 添加了label:resolved
问题描述
index/index算子的 InferShape 实现(op_host/index_infershape.cpp)不支持动态 shape 输入,具体缺陷:CanBroadcast中if (dim <= 0)一刀切拦截:indices 输入任一维为 -1(unknown dim)或 -2(unknown rank)时直接返回 GRAPH_FAILED,混合动态 shape(如{-1, 2, 4, -1})被误拦截{-2}时无任何特化处理,落入维度校验被拦截ComputeBroadcastShape用max(current_dim, dim)静默吞掉 -1,广播时未知维信息丢失sizes_tensor->GetData<int64_t>()返回值未判空,nullptr 输入直接崩溃环境信息
Ascend 950PR / Atlas A2/A3;CANN 9.2.0
重现步骤
{-1, 2, 4, -1}(混合动态 shape)dim must be > 0(-1 维被当非法值拦截)或用 UT 复现:在
tests/ut/op_host/test_index_infershape.cpp构造动态 shape 用例,修复前用例全部失败。预期结果
{-2}(unknown rank)时输出透传{-2}{-1,5}×{3,-1}→{3,5})日志/截图
修复分支
index_inferShape(commit f603fc21e,MR cann/ops-nn!10481):dim must be > 0/ 段错误路径)bash build.sh -u --ophost --soc=ascend950 --ops=index23/23 通过{3,5}×{5}、1 扩展{3,1}×{1,5}、不兼容拦截{3}×{5})备注