-
Notifications
You must be signed in to change notification settings - Fork 62
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
MutableTangent #105
Comments
What's the difference to Composite exactly? |
Primary difference is (also |
* PR preview docs * add link to remind to clean up this code once less evil way is possible * Update docs/make.jl * fix typo * . * . * fix docs badge links * remove debug println * =highlight readme
Might also be used for |
This would now be called |
With JuliaDiff/Diffractor.jl#189 in mind, how do you think type stability should be addressed? Currently field values could be any of AbstractZero, structural tangents or natural tangents (including natural zeros). |
It is not an additional concern. |
As a rule writer who would like to know what types to expect/output/enforce when working with Here are all the different types I understand are allowed as cotangents for structural
AIUI this proliferation of different types is less of a worry for immutable structural tangents because they can't be updated in place, but more important for I couldn't find a definitive answer on the small union optimization limit (https://discourse.julialang.org/t/performance-tips-for-union-types/13928/4 mentions 3-255 and JuliaLang/julia#44131 demonstrates 5), but I presume allowing user-defined tangent types in there breaks the optimization because there are theoretically infinite subtypes of both Apologies if this is too early in the design phase to ask. I saw this issue getting some recent activity and assumed you had some more concrete thoughts on it :) |
Ah I see. So in general we don't have to worry about type stability as long as each method is type stable. for mutatiom you just need to ensure mutable tangent for mutable primal. |
Makes sense, thanks. I guess my question was more around what type constraints should be placed on the backing type of |
So my plan was for it to be backed by a But yes, like you say yes, swapping out the named tuple like that would require that the field can accept them. |
Mutable primal types need mutable differentials.
This is one of the things needed to support mutability in forwards mode.
(For reverse mode this is not enough).
We should have a
MutableComposite
type for them.Whether it is backed by a
Dict
; or backed by aNamedTuple
that gets swapped out everytimesetproperty
is called, idk.The text was updated successfully, but these errors were encountered: