Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【cherry-pick】Fix bug of indexing with ellipsis (#37182) #37192

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

zyfncg
Copy link
Contributor

@zyfncg zyfncg commented Nov 15, 2021

PR types

Bug fixes

PR changes

APIs

Describe

修复了一维Tensor在使用省略号(...)索引时维度检测异常的问题。

Exmple:

Before this PR:

>>> x = paddle.to_tensor([1, 2, 3, 4])
>>> print(x[..., 0])
#  ValueError: (InvalidArgument) Too many indices (2) for tensor of dimension 1.
#  [Hint: Expected valid_indexs <= rank == true, but received valid_indexs <= rank:0 != true:1.]

Now:

>>> x = paddle.to_tensor([1, 2, 3, 4])
>>> print(x[..., 0])
# Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True, 
#              [1])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@lanxianghit lanxianghit merged commit 79b9f47 into PaddlePaddle:release/2.2 Nov 16, 2021
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.

3 participants