Skip to content

Conversation

@WardBrian
Copy link
Member

Summary

This is a continuation of #2750. The reverse mode specializations introduced in that PR for the 1D FFT generalize in the obvious way to 2 dimensions.

For FFT2: adjoint(x) += size(y) * ifft2(adjoint(y)), iFFT2: adjoint(y) += (1 / size(x)) * fft2(adjoint(x))

Tests

Existing tests in test/unit/math/mix/fun/fft_test pass

Side Effects

None.

Release notes

Added reverse-mode specializations for fft2 and inv_fft2

Checklist

  • Math issue (inverse) FFT analytic adjoint-Jacobian  #2740

  • Copyright holder: Simons Foundation

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@WardBrian WardBrian requested a review from bob-carpenter August 3, 2022 16:12
@WardBrian
Copy link
Member Author

This PR speeds up gradient evaluation time on the HoloML model by about 20% (from 0.53 seconds per eval to 0.43 seconds, as reported at the start of sampling)

@WardBrian WardBrian requested a review from rok-cesnovar August 3, 2022 16:17
Copy link
Member

@bob-carpenter bob-carpenter left a comment

Choose a reason for hiding this comment

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

looks great. thanks!

@bob-carpenter
Copy link
Member

this is ok to merge when tests pass

@WardBrian WardBrian merged commit 83b3731 into develop Aug 4, 2022
@WardBrian WardBrian deleted the feature/fft2-adjoints branch August 4, 2022 12:32
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.

3 participants