Skip to content

Commit

Permalink
Merge pull request ivy-llc#10748 from xoiga123/frontend_jax_dsplit
Browse files Browse the repository at this point in the history
frontend.jax.dsplit
  • Loading branch information
MuhammadSaeedBatikh authored Feb 22, 2023
2 parents d19add5 + d9965fd commit ccf769b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
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,
)

0 comments on commit ccf769b

Please sign in to comment.