-
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
Open
penelopeysm
wants to merge
3
commits into
main
Choose a base branch
from
py/ldf-closure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Benchmark Report
Computer InformationBenchmark Results |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1172 +/- ##
==========================================
- Coverage 80.01% 80.00% -0.02%
==========================================
Files 41 41
Lines 3877 3890 +13
==========================================
+ Hits 3102 3112 +10
- Misses 775 778 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.