-
Notifications
You must be signed in to change notification settings - Fork 64
Remove One #61
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
Remove One #61
Conversation
I will checkout your branch and give it a shot now |
Please feel free to push directly. I'll leave it alone for now. |
Could you give a bit of explanation of why we would want this and what problems |
Cause is that Extern is recursive, |
Ah, yes, sorry for not raising an issue to discuss this first. @oxinabox and I spent the day thinking about this and related issues yesterday and thought it would be a good idea to remove
Could you elaborate a bit on this please? When does having a |
One isn't actually a valid differential in general. Part of my little differential types manifesto: There are 3 kinds of things;
Primal Types exist, they have very few requirements on them. Differential types exist, and they corespond to being valid for one or more Primal Type. I thought this was enough at first, but it isn't.
Now, right now (without this PR)
Seperate to this we may want to reintroduce There are some other rules too, I should write this out in a docs PR, (*Note: Wirtinger is not a differential under this defintion, but it is some generalization, where potentially some sum of wirtingers will be a differential again) |
I've opened #62 to discuss things related to this. It's a bit broader than this particular issue, but would be a good place to discuss it regardless. |
One example would be the push_forward for matrix multiplication. We define:
If we now wanted to find the jacobian of the function Regarding @oxinabox's point: Why not just define |
Good point, I did not realize that was true. (It still wouldn't be a valid differential with #59 |
45e3095
to
10342f3
Compare
@simeonschaub I'm not sure that I entirely follow your example. The function frule(::typeof(*), A, B)
return A * B, (_, dA, dB) -> dA * B + A * dB
end Your proposed function is v -> M * v where M dv for some vector-valued perturbation So to me it seems that the example you propose conflates individual differentials with a representation of a collection of differentials, which isn't something that we really have any notion of in ChainRules at the minute. Were we to consider the single-seed setting, a 1-hot vector of some kind would be the appropriate thing. |
fix extra comma
Fix test as per Lyndon's suggestion Co-Authored-By: Lyndon White <[email protected]> fix type fix left over one
10342f3
to
bd014f4
Compare
@willtebbutt I am done with messing with it, so you can touch it again freely. |
@simeonschaub regarding my above comment -- I am very pro- formalising this interface, as I imagine that @ChrisRackauckas need this for |
bump :) is there still a decision to be made between this and #60 ? |
Yes. still needs to be decided. I still don't think If it actually gives better performance than After JuliaDiff/ChainRules.jl#133 |
What still worries me about replacing julia> a = [1 2; 3 4]
2×2 Array{Int64,2}:
1 2
3 4
julia> b = I*a
2×2 Array{Int64,2}:
1 2
3 4
julia> a === b
false so multiplication with |
My question is still why we want / need a Taking the vector space view of differentials, I can definitely get behind wanting a multiplicative identity for our scalars (most of the time?), but there's no special status for the vector While I agree that for |
Note this also applies to
It does not apply to |
ForwardDiff2.jl doesn't use |
@@ -5,7 +5,8 @@ export frule, rrule | |||
export wirtinger_conjugate, wirtinger_primal, refine_differential | |||
export @scalar_rule, @thunk | |||
export extern, store! | |||
export Wirtinger, Zero, One, DoesNotExist, Thunk, InplaceableThunk | |||
export unthunk | |||
export Wirtinger, Zero, DoesNotExist, Thunk, InplaceableThunk |
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.
export Wirtinger, Zero, DoesNotExist, Thunk, InplaceableThunk | |
export DoesNotExist, InplaceableThunk, Thunk, unthunk, Wirtinger, Zero |
function Wirtinger(primal::Union{Number,AbstractDifferential}, | ||
conjugate::Union{Number,AbstractDifferential}) | ||
function Wirtinger( | ||
primal::Union{Number,AbstractDifferential}, |
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.
primal::Union{Number,AbstractDifferential}, | |
primal::Union{Number, AbstractDifferential}, |
conjugate::Union{Number,AbstractDifferential}) | ||
function Wirtinger( | ||
primal::Union{Number,AbstractDifferential}, | ||
conjugate::Union{Number,AbstractDifferential}, |
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.
conjugate::Union{Number,AbstractDifferential}, | |
conjugate::Union{Number, AbstractDifferential}, |
(x::Thunk)() = x.f() | ||
@inline extern(x::Thunk) = extern(x()) | ||
@inline unthunk(x::Thunk) = x() | ||
|
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.
@test rr1 == 1 | ||
end | ||
@testset "rules" begin | ||
|
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.
Closing as this is horribly outdated. #62 is still open, so hopefully we'll get around to removing |
What it says on the tin. Currently getting a load of errors because I'm trying to
extern
aWirtinger
somewhere. @oxinabox could do with your assistance here. Any idea what's going on? Is our overly-aggressive externing causing problems maybe?edit: the surprisingly large number of changed line is due to sorting out some formatting issues.