Skip to content

Commit

Permalink
feat: Implement ifft2 in numpy frontend and close #26773 (#26775)
Browse files Browse the repository at this point in the history
  • Loading branch information
DirectriX01 authored Oct 9, 2023
1 parent 02b6a74 commit e481e63
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ def ifft(a, n=None, axis=-1, norm=None):
return ivy.ifft(a, axis, norm=norm, n=n)


@with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
@to_ivy_arrays_and_back
def ifft2(a, s=None, axes=(-2, -1), norm=None):
a = ivy.asarray(a, dtype=ivy.complex128)
a = ivy.ifftn(a, s=s, axes=axes, norm=norm)
return a


@with_unsupported_dtypes({"1.24.3 and below": ("float16",)}, "numpy")
@to_ivy_arrays_and_back
def ifftn(a, s=None, axes=None, norm=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,27 @@ def test_numpy_ifft(dtype_and_x, backend_fw, frontend, test_flags, fn_tree, on_d
)


@handle_frontend_test(
fn_tree="numpy.fft.ifft2",
dtype_and_x=_x_and_ifft(),
)
def test_numpy_ifft2(dtype_and_x, backend_fw, frontend, test_flags, fn_tree, on_device):
input_dtype, x, dim, norm, n = dtype_and_x
helpers.test_frontend_function(
input_dtypes=input_dtype,
frontend=frontend,
backend_to_test=backend_fw,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
test_values=True,
a=x,
s=None,
axes=None,
norm=norm,
)


@handle_frontend_test(
fn_tree="numpy.fft.ifftn",
dtype_and_x=_x_and_ifft(),
Expand Down

0 comments on commit e481e63

Please sign in to comment.