Skip to content

Commit 8037d56

Browse files
committed
FFT: finish up the dir(np.fft) contents
1 parent e71ce13 commit 8037d56

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

torch_np/fft.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,23 @@ def hfft(a: ArrayLike, n=None, axis=-1, norm=None):
106106
@upcast
107107
def ihfft(a: ArrayLike, n=None, axis=-1, norm=None):
108108
return torch.fft.ihfft(a, n, dim=axis, norm=norm)
109+
110+
111+
@normalizer
112+
def fftfreq(n, d=1.0):
113+
return torch.fft.fftfreq(n, d)
114+
115+
116+
@normalizer
117+
def rfftfreq(n, d=1.0):
118+
return torch.fft.rfftfreq(n, d)
119+
120+
121+
@normalizer
122+
def fftshift(x: ArrayLike, axes=None):
123+
return torch.fft.fftshift(x, axes)
124+
125+
126+
@normalizer
127+
def ifftshift(x: ArrayLike, axes=None):
128+
return torch.fft.ifftshift(x, axes)

torch_np/tests/numpy_tests/fft/test_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_uneven_dims(self):
8585

8686
def test_equal_to_original(self):
8787
""" Test that the new (>=v1.15) implementation (see #10073) is equal to the original (<=v1.14) """
88-
from numpy.core import asarray, concatenate, arange, take
88+
from torch_np import asarray, concatenate, arange, take
8989

9090
def original_fftshift(x, axes=None):
9191
""" How fftshift was implemented in v1.14"""

0 commit comments

Comments
 (0)