Skip to content

Commit

Permalink
ivy-llc#12400 Added conj to ivy frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
RakshitKumar04 committed Apr 6, 2023
1 parent a14385d commit c2677cb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ivy/functional/frontends/numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def promote_types_of_numpy_inputs(
from ivy.functional.frontends.numpy.mathematical_functions.handling_complex_numbers import (
_imag,
_real,
_conj,
)

from ivy.functional.frontends.numpy.mathematical_functions.hyperbolic_functions import (
Expand Down Expand Up @@ -679,3 +680,4 @@ def promote_types_of_numpy_inputs(
fmax = ufunc("_fmax")
ldexp = ufunc("_ldexp")
floor = ufunc("_floor")
conj = ufunc("_conj")
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ def _imag(val):
@to_ivy_arrays_and_back
def _real(val):
return ivy.real(val)


@to_ivy_arrays_and_back
def _conj(val):
return ivy.conj(val)
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,48 @@ def test_numpy_real(
on_device=on_device,
val=x[0],
)


# conj
@handle_frontend_test(
fn_tree = "numpy.conj",
dtype_and_x = helpers.dtype_and_values(
available_dtypes = helpers.get_dtypes("complex")
),
test_with_out = st.just(False),
)
def test_numpy_conj(
dtype_and_x,
frontend,
test_flags,
fn_tree,
on_device,
out,
where,
casting,
order,
dtype,
subok,
signature,
extobj,
):
input_dtypes, x = dtype_and_x
kwargs = {
"out": out,
"where": where,
"casting": casting,
"order": order,
"dtype": dtype,
"subok": subok,
"signature": signature,
"extobj": extobj,
}
helpers.test_frontend_function(
input_dtypes = input_dtypes,
frontend = frontend,
test_flags = test_flags,
fn_tree = fn_tree,
on_device = on_device,
val = x[0],
**kwargs
)

0 comments on commit c2677cb

Please sign in to comment.