Add the hamming window function (#3135)

This commit is contained in:
willem adnet
2026-02-17 00:56:05 -08:00
committed by GitHub
parent 3bbe87e6dc
commit 360639c2df
4 changed files with 60 additions and 0 deletions
+12
View File
@@ -1462,6 +1462,18 @@ class TestOps(mlx_tests.MLXTestCase):
self.assertEqual(a.size, 0)
self.assertEqual(a.dtype, mx.float32)
def test_hamming_general(self):
a = mx.hamming(10)
expected = np.hamming(10)
self.assertTrue(np.allclose(a, expected, atol=1e-5))
a = mx.hamming(1)
self.assertEqual(a.item(), 1.0)
a = mx.hamming(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)