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

fix: paddle backend scatter_nd indices error and test #28552

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ivy/functional/backends/paddle/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# local
import ivy
import ivy.functional.backends.paddle as paddle_backend
from ivy.func_wrapper import with_unsupported_device_and_dtypes
from ivy.func_wrapper import with_unsupported_device_and_dtypes, with_unsupported_dtypes
from ivy.functional.ivy.general import _broadcast_to
from ivy.utils.exceptions import _check_inplace_update_support
from . import backend_version
Expand Down Expand Up @@ -458,6 +458,9 @@ def scatter_flat(
)


@with_unsupported_dtypes(
{"2.15.0 and below": ("uint8", "int8", "int16", "float16")}, backend_version
)
def scatter_nd(
indices: paddle.Tensor,
updates: paddle.Tensor,
Expand Down Expand Up @@ -532,9 +535,6 @@ def scatter_nd(
updates = ivy.maximum(ivy.gather_nd(target, indices), updates).data
elif reduction == "sum":
updates = ivy.add(ivy.gather_nd(target, indices), updates).data
if indices.ndim <= 1:
indices = ivy.expand_dims(indices, axis=0).data
updates = ivy.expand_dims(updates, axis=0).data
updates_ = _broadcast_to(ivy.gather_nd(target, indices), expected_shape).data
target_dtype = target.dtype
if target_dtype in [
Expand Down
Loading