Skip to content

Commit

Permalink
put_along_axis commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bilal-aamer committed Aug 15, 2023
1 parent 74c13af commit 19bde5c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ivy/functional/frontends/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,19 @@ def take_along_axis(arr, indices, axis):
@to_ivy_arrays_and_back
def rot90(x, k=1, axes=(0, 1), name=None):
return ivy.rot90(x, k=k, axes=axes)


@with_supported_dtypes(
{
"2.5.1 and below": (
"int32",
"int64",
"float32",
"float64",
)
},
"paddle",
)
@to_ivy_arrays_and_back
def put_along_axis(arr, indices, values, axis, reduce="assign"):
return ivy.put_along_axis(arr, indices, values, axis)
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,40 @@ def test_paddle_rot90(
k=k,
axes=tuple(axes),
)


# put_along_axis
@handle_frontend_test(
fn_tree="numpy.put_along_axis",
dtype_x_indices_axis=helpers.array_indices_put_along_axis(
array_dtypes=helpers.get_dtypes(kind="valid"),
indices_dtypes=["int32", "int64"],
min_num_dims=1,
max_num_dims=5,
min_dim_size=1,
max_dim_size=10,
),
test_with_out=st.just(False),
)
def test_numpy_put_along_axis(
*,
dtype_x_indices_axis,
test_flags,
frontend,
fn_tree,
on_device,
backend_fw,
):
dtypes, x, indices, axis, values, _ = dtype_x_indices_axis
helpers.test_frontend_function(
input_dtypes=dtypes,
test_flags=test_flags,
backend_to_test=backend_fw,
frontend=frontend,
fn_tree=fn_tree,
on_device=on_device,
arr=x,
indices=indices,
axis=axis,
values=values,
)

0 comments on commit 19bde5c

Please sign in to comment.