Skip to content

Conversation

@zyfncg
Copy link
Contributor

@zyfncg zyfncg commented Nov 14, 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.

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zyfncg zyfncg merged commit f2a56c6 into PaddlePaddle:develop Nov 15, 2021
@zyfncg zyfncg deleted the fix_ellipsis branch November 15, 2021 03:10
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.

2 participants