Add hanning window function (#3124)

This commit is contained in:
willem adnet
2026-02-16 18:44:49 +01:00
committed by GitHub
parent e226af720e
commit 3bbe87e6dc
4 changed files with 50 additions and 0 deletions
+12
View File
@@ -1450,6 +1450,18 @@ class TestOps(mlx_tests.MLXTestCase):
expected = [0]
self.assertListEqual(a.tolist(), expected)
def test_hanning_general(self):
a = mx.hanning(10)
expected = np.hanning(10)
self.assertTrue(np.allclose(a, expected, atol=1e-5))
a = mx.hanning(1)
self.assertEqual(a.item(), 1.0)
a = mx.hanning(0)
self.assertEqual(a.size, 0)
self.assertEqual(a.dtype, mx.float32)
def test_unary_ops(self):
def test_ops(npop, mlxop, x, y, atol, rtol):
r_np = npop(x)