-
Notifications
You must be signed in to change notification settings - Fork 19
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
add Tapir support #71
Conversation
@sunxd3 can you help complete this integration? |
After I finish the work on hands, will work on this! |
40fd15b
to
48fc01d
Compare
I formatted the code on the |
@willtebbutt It seems the only remaining issue is the lack of a rule for |
Just had a look at the source -- it looks like this is happening in the rule that Tapir.jl is deriving for |
@willtebbutt BTW, in this PR, I had to modify the package so that we carry around the |
Alas, there is not presently -- you'll have to continue to pass it around. |
This is now resolved in v0.2.33 . |
Some of the remaining problems are to do with a different intrinsic, |
I'm pretty sure that my comment will unblock this PR, but not everything will pass until v0.2.38 of Tapir.jl is available -- PR here |
rule = st_ad | ||
y, g = Tapir.value_and_gradient!!(rule, f, x) | ||
DiffResults.value!(out, y) | ||
DiffResults.gradient!(out, last(g)) |
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.
DiffResults.gradient!(out, last(g)) | |
DiffResults.gradient!(out, g[2]) |
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.
@willtebbutt, to clarify, we don't need this change. Is that correct?
All tests are passing now! |
@@ -19,7 +19,8 @@ jobs: | |||
fail-fast: false | |||
matrix: | |||
version: | |||
- '1.7' | |||
#- '1.7' | |||
- '1.10' |
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.
@willtebbutt, can you adapt the Bijectors setup so we don't need to comment out 1.7?
#67 introduces a few breaking changes to the |
@Red-Portal is your plan to continue working on this PR, or should I take a look at finishing it off now that everything seems to be working on Tapir.jl's end? |
Hi all, sorry for the confusion caused by #67 . I was a little surprised that it broke some things because it wasn't changing the interface at all. Well turns out it is this PR that is breaking the interface (purely to carry around the Now that #67 is out of the way, I will be able to to spend more time on this PR. I'll take a look from now on. But I really want to do something about carrying around the |
It would be good to avoid heuristics like |
If |
I don’t have good experience with memorisation tricks; they lead to subtle bugs and are often hard to reason about. Maybe @willtebbutt have thought about this? |
I would also be wary of using Memoization here. At least one issue that could result in not-entirely-obvious cache invalidation is method redefinition. The global method table handles this well obviously, but I'm not sure it's entirely trivial to do yourself (hence the fact that Tapir.jl doesn't yet do it). Re Tapir.jl being the only backend to require a preparation step: is it not the case that ReverseDiff.jl requires a cache when operating in compiled mode? |
Hi @willtebbutt !
Would this happen? We only use global functions now and the only things that change are auxiliary inputs. So if we are thinking of the same thing, I think it should be okay.
I don't think we'll be able to use compiled tapes because they are incompatible with changing auxiliary inputs. |
There are a few details to consider carefully. I suggest staying away from memorization heuristics; the cons often outweigh the minor efforts that we could save (from using memorization) when it comes to finding a proper solution. I hope that @willtebbutt can take over from here to ensure a robust AD interface for Tapir and other packages. |
This can definitely happen -- Julia's world age system is used to track this, so if you were to do caching you would definitely need to take it into account. |
Hi @willtebbutt @yebai , okay after seeing the discussion, I guess carrying around |
Closed in favour of #86 |
No description provided.