(self, img_shape)
| 51 | |
| 52 | @parameterized.expand(TEST_CASES) |
| 53 | def test_backward(self, img_shape): |
| 54 | n_dims = len(img_shape[1:]) |
| 55 | x = self.get_data(img_shape) |
| 56 | t = Fourier() |
| 57 | out = t.inv_shift_fourier(x, n_dims) |
| 58 | |
| 59 | expect = torch.fft.ifftn( |
| 60 | torch.fft.ifftshift(x, dim=tuple(range(-n_dims, 0))), dim=tuple(range(-n_dims, 0)) |
| 61 | ).real |
| 62 | |
| 63 | np.testing.assert_allclose(out, expect) |
| 64 | |
| 65 | |
| 66 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected