Tagging (fix #1296)#1297
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1297 +/- ##
=======================================
Coverage 88.83% 88.84%
=======================================
Files 227 227
Lines 29780 29794 +14
=======================================
+ Hits 26455 26469 +14
Misses 3325 3325
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@JordiManyer This should be ready to go. Let me know if you want any changes |
|
Has anyone though that compilation times for AD being so high is maybe because of these tags? Isn't there a better way of doing things? Just to illustrate: By putting tags out of the inner functions and making them only once per call, we have reduced the multifield tests from 129 mins (master) down to 82 mins (in this PR). This is crazy, and we have basically only reduced the number of tags to one per AD call. Could we push this further? For instance: I don't see why Going even further: Could we fully infer the "AD level" from the code, and then create a predictable, reusable tag? Something like struct FDTag{L} end
FDTag(level::Integer) = FDTag{Val{level}}()If we can reliably predict the level, this means we would only compile things once and thats it. It would also mean that we could precompile the code up to a certain level of AD and the precompiled code would be useful, not like now. Does this make sense? @zjwegert @ConnorMallon |
| autodiff_array_gradient(a,i_to_x,tag) | ||
| end | ||
|
|
||
| function autodiff_array_gradient(a,i_to_x,tag::Function) |
There was a problem hiding this comment.
In all functions: Could we unify into a single signature? Something like
function default_tag(f,a)
tag = x -> f(a,x)
end
function autodiff_array_gradient(a,i_to_x,tag=default_tag(ForwardDiff.gradient,a))
...
endNote it is still an argument, so the call to this function stays the same. I would also not restrict the tag to be a function, it could be anything.
There was a problem hiding this comment.
"nested", not "tested"
|
I was curious about these tags and investigated a bit. The "tag" is used as the first argument of The docstring mentions the output of |
Fixes and updates for #1296 as I don't have access to branch.