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

Paddle 3.0 不再支持数组按位赋值 #69391

Open
Liyulingyue opened this issue Nov 14, 2024 · 0 comments
Open

Paddle 3.0 不再支持数组按位赋值 #69391

Liyulingyue opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/new-issue 新建 type/question 用户提问

Comments

@Liyulingyue
Copy link
Contributor

请提出你的问题 Please ask your question

问题说明

下述代码在Paddle 2.5 下可以使用,但在 Paddle 3.0 会出现报错。请问这个情况是是升级的特性,还是一个需要被修复的问题?

可复现代码


import paddle
t_not_eq_zero_indices = paddle.to_tensor([[True, True, True, True, True, True, False, True, True, True, True, True, True]])
sinc_filter = paddle.to_tensor([-159.05421448,  159.34126282, -159.57885742,  159.76324463,
        -159.89434814,  159.97329712,  159.97329712, -159.89434814,
         159.76324463, -159.57885742,  159.34126282, -159.05421448])
weights = paddle.to_tensor([[0.00024673, 0.07367989, 0.25912309, 0.50785363, 0.75452065, 0.93431580,
         1.        , 0.93431580, 0.75452065, 0.50785363, 0.25912309, 0.07367989,
         0.00024673]])
weights[t_not_eq_zero_indices] *= sinc_filter

报错信息

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)Cell In[6], line 1 ----> 1 weights[t_not_eq_zero_indices] *= sinc_filter File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/base/dygraph/tensor_patch_methods.py:1020, in monkey_patch_tensor.<locals>.__setitem__(self, item, value) 1014 def __setitem__( 1015 self, 1016 item: TensorIndex, 1017 value: Tensor | npt.NDArray[Any] | complex | bool, 1018 ) -> None: 1019 item = pre_deal_index(self, item) -> 1020 return self._setitem_dygraph(item, value) 
ValueError: (InvalidArgument) The value (12) of the non-singleton dimension does not match the corresponding value (13) in shape for expand_v2 op. 
[Hint: Expected vec_in_dims[i] == expand_shape[i], but received vec_in_dims[i]:12 != expand_shape[i]:13.] (at /paddle/paddle/phi/kernels/impl/expand_kernel_impl.h:65)
@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/new-issue 新建 type/question 用户提问
Projects
None yet
Development

No branches or pull requests

2 participants