# FFT2 Input range

**URL:** <https://discuss.pytorch.org/t/fft2-input-range/155241>\
**Category:** complex\
**Created:** [June 28, 2022, 10:10am UTC](https://discuss.pytorch.org/t/fft2-input-range/155241 "2022-06-28T10:10:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![callbarian](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/callbarian/32/50933_2.png) [@callbarian](https://discuss.pytorch.org/u/callbarian)\
**Post date:** [June 28, 2022, 10:10am UTC](https://discuss.pytorch.org/t/fft2-input-range/155241/1 "2022-06-28T10:10:47Z")

</div>

According to the document [1.8.0-fft2](https://pytorch.org/docs/1.8.0/fft.html),  
two ffts and fft2 should be allclose

It is true when input range is 0~1.  
When input range is above 1 (ex.0~25), first row and first column are allclose but the rest of them are not.  
Is there a precision issue on this? output differs in e-07 range.

Tested as below

in\_tensor = torch.arange(25).view(5,5)  
print(torch.allclose(torch.fft.fft(torch.fft.fft(in\_tensor, dim=0), dim=1), torch.fft.fft2(in\_tensor)))  
-False  
in\_tensor = torch.rand(25).view(5,5)  
print(torch.allclose(torch.fft.fft(torch.fft.fft(in\_tensor, dim=0), dim=1), torch.fft.fft2(in\_tensor)))  
-True
