Skip to content

Commit

Permalink
Added Conj instance method to NumPy frontnend (ivy-llc#15085)
Browse files Browse the repository at this point in the history
  • Loading branch information
RakshitKumar04 committed May 9, 2023
1 parent 2a5d55b commit d29d0ca
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ivy/functional/frontends/numpy/ndarray/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,27 @@ def clip(
dtype=dtype,
subok=subok,
)

def conj(
self,
/,
out=None,
*,
where=True,
casting="same_kind",
order="K",
dtype=None,
subok=True,
):
return np_frontend.conj(
self.ivy_array,
out=out,
where=where,
casting=casting,
order=order,
dtype=dtype,
subok=subok,
)

def cumprod(self, *, axis=None, dtype=None, out=None):
return np_frontend.cumprod(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,38 @@ def test_numpy_instance_clip(
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="numpy.array",
method_name="conj",
dtype_and_x=helpers.dtype_values_axis(
available_dtypes=helpers.get_dtypes("real_and_complex"),
),
)
def test_numpy_ndarray_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="numpy.array",
Expand Down

0 comments on commit d29d0ca

Please sign in to comment.