-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
29 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This file contains a number of additions to BlockArrays.jl. These are completely | ||
# independent of Stheno.jl, and will (hopefully) move over to BlockArrays.jl at some point. | ||
|
||
function ChainRulesCore.rrule(::typeof(BlockArrays.mortar), _blocks::AbstractArray) | ||
y = BlockArrays.mortar(_blocks) | ||
Ty = typeof(y) | ||
function mortar_pullback(Δ::Tangent) | ||
return (NoTangent(), Δ.blocks) | ||
end | ||
function mortar_pullback(Δ::BlockArray) | ||
return mortar_pullback(Tangent{Ty}(; blocks = Δ.blocks, axes=NoTangent())) | ||
end | ||
return y, mortar_pullback | ||
end | ||
|
||
# A hook to which I can attach an rrule without commiting type-piracy against BlockArrays. | ||
_collect(X::BlockArray) = Array(X) | ||
|
||
function ChainRulesCore.rrule(::typeof(_collect), X::BlockArray) | ||
function Array_pullback(Δ::Array) | ||
ΔX = Tangent{Any}(blocks=BlockArray(Δ, axes(X)).blocks, axes=NoTangent()) | ||
return (NoTangent(), ΔX) | ||
end | ||
return Array(X), Array_pullback | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2510d49
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.
@JuliaRegistrator register()
2510d49
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.
Registration pull request created: JuliaRegistries/General/51324
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: