-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
fix the scatternd/scatterndadd #27634
Conversation
Thanks for your contribution! |
python/paddle/fluid/layers/nn.py
Outdated
If :attr:`index` has repeated elements, then the corresponding updates are accumulated. | ||
Because of the numerical approximation issues, the different order of repeated elements | ||
in :attr:`index` may cause different results. The specific calculation method can be | ||
seen :code:`scatter_nd_add` . This op is the inverse of the :code:`gather_nd` op. | ||
|
||
Args: | ||
index (Variable): The index input with rank > 1 and index.shape[-1] <= len(shape). | ||
index (Tensor): The index input with rank > 1 and index.shape[-1] <= len(shape). |
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.
rank -> ndim
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.
done, thx.
|
||
:attr:`x` is a Tensor with rank :math:`R` | ||
and :attr:`index` is a Tensor with rank :math:`K` . Thus, :attr:`index` | ||
has shape :math:`[i_0, i_1, ..., i_{K-2}, Q]` where :math:`Q \leq R` . :attr:`updates` |
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.
rank的说法改成ndim吧。
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.
ok, i will fix it.
python/paddle/tensor/manipulation.py
Outdated
|
||
Args: | ||
x (Tensor): The x input. Its dtype should be float32, float64. | ||
index (Tensor): The index input with rank > 1 and index.shape[-1] <= x.rank. |
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.
rank改一下
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.
ok, done.
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
|
||
x = paddle.rand(shape=[3, 5, 9, 10], dtype='float32') | ||
updates = paddle.rand(shape=[3, 9, 10], dtype='float32') | ||
index_data = np.array([[1, 1], |
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.
这里不需要用numpy, 可以直接用to_tensor把list转换为tensor
PR types
Others
PR changes
Docs
Describe
fix the scatter_nd doc
fix the scatter_nd_add doc