Skip to content

Chain rules for FFT plans via AdjointPlans#67

Merged
devmotion merged 28 commits intoJuliaMath:masterfrom
gaurav-arya:adjoint
Jul 5, 2023
Merged

Chain rules for FFT plans via AdjointPlans#67
devmotion merged 28 commits intoJuliaMath:masterfrom
gaurav-arya:adjoint

Conversation

@gaurav-arya
Copy link
Copy Markdown
Contributor

@gaurav-arya gaurav-arya commented Jun 6, 2022

An rfft can be written as PF where F is the n x n Fourier transform and P is a projection operator that removes the redundant information due to conjuagate symmetry. Because of P, the adjoint of real FFTs (real inverse FFTs) require a special scaling before (after) applying the backwards transformation. As discussed in #63 this motivates supporting the Base.adjoint operation for plans to simplify the writing of backward rules for AD.

The following functions must be implemented by backends in order for output_size(p::Plan) and AdjointPlan to work:

  • projection_style(p::Plan) which can either be :none, :real, or :real_inv.
  • irfft_dim(p::Plan), only for those plans with :real_inv projection style, which gives the original length of the halved dimension.

Using the adjoint plan, we can simplify the writing of backwards rules. I test the adjoint plans both directly and indirectly through tests of the rrule's.

NB: The interface has changed since the initial PR message. See the updated implementation docs in the PR for accurate info.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants