diff --git a/tests/test_3d/test_forward_3d.py b/tests/test_3d/test_forward_3d.py index 0115f9c..45484aa 100644 --- a/tests/test_3d/test_forward_3d.py +++ b/tests/test_3d/test_forward_3d.py @@ -1,6 +1,7 @@ import numpy as np import pytest import torch +torch.manual_seed(0) import pytorch_finufft @@ -13,8 +14,6 @@ 25, 26, 37, - 100, - 101, ] @@ -106,8 +105,13 @@ def test_t1_forward_CPU(N: int) -> None: (N, N, N), ) - against_torch = torch.fft.fft2(values.reshape(g[0].shape)) + against_torch = torch.fft.fftn(values.reshape(g[0].shape)) - assert abs((finufft_out - against_torch).sum()) / N**3 == pytest.approx( - 0, abs=1e-6 - ) + abs_errors = torch.abs(finufft_out - against_torch) + l_inf_error = abs_errors.max() + l_2_error = torch.sqrt(torch.sum(abs_errors**2)) + l_1_error = torch.sum(abs_errors) + + assert l_inf_error < 1.5e-5 * N ** 1.5 + assert l_2_error < 1e-5 * N ** 3 + assert l_1_error < 1e-5 * N ** 4.5 \ No newline at end of file