Add new-style diagm to tracker

This commit is contained in:
Eric Davies 2018-10-26 13:39:49 -05:00
parent 44ccdb7ca9
commit 9f9803eec6

View File

@ -309,6 +309,9 @@ end
# BLAS
LinearAlgebra.diagm(x::Pair{<:Integer, <:TrackedVector}) = track(diagm, x)
@grad diagm(x::Pair) = diagm(x[1] => data(x[2])), Δ -> (diag(Δ, x[1]),)
LinearAlgebra.diagm(x::TrackedVector) = track(diagm, x)
@grad diagm(x) = diagm(data(x)), Δ -> (diag(Δ),)