Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix fft when any of the input dimensions is not aligned#6118

Merged
ezyang merged 7 commits into
pytorch:masterfrom
ssnl:mkl_fft_strides
Apr 10, 2018
Merged

Fix fft when any of the input dimensions is not aligned#6118
ezyang merged 7 commits into
pytorch:masterfrom
ssnl:mkl_fft_strides

Conversation

@ssnl
Copy link
Copy Markdown
Collaborator

@ssnl ssnl commented Mar 29, 2018

Discovered this bug while looking into the test fail @colesbury saw. In C2C or C2R transform, when any of the input dimension is not aligned to complex type (stride % 2 != 0), the third party library calls give incorrect results. Added those checks and tests for this.

Added test for ifft+fft == identity. Empirically this only increased test time by 0.1s.

@ezyang

Comment thread test/test_torch.py Outdated

This comment was marked as off-topic.

This comment was marked as off-topic.

ezyang
ezyang previously requested changes Mar 30, 2018

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@ssnl
Copy link
Copy Markdown
Collaborator Author

ssnl commented Apr 2, 2018

Addressed @ezyang 's comments.

I still couldn't believe that this is my first experience with optional and my first version just compiled without error. :O

@ssnl ssnl force-pushed the mkl_fft_strides branch 5 times, most recently from 6d60b71 to 8c80373 Compare April 3, 2018 21:15
@ssnl ssnl force-pushed the mkl_fft_strides branch from 934fed8 to 62736c6 Compare April 4, 2018 22:13
@ssnl
Copy link
Copy Markdown
Collaborator Author

ssnl commented Apr 4, 2018

@pytorchbot retest this please

1 similar comment
@ssnl
Copy link
Copy Markdown
Collaborator Author

ssnl commented Apr 5, 2018

@pytorchbot retest this please

@ssnl ssnl force-pushed the mkl_fft_strides branch from 62736c6 to 878b8fb Compare April 5, 2018 15:05
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Apr 5, 2018

@pytorchbot retest this please

@ssnl
Copy link
Copy Markdown
Collaborator Author

ssnl commented Apr 5, 2018

@pytorchbot retest this please

1 similar comment
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Apr 5, 2018

@pytorchbot retest this please

//
// input[x, y, z] = input[((x * inembed[1] + y) * inembed[2] + z)]
//
// Above is the simplified the formulate ignoring the batch dimension. In fact,

This comment was marked as off-topic.

// X[m, \omega] = X[m, N - \omega]*. We return only the first floor(N / 2) + 1
// values by default (onesided=True). This is also the assumption in libraries
// including cuFFT and MKL.
// [ NOTE ] Fourier Transform Congjugate Symmetry

This comment was marked as off-topic.

This comment was marked as off-topic.

@ezyang ezyang merged commit 930f181 into pytorch:master Apr 10, 2018
@ssnl ssnl deleted the mkl_fft_strides branch April 10, 2018 17:19
ssnl added a commit to ssnl/pytorch that referenced this pull request Apr 10, 2018
ssnl added a commit that referenced this pull request Apr 11, 2018
* change irfft signal_sizes arg to be the last

* add docs for fft, ifft, rfft, irfft; update doc for stft

* fix typo in window function docs

* improve gradcheck error message

* implement backward of fft, ifft, rfft, irfft

* add grad tests for fft, ifft, rfft, irfft

* fix nits and typos from #6118

* address comments
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
* fix fft when any of the input dimensions is not like complex type; add test for ifft+fft

* clarify the comments

* Address comments: add note; add helper function

* use at::nullopt

* add notes on conjugate symmetry; fix complex-to-real cloning condition (should be advanced data layout rather than base_istride)

* add at::sum_intlist and at::prod_intlist

* revert optional<vector> helper due to windows compiler error
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
* change irfft signal_sizes arg to be the last

* add docs for fft, ifft, rfft, irfft; update doc for stft

* fix typo in window function docs

* improve gradcheck error message

* implement backward of fft, ifft, rfft, irfft

* add grad tests for fft, ifft, rfft, irfft

* fix nits and typos from pytorch#6118

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants