Skip to content

Commit

Permalink
feat: add kaiser_window to pytorch frontend (ivy-llc#26788)
Browse files Browse the repository at this point in the history
Co-authored-by: Sam Armstrong <[email protected]>
  • Loading branch information
Mainakdeb and Sam-Armstrong authored Oct 13, 2023
1 parent 581a92d commit 9c52b46
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ivy/functional/frontends/torch/spectral_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,18 @@ def blackman_window(
requires_grad=False
):
return ivy.blackman_window(window_length, periodic=periodic, dtype=dtype)


@to_ivy_arrays_and_back
@with_supported_dtypes({"2.51.0 and below": ("float32", "float64")}, "torch")
def kaiser_window(
window_length,
periodic=True,
beta=12.0,
*,
dtype=None,
layout=None,
device=None,
requires_grad=False
):
return ivy.kaiser_window(window_length, periodic=periodic, beta=beta, dtype=dtype)
35 changes: 35 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_torch/test_spectral_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,38 @@ def test_torch_blackman_window(
rtol=1e-02,
atol=1e-02,
)


@handle_frontend_test(
window_length=helpers.ints(min_value=1, max_value=100),
dtype=helpers.get_dtypes("float", full=False),
fn_tree="torch.kaiser_window",
periodic=st.booleans(),
beta=helpers.floats(min_value=1, max_value=20),
)
def test_torch_kaiser_window(
*,
window_length,
dtype,
periodic,
beta,
on_device,
fn_tree,
frontend,
backend_fw,
test_flags,
):
helpers.test_frontend_function(
input_dtypes=[],
on_device=on_device,
frontend=frontend,
backend_to_test=backend_fw,
test_flags=test_flags,
fn_tree=fn_tree,
window_length=window_length,
periodic=periodic,
beta=beta,
dtype=dtype[0],
rtol=1e-02,
atol=1e-02,
)

0 comments on commit 9c52b46

Please sign in to comment.