-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make work on Functors #117
Comments
Current work around (discussed on Slack) is to cheat a bit and define an intermediate function, that is (f::F)(x) = compute(f, x)
function compute(f::F, x)
# The actual callable struct implementation
end
function ChainRulesCore.rrule(::typeof(compute), f::F, x)
# Compute value and pullback function
end
# Now testing works fine
test_rrule(compute, f, x) |
Why can't we facilitate this work around in the code itself? Work around seems to be simple enough that instead of checking for a functor we can wrap it ourselves? |
The reason this issue is still open is that it hasn't been done yet. We don't need the work around in the code itself. when we can fix it properly. |
if you provide me a few pointers on what is meant by "fed to FiniteDifferences.jl correctly", I can open a PR. Maybe some documentation? |
Working out exactly what it is to fed to FiniteDIfferences.jl correctly, is kinda the hard part of the PR. The actual methods we hit in FiniteDifferences.jl are these ones: Probably adapting the The other thing that is need is to workout what (if anything) need to be done to the
Mayube that should will change from: _make_jvp_call(fdm, f, y, xs, ẋs, ignores) to _make_jvp_call(fdm, y, xs, ẋs, ignores) with f just being the first element of xs and its derivative the first of ẋs and similar it having a entry in ignores .similar for _make_j′vp_call .and those changes would need to be propegated upwards to the places that call those. Basically so that most of the code in this package doesn't treat f any different from any of its arguments.
|
Ok I gave it my best but I can't figure it out. Thanks for the explanation though. Maybe good for the next person. |
right now all the tests check they are not funning on functors.
With the new API in #116
we can have
f ⟂ ḟ
and `f ⟂ f̄``, which would be fine API-wise.The text was updated successfully, but these errors were encountered: