This commit is contained in:
Mike J Innes 2018-02-13 13:31:35 +00:00
parent 066cb45a38
commit 820cd3ae42
2 changed files with 3 additions and 2 deletions

View File

@ -130,8 +130,8 @@ LinAlg.dot(xs::AbstractVector, ys::TrackedVector) = track(dot, xs, ys)
LinAlg.dot(xs::TrackedVector, ys::AbstractVector) = track(dot, xs, ys)
function back(::typeof(dot), Δ, xs, ys)
@back(xs, Δ.*ys)
@back(ys, Δ.*xs)
@back(xs, Δ.*data(ys))
@back(ys, Δ.*data(xs))
end
# Hacks to get std working

View File

@ -45,6 +45,7 @@ end
@test gradtest(x -> std(x, 1), rand(5,5))
@test gradtest((x, y) -> x .* y, rand(5), rand(5))
@test gradtest(dot, rand(5), rand(5))
@test gradtest(rand(5)) do x
y = x.^2