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

frontend.jax.dsplit #10748

Merged
merged 2 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions ivy/functional/frontends/jax/numpy/manipulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,8 @@ def atleast_2d(*arys):
@to_ivy_arrays_and_back
def squeeze(a, axis=None):
return ivy.squeeze(a, axis)


@to_ivy_arrays_and_back
def dsplit(ary, indices_or_section):
return ivy.dsplit(ary, indices_or_section)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import ivy_tests.test_ivy.helpers as helpers
from ivy_tests.test_ivy.helpers import handle_frontend_test
import ivy_tests.test_ivy.test_frontends.test_numpy.helpers as np_frontend_helpers
from ivy_tests.test_ivy.test_functional.test_experimental.test_core.test_manipulation import ( # noqa
_get_split_locations,
)


@st.composite
Expand Down Expand Up @@ -757,3 +760,35 @@ def test_jax_numpy_squeeze(
a=values[0],
axis=axis,
)


# dsplit
@handle_frontend_test(
fn_tree="jax.numpy.dsplit",
dtype_value=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
shape=st.shared(helpers.get_shape(min_num_dims=3), key="value_shape"),
),
indices_or_sections=_get_split_locations(min_num_dims=3, axis=2),
number_positional_args=st.just(2),
test_with_out=st.just(False),
)
def test_jax_numpy_dsplit(
*,
dtype_value,
indices_or_sections,
on_device,
fn_tree,
frontend,
test_flags,
):
input_dtype, value = dtype_value
helpers.test_frontend_function(
input_dtypes=input_dtype,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
ary=value[0],
indices_or_sections=indices_or_sections,
)