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

Implemented moveaxis function for paddle frontend #21840

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a35998e
Implemented moveaxis function for paddle frontend
Gauravpadam Aug 14, 2023
5595983
Merge branch 'main' into gaurav-moveaxis
Gauravpadam Aug 14, 2023
f403b64
Fixed tests
Gauravpadam Aug 15, 2023
c2e07cc
Tests fixed
Gauravpadam Aug 15, 2023
0f1ed1d
Merge branch 'gaurav-moveaxis' of https://github.com/Gauravpadam/ivy …
Gauravpadam Aug 15, 2023
886ba14
Tests fixed
Gauravpadam Aug 15, 2023
32554ec
Merge branch 'gaurav-moveaxis' of https://github.com/Gauravpadam/ivy …
Gauravpadam Aug 15, 2023
fd8ba0e
Testcases
Gauravpadam Aug 15, 2023
4da0f2a
Merge branch 'gaurav-moveaxis' of https://github.com/Gauravpadam/ivy …
Gauravpadam Aug 15, 2023
02de958
Some more set of fixes
Gauravpadam Aug 15, 2023
242d048
smaller set of fixes
Gauravpadam Aug 15, 2023
ac33de8
Amendments to function
Gauravpadam Aug 15, 2023
91b3464
Test fixes
Gauravpadam Aug 15, 2023
8ee5bdf
Merge branch 'gaurav-moveaxis' of https://github.com/Gauravpadam/ivy …
Gauravpadam Aug 16, 2023
0b654a2
Smaller set of fixes and reformatting
Gauravpadam Aug 16, 2023
753caf9
Merge branch 'gaurav-moveaxis' of https://github.com/Gauravpadam/ivy …
Gauravpadam Aug 16, 2023
43fee9f
Final fixes
Gauravpadam Aug 16, 2023
7c5af44
Merge branch 'gaurav-moveaxis' of https://github.com/Gauravpadam/ivy …
Gauravpadam Aug 16, 2023
bef37e1
Some more set of fixes
Gauravpadam Aug 16, 2023
57fe1e8
Force exclude bfloat16
Gauravpadam Aug 16, 2023
1972075
Another attempt to remove bfloat16
Gauravpadam Aug 16, 2023
b774131
Fixed
Gauravpadam Aug 16, 2023
ab21e88
Another attempt to fix bfloat16
Gauravpadam Aug 16, 2023
257a620
Changed above to below
Gauravpadam Aug 16, 2023
9be44f6
Formatting
Gauravpadam Aug 16, 2023
1185c02
Formatting
Gauravpadam Aug 16, 2023
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: 8 additions & 0 deletions ivy/functional/backends/paddle/experimental/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
]


@with_unsupported_device_and_dtypes(
{
"2.5.1 and above": {
"cpu": ("bfloat16", "uint8")
},
},
backend_version,
)
def moveaxis(
a: paddle.Tensor,
source: Union[int, Sequence[int]],
Expand Down
22 changes: 22 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,25 @@ 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_device_and_dtypes(
{
"2.5.1 and below": {
"cpu": (
"bool",
"float16",
"float32",
"float64",
"int32",
"int64",
"complex64",
"complex128",
)
},
},
"paddle",
)
@to_ivy_arrays_and_back
def moveaxis(x, source, destination, name=None):
return ivy.moveaxis(x, source, destination)
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,59 @@ def test_paddle_rot90(
k=k,
axes=tuple(axes),
)


@st.composite
def _moveaxis_helper(draw, **kwargs):
dtypes, a, shape = draw(helpers.dtype_and_values(**kwargs, ret_shape=True))

source = draw(
st.lists(
helpers.ints(min_value=0, max_value=len(shape) - 1),
min_size=len(shape),
max_size=len(shape),
unique=True,
)
)
destination = draw(
st.lists(
helpers.ints(min_value=0, max_value=len(shape) - 1),
min_size=len(shape),
max_size=len(shape),
unique=True,
)
)

return dtypes, a, source, destination


@handle_frontend_test(
fn_tree="paddle.moveaxis", # This is the function we are testing against
dtype_and_params=_moveaxis_helper(
available_dtypes=helpers.get_dtypes("float"),
min_num_dims=1,
min_dim_size=1,
),
)
def test_paddle_moveaxis(
# Parameters for the test
*,
dtype_and_params,
frontend,
test_flags,
fn_tree,
backend_fw,
on_device,
):
input_dtype, a, source, destination = dtype_and_params
helpers.test_frontend_function(
input_dtypes=input_dtype,
backend_to_test=backend_fw,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
x=a[0],
source=source,
destination=destination,
on_device=on_device,
)
Loading