Skip to content

Commit

Permalink
restore mapreduce
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Dec 12, 2021
1 parent 2809636 commit 33a55a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/layers/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@ end
@functor Maxout

function (mo::Maxout)(input::AbstractArray)
outs = map(lay -> lay(input), mo.over)
return max.(outs...)
# outs = map(lay -> lay(input), mo.over)
# return max.(outs...)
# Perhaps surprisingly, pairwise max broadcast is often faster,
# even with Zygote. See #698 and #1794
mapreduce(f -> f(input), (acc, out) -> max.(acc, out), mo.over)
end

trainable(mo::Maxout) = mo.over
Expand Down

0 comments on commit 33a55a3

Please sign in to comment.