Skip to content

Commit

Permalink
feat(paddle frontend): added repeat_interleave (ivy-llc#23139)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhanush-2501 authored Sep 7, 2023
1 parent a6aac6c commit 7cda0c8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ivy/functional/frontends/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ def gather(params, indices, axis=-1, batch_dims=0, name=None):
return ivy.gather(params, indices, axis=axis, batch_dims=batch_dims)


@with_supported_dtypes(
{"2.5.1 and below": ("int32", "int64", "float32", "float64")},
"paddle",
)
@to_ivy_arrays_and_back
def repeat_interleave(x, repeats, axis=None, name=None):
return ivy.repeat(x, repeats, axis=axis)


@to_ivy_arrays_and_back
def reshape(x, shape):
return ivy.reshape(x, shape)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from ivy_tests.test_ivy.test_functional.test_experimental.test_core.test_manipulation import ( # noqa
_get_dtype_values_k_axes_for_rot90,
)
from ivy_tests.test_ivy.test_frontends.test_torch.test_miscellaneous_ops import (
_get_repeat_interleaves_args,
)


# --- Helpers --- #
Expand Down Expand Up @@ -445,6 +448,40 @@ def test_paddle_gather(
)


# repeat_interleave
@handle_frontend_test(
fn_tree="paddle.repeat_interleave",
dtype_values_repeats_axis_output_size=_get_repeat_interleaves_args(
available_dtypes=helpers.get_dtypes("numeric"),
valid_axis=True,
max_num_dims=4,
max_dim_size=4,
),
)
def test_paddle_repeat_interleave(
*,
dtype_values_repeats_axis_output_size,
on_device,
fn_tree,
frontend,
test_flags,
backend_fw,
):
dtype, values, repeats, axis, _ = dtype_values_repeats_axis_output_size

helpers.test_frontend_function(
input_dtypes=[dtype[0][0], dtype[1][0]],
backend_to_test=backend_fw,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
x=values[0],
repeats=repeats[0],
axis=axis,
)


# Tests #
# ----- #

Expand Down

0 comments on commit 7cda0c8

Please sign in to comment.