-
Notifications
You must be signed in to change notification settings - Fork 92
Update to ChainRulesCore 0.5.1 #146
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
Changes from 7 commits
313f65f
08191e2
d393d12
16ec82b
0835a59
d56978d
34a1bbe
e0384be
3fe59b4
61b425b
63b9f7e
c1a4451
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,7 +11,7 @@ _zeros(x) = fill!(similar(x), zero(eltype(x))) | |||||
##### `BLAS.dot` | ||||||
##### | ||||||
|
||||||
frule(::typeof(BLAS.dot), x, y) = frule(dot, x, y) | ||||||
frule(::typeof(BLAS.dot), x, y, Δself, Δx, Δy) = frule(dot, x, y, Δself, Δx, Δy) | ||||||
|
||||||
rrule(::typeof(BLAS.dot), x, y) = rrule(dot, x, y) | ||||||
|
||||||
|
@@ -35,12 +35,9 @@ end | |||||
##### `BLAS.nrm2` | ||||||
##### | ||||||
|
||||||
function frule(::typeof(BLAS.nrm2), x) | ||||||
function frule(::typeof(BLAS.nrm2), x, _, Δ) | ||||||
Ω = BLAS.nrm2(x) | ||||||
function nrm2_pushforward(_, Δx) | ||||||
return sum(Δx * cast(@thunk(x * inv(Ω)))) | ||||||
end | ||||||
return Ω, nrm2_pushforward | ||||||
return Ω, sum(Δx * cast(@thunk(x * inv(Ω)))) | ||||||
end | ||||||
|
||||||
function rrule(::typeof(BLAS.nrm2), x) | ||||||
|
@@ -70,11 +67,8 @@ end | |||||
##### `BLAS.asum` | ||||||
##### | ||||||
|
||||||
function frule(::typeof(BLAS.asum), x) | ||||||
function asum_pushforward(_, Δx) | ||||||
return sum(cast(sign, x) * Δx) | ||||||
end | ||||||
return BLAS.asum(x), asum_pushforward | ||||||
function frule(::typeof(BLAS.asum), x, _, Δx) | ||||||
return BLAS.asum(x), sum(cast(sign, x) * Δx) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is actually no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough, wonder how it got in there, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I confused myself. help?> BLAS.asum
asum(n, X, incx)
Sum of the absolute values of the first n elements of array X with stride incx.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> BLAS.asum(5, fill(1.0im, 10), 2)
5.0
julia> BLAS.asum(2, fill(1.0im, 10), 5)
2.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added back. |
||||||
end | ||||||
|
||||||
function rrule(::typeof(BLAS.asum), x) | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.