Skip to content

Commit

Permalink
Added Conj instance method to Jax Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
RakshitKumar04 committed Apr 24, 2023
1 parent 74d1a05 commit 9cb2581
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ivy/functional/frontends/jax/devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def argmax(
keepdims=keepdims,
)

def conj(self, /):
return jax_frontend.numpy.conj(self._ivy_array)

def __add__(self, other):
return jax_frontend.numpy.add(self, other)

Expand Down
32 changes: 32 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_jax/test_jax_devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,38 @@ def test_jax_devicearray_argmax(
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="jax.numpy.array",
method_name="conj",
dtype_and_x=helpers.dtype_values_axis(
available_dtypes=helpers.get_dtypes("float"),
),
)
def test_jax_devicearray_conj(
dtype_and_x,
on_device,
frontend,
frontend_method_data,
init_flags,
method_flags,
):
input_dtype, x, axis = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={
"object": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={},
frontend=frontend,
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
on_device=on_device,
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="jax.numpy.array",
Expand Down

0 comments on commit 9cb2581

Please sign in to comment.