Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add centered FFT example to fftshift docs #51223

Closed
wants to merge 1 commit into from

Conversation

peterbell10
Copy link
Collaborator

Closes #51022

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jan 27, 2021

💊 CI failures summary and remediations

As of commit a35097b (more details on the Dr. CI page):


  • 1/2 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)
  • 1/2 broken upstream at merge base dd1a97b on Jan 27 from 12:00pm to 12:57pm

🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

If your commit is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

Check out the recency history of this "viable master" tracking branch.


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

>>> torch.fftshift(f)
tensor([-0.5000, -0.2500, 0.0000, 0.2500])
>>> torch.fft.fftshift(f)
tensor([-0.5000, -0.2500, 0.0000, 0.2500])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found these discrepancies from running the doctests manually. So, it seems fft doctests aren't being run in CI.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix.

@@ -865,6 +865,10 @@
Reorders n-dimensional FFT data, as provided by :func:`~torch.fft.fftn`, to have
negative frequency terms first.

This performs a periodic shift of n-dimensional data such that the origin
``(0, ..., 0)`` is moved to the center of the tensor. Specifically,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

"Specifically, ..." -> "Specifically, to ..." to make the second sentence parallel to the first.

>>> fft_centered = torch.fft.fftshift(fft_uncentered)

The inverse transform, from centered Fourier space back to centered spatial
data, is simply applying the inverse shifts in reverse order:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: "is simply applying" -> "can be performed by applying"

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a couple suggestions for your review @peterbell10. If they're helpful, great, and if not no worries. Just ping me when you'd like this merged.

@peterbell10
Copy link
Collaborator Author

@mruberry I've added your suggestions.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in 9fe7c06.

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.

Update fftshift, roll, and ifftshift documentation
3 participants