You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Card-73285
Since the auto-generated code is different between dynamic and static mode, Grad OP index_put_grad works fine in dynamic mode but raises error in static mode.
I0720 12:47:08.784021 8805 op_call_stack.cc:62] InvalidArgumentError: shape of value can't not be broadcast to shape of x[indices] (at /paddle/Paddle/paddle/phi/kernels/funcs/index_put_utils.h:286)
Traceback (most recent call last):
File "test_index_put_grad.py", line 50, in <module>
res = exe.run(fetch_list=[z, x.grad_name, value.grad_name])
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/executor.py", line 1444, in run
use_prune=use_prune,
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/executor.py", line 1669, in _run_impl
ret = new_exe.run(list(feed.keys()), return_numpy)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/executor.py", line 684, in run
tensors = self._new_exe.run(feed_names)._move_to_list()
ValueError: In user code:
File "test_index_put_grad.py", line 44, in <module>
z = paddle.index_put(y, (index1,), value)
File "/usr/local/lib/python3.7/dist-packages/paddle/tensor/manipulation.py", line 4918, in index_put
attrs={'accumulate': accumulate},
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/layer_helper.py", line 45, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/framework.py", line 4033, in append_op
attrs=kwargs.get("attrs", None),
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/framework.py", line 2795, in __init__
for frame in traceback.extract_stack():
InvalidArgumentError: shape of value can't not be broadcast to shape of x[indices] (at /paddle/Paddle/paddle/phi/kernels/funcs/index_put_utils.h:286)
[operator < index_put_grad > error]
The essence of the problem is in GeneralBinaryGradInferMeta , the second input (indices[0]) is used incorrectly in the static graph mode, resulting in error size of value_grad. This PR fixes this by adding IndexPutGradInferMeta.
你的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.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
Bug fixes
PR changes
OPs
Description
Card-73285
Since the auto-generated code is different between dynamic and static mode, Grad OP
index_put_grad
works fine in dynamic mode but raises error in static mode.The essence of the problem is in
GeneralBinaryGradInferMeta
, the second input (indices[0]) is used incorrectly in the static graph mode, resulting in error size ofvalue_grad
. This PR fixes this by addingIndexPutGradInferMeta
.