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

Jax devicearray T #19363

Merged
merged 6 commits into from
Jul 13, 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
4 changes: 4 additions & 0 deletions ivy/functional/frontends/jax/devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def shape(self):
def at(self):
return jax_frontend._src.numpy.lax_numpy._IndexUpdateHelper(self.ivy_array)

@property
def T(self):
return self.ivy_array.T

# Instance Methods #
# ---------------- #

Expand Down
24 changes: 24 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_jax/test_devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ def test_jax_devicearray_property_shape(
assert x.shape == shape


@st.composite
def _transpose_helper(draw):
dtype_x = draw(
helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid", prune_function=False),
min_num_dims=2,
max_num_dims=2,
min_dim_size=2,
)
)

_, data = dtype_x
x = data[0]
xT = np.transpose(x)
return x, xT


@given(x_transpose=_transpose_helper())
def test_jax_devicearray_property_T(x_transpose):
x, xT = x_transpose
x = DeviceArray(x)
assert np.array_equal(x.T, xT)


@st.composite
def _at_helper(draw):
_, data, shape = draw(
Expand Down