Skip to content
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

Upper/LowerTriangular gradients #9

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

pshashk
Copy link
Contributor

@pshashk pshashk commented Mar 26, 2019

No description provided.

@MikeInnes
Copy link
Member

Looks good to me, but can you do a quick rebase / merge master so that the tests pass?

@pshashk
Copy link
Contributor Author

pshashk commented Apr 4, 2019

Somehow *Triangular gradient definitions overwrite each other and UpperTriangular(::TrackedArray) returns tracked LowerTriangular. Minimal example with current master:

using LinearAlgebra, Tracker
using Tracker: track, data, @grad
using LinearAlgebra: UpperTriangular, LowerTriangular

LinearAlgebra.UpperTriangular(a::TrackedMatrix) = track(UpperTriangular, a)
LinearAlgebra.LowerTriangular(a::TrackedMatrix) = track(LowerTriangular, a)
@grad UpperTriangular(a) = UpperTriangular(data(a)), Δ -> (UpperTriangular(Δ),)
@grad LowerTriangular(a) = LowerTriangular(data(a)), Δ -> (LowerTriangular(Δ),)

UpperTriangular(param(rand(4,4)))
Tracked 4×4 LowerTriangular{Float64,Array{Float64,2}}:
 0.938394   ⋅         ⋅         ⋅      
 0.755833  0.960363   ⋅         ⋅      
 0.426979  0.843864  0.238508   ⋅      
 0.101401  0.10873   0.555092  0.381779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants