Skip to content

Conversation

@LittleHeroZZZX
Copy link
Contributor

@LittleHeroZZZX LittleHeroZZZX commented Jul 23, 2025

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

pcard-67164
getitem 无法正确处理含有 秩>2 的布尔高级索引。

以 Tensor([3,4,5],"float32"), (slice(None,None,None),tuple(Tensor([4,5],"bool")) 为例,
parseIndex 无法识别出布尔索引会 consume input 的 1 和 2 两个维度,而是按照整数索引的处理方式认为其只作用在第 1 维度上,从而导致在 dealWithAdvancedIndex 拿到的转置的 tensor 的形状为 [4, 3, 5],而不是预期的 [4, 5, 3]。最终引发了维度不匹配报错:

Traceback (most recent call last):
  File "/work/PaddleX/PaddleCustomDevice/Paddle/test/indexing/test_getitem_appendix.py", line 237, in test_combined
    self.accuracy_check(x[:, 0, index_np], y[:, 0, index_paddle])
  File "/work/PaddleX/PaddleCustomDevice/.venv/lib/python3.10/site-packages/paddle/base/dygraph/tensor_patch_methods.py", line 1070, in __getitem__
    return self._getitem_dygraph(item)
ValueError: (InvalidArgument) The reduce dim index 0 should be in the range [ -dimension(X), dimension(X) ) which dimension = 2. But received dim index = 2.
  [Hint: Expected axis[i] < x_rank, but received axis[i]:2 >= x_rank:2.] (at /paddle/paddle/phi/infermeta/unary.cc:5619)

@paddle-bot
Copy link

paddle-bot bot commented Jul 23, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@LittleHeroZZZX LittleHeroZZZX changed the title Fix multi-dim bool tensor index [Slice] Fix multi-dim bool tensor index Jul 23, 2025
@LittleHeroZZZX LittleHeroZZZX changed the title [Slice] Fix multi-dim bool tensor index [Slice] Support multi-dim bool tensor index Jul 23, 2025
@LittleHeroZZZX
Copy link
Contributor Author

/re-run all-failed

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Aug 2, 2025

Sorry to inform you that f7fdeee's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@LittleHeroZZZX
Copy link
Contributor Author

#74320 中提交

@LittleHeroZZZX LittleHeroZZZX deleted the fix/slice_bool branch November 11, 2025 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant