-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Zero-Dim] support 0-D output and 0-D as indice in __getitem__/__setitem__ #52814
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
[Zero-Dim] support 0-D output and 0-D as indice in __getitem__/__setitem__ #52814
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
ea71121
to
f2559ac
Compare
assert len(ref_dims_mapping) == len(out_dims_mapping) | ||
assert ref_dims_mapping[0] == out_dims_mapping[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个感觉可以判断out_dims_mapping如果维度>0,就判断 assert ref_dims_mapping[0] == out_dims_mapping[0],这样之前的检查逻辑也可以保留了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里特化了ref_dims_mapping==[]
的场景,在下面else分支中会逐轴比对ref_dims_mapping[i] / out_dims_mapping[i]
test_set_value_op_xpu、test_slice_op_xpu挂了 |
fe9e70d
to
061666f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for paddle_enforce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
APIs
Describe
Pcard-66985
This PR is to support 0-D Tensor in Tensor
__getitem__
. From now, 0-D Tensor is semantically equivalent to scalar while 1-D Tensor is vector.There will be two incompatible behavior changes in
__getitem__
:NOTE : Combine indexing is not supported now, and 1-d Tensor is treated as vector, so following usages are not supported, we will try to support these usages as soon as possible.
x[1, paddle.ones([1], dtype='int32')]
/x[:, paddle.ones([1], dtype='int32')]
For
__setitem__
, now we can also use 0-D Tensor as indice0-D Tensor can also be used as a value to fill.