From 7c1deca16f0198c56fe3ca8d1462e683abd04379 Mon Sep 17 00:00:00 2001 From: Ti-Tai Wang Date: Fri, 13 Jun 2025 21:47:09 +0000 Subject: [PATCH 1/3] fix ci --- tests/eager_test.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/eager_test.py b/tests/eager_test.py index a39a455f36..eccc89fe76 100644 --- a/tests/eager_test.py +++ b/tests/eager_test.py @@ -157,13 +157,14 @@ def test_dft_cfft_last_axis(self): x = _complex2float(c) for s in (4, 5, 6): le = np.array([s], dtype=np.int64) + le_int = int(le[0]) we = np.array([1] * le[0], dtype=np.float32) expected1 = _fft(c, le) expected2 = _cfft(x, le) np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=list(le), + le=list(le_int), expected_shape=expected1.shape, weights=we, ): @@ -187,12 +188,13 @@ def test_dft_rfft(self, x_, s: int): x = x_[..., np.newaxis] le = np.array([s], dtype=np.int64) + le_int = int(le[0]) for ax in range(len(x_.shape)): expected = _fft(x_, le, axis=ax) nax = np.array([ax], dtype=np.int64) with self.subTest( x_shape=x.shape, - le=list(le), + le=list(le_int), ax=ax, expected_shape=expected.shape, ): @@ -223,6 +225,7 @@ def test_dft_cfft(self, x, y): x = _complex2float(c) for s in (4, 5, 6): le = np.array([s], dtype=np.int64) + le_int = int(le[0]) for ax in range(len(c.shape)): nax = np.array([ax], dtype=np.int64) expected1 = _fft(c, le, axis=ax) @@ -230,7 +233,7 @@ def test_dft_cfft(self, x, y): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=list(le), + le=list(le_int), ax=ax, expected_shape=expected1.shape, ): @@ -251,12 +254,13 @@ def test_dft_rifft(self, x_): x = x_[..., np.newaxis] for s in (4, 5, 6): le = np.array([s], dtype=np.int64) + le_int = int(le[0]) for ax in range(len(x_.shape)): expected = _ifft(x_, le, axis=ax) nax = np.array([ax], dtype=np.int64) with self.subTest( x_shape=x.shape, - le=list(le), + le=list(le_int), ax=str(ax), expected_shape=expected.shape, ): @@ -288,6 +292,7 @@ def test_dft_cifft(self, x, y): x = _complex2float(c) for s in (4, 5, 6): le = np.array([s], dtype=np.int64) + le_int = int(le[0]) for ax in range(len(c.shape)): nax = np.array([ax], dtype=np.int64) expected1 = _ifft(c, le, axis=ax) @@ -295,7 +300,7 @@ def test_dft_cifft(self, x, y): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=list(le), + le=list(le_int), ax=str(ax), expected_shape=expected1.shape, ): From 53a709e9274250dcf7e996952354479d9063704e Mon Sep 17 00:00:00 2001 From: Ti-Tai Wang Date: Fri, 13 Jun 2025 22:00:03 +0000 Subject: [PATCH 2/3] fix --- tests/eager_test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/eager_test.py b/tests/eager_test.py index eccc89fe76..394e8d85dc 100644 --- a/tests/eager_test.py +++ b/tests/eager_test.py @@ -164,7 +164,7 @@ def test_dft_cfft_last_axis(self): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=list(le_int), + le=[le_int], expected_shape=expected1.shape, weights=we, ): @@ -194,7 +194,7 @@ def test_dft_rfft(self, x_, s: int): nax = np.array([ax], dtype=np.int64) with self.subTest( x_shape=x.shape, - le=list(le_int), + le=[le_int], ax=ax, expected_shape=expected.shape, ): @@ -233,7 +233,7 @@ def test_dft_cfft(self, x, y): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=list(le_int), + le=[le_int], ax=ax, expected_shape=expected1.shape, ): @@ -260,7 +260,7 @@ def test_dft_rifft(self, x_): nax = np.array([ax], dtype=np.int64) with self.subTest( x_shape=x.shape, - le=list(le_int), + le=[le_int], ax=str(ax), expected_shape=expected.shape, ): @@ -300,7 +300,7 @@ def test_dft_cifft(self, x, y): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=list(le_int), + le=[le_int], ax=str(ax), expected_shape=expected1.shape, ): From c458b440627ff41265e6c803b6a65a7996e19fad Mon Sep 17 00:00:00 2001 From: Ti-Tai Wang Date: Fri, 13 Jun 2025 22:12:28 +0000 Subject: [PATCH 3/3] use tolist() --- tests/eager_test.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/eager_test.py b/tests/eager_test.py index 394e8d85dc..e8dd5c2e74 100644 --- a/tests/eager_test.py +++ b/tests/eager_test.py @@ -157,16 +157,15 @@ def test_dft_cfft_last_axis(self): x = _complex2float(c) for s in (4, 5, 6): le = np.array([s], dtype=np.int64) - le_int = int(le[0]) we = np.array([1] * le[0], dtype=np.float32) expected1 = _fft(c, le) expected2 = _cfft(x, le) np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=[le_int], + le=le.tolist(), expected_shape=expected1.shape, - weights=we, + weights=we.tolist(), ): case = onnx_script_test_case.FunctionTestParams( signal_dft.dft_last_axis, [x, le, False], [expected1] @@ -188,13 +187,12 @@ def test_dft_rfft(self, x_, s: int): x = x_[..., np.newaxis] le = np.array([s], dtype=np.int64) - le_int = int(le[0]) for ax in range(len(x_.shape)): expected = _fft(x_, le, axis=ax) nax = np.array([ax], dtype=np.int64) with self.subTest( x_shape=x.shape, - le=[le_int], + le=le.tolist(), ax=ax, expected_shape=expected.shape, ): @@ -225,7 +223,6 @@ def test_dft_cfft(self, x, y): x = _complex2float(c) for s in (4, 5, 6): le = np.array([s], dtype=np.int64) - le_int = int(le[0]) for ax in range(len(c.shape)): nax = np.array([ax], dtype=np.int64) expected1 = _fft(c, le, axis=ax) @@ -233,7 +230,7 @@ def test_dft_cfft(self, x, y): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=[le_int], + le=le.tolist(), ax=ax, expected_shape=expected1.shape, ): @@ -254,13 +251,12 @@ def test_dft_rifft(self, x_): x = x_[..., np.newaxis] for s in (4, 5, 6): le = np.array([s], dtype=np.int64) - le_int = int(le[0]) for ax in range(len(x_.shape)): expected = _ifft(x_, le, axis=ax) nax = np.array([ax], dtype=np.int64) with self.subTest( x_shape=x.shape, - le=[le_int], + le=le.tolist(), ax=str(ax), expected_shape=expected.shape, ): @@ -292,7 +288,6 @@ def test_dft_cifft(self, x, y): x = _complex2float(c) for s in (4, 5, 6): le = np.array([s], dtype=np.int64) - le_int = int(le[0]) for ax in range(len(c.shape)): nax = np.array([ax], dtype=np.int64) expected1 = _ifft(c, le, axis=ax) @@ -300,7 +295,7 @@ def test_dft_cifft(self, x, y): np.testing.assert_allclose(expected1, expected2) with self.subTest( c_shape=c.shape, - le=[le_int], + le=le.tolist(), ax=str(ax), expected_shape=expected1.shape, ):