Skip to content

Commit

Permalink
reshape_ manipulation added to paddle frontend (ivy-llc#22098)
Browse files Browse the repository at this point in the history
  • Loading branch information
shashi278 authored and arshPratap committed Sep 11, 2023
1 parent 6db6c8e commit 811ddb2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ivy/functional/frontends/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ def reshape(x, shape):
return ivy.reshape(x, shape)


@with_unsupported_dtypes(
{"2.5.1 and below": ("int8", "uint8", "int16", "uint16", "float16", "bfloat16")},
"paddle",
)
@to_ivy_arrays_and_back
def reshape_(x, shape):
ret = ivy.reshape(x, shape)
ivy.inplace_update(x, ret)
return x


@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
@to_ivy_arrays_and_back
def abs(x, name=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ def dtypes_x_reshape(draw):
return dtypes, x, shape


@st.composite
def dtypes_x_reshape_(draw):
shape = draw(helpers.get_shape(min_num_dims=1))
dtypes, x = draw(
helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("numeric"),
shape=shape,
)
)
return dtypes, x, shape


# Tests #
# ----- #

Expand Down Expand Up @@ -62,6 +74,33 @@ def test_paddle_reshape(
)


# reshape_
@handle_frontend_test(
fn_tree="paddle.reshape_",
dtypes_x_reshape=dtypes_x_reshape_(),
)
def test_paddle_reshape_(
*,
dtypes_x_reshape,
on_device,
fn_tree,
frontend,
test_flags,
backend_fw,
):
input_dtype, x, shape = dtypes_x_reshape
helpers.test_frontend_function(
input_dtypes=input_dtype,
backend_to_test=backend_fw,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
x=x[0],
shape=shape,
)


# abs
@handle_frontend_test(
fn_tree="paddle.abs",
Expand Down

0 comments on commit 811ddb2

Please sign in to comment.