-
Notifications
You must be signed in to change notification settings - Fork 37
Enable the option to switch between differentiating a closure, and a function with constant arguments #1172
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
Conversation
Benchmark Report
Computer InformationBenchmark Results |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1172 +/- ##
==========================================
- Coverage 78.92% 78.91% -0.01%
==========================================
Files 41 41
Lines 3914 3927 +13
==========================================
+ Hits 3089 3099 +10
- Misses 825 828 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mhauru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
94e62b8 to
d3a8a92
Compare
|
DynamicPPL.jl documentation for PR #1172 is available at: |
Prior to 'fast' LDF (i.e. in DynamicPPL <= 0.38) there were two different functions that were differentiated through when performing
LogDensityFunctions.logdensity_and_gradient: one was a multi-argument functionf(x, c1, c2, c3, ...)wherexis the active argument, and one was a callable structF(x)whereFclosed over the inactive argumentsc1, c2, c3. See #806 and #922 for previous history, and the old version ofsrc/logdensityfunction.jlhere.This feature was not ported over to FastLDF in #1139, which is probably an example of laziness on my part. The benefits of doing this is mainly improved performance, but for Enzyme it also allows us to avoid setting
function_annotation(see also #1048).Here are some benchmarks:
closmeans use the closure,funcmeans the original function. As one can see most of the AD backends are faster with the function rather than the closure, hence_use_closureis mostly set tofalse. Part of me wonders if sticking an@inlineon the callable struct might remove this difference, but my industriousness does have a limit.Here
timerefers to the time for gradient divided by time for primal.