Skip to content

Commit

Permalink
gradient for prod(f, x)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeInnes committed Apr 15, 2019
1 parent 8cece0d commit b3bcdf9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ end
end
end

function _forward(cx::Context, ::typeof(prod), f, xs::AbstractArray)
y, back = forward(cx, (xs -> prod(f.(xs))), xs)
y, ȳ -> (nothing, nothing, back(ȳ)...)
end

@adjoint function maximum(xs; dims = :)
max, i = findmax(xs, dims = dims)
max, function (Δ)
Expand Down

0 comments on commit b3bcdf9

Please sign in to comment.