fix flatten/softmax batching behaviour

This commit is contained in:
Mike J Innes 2017-06-01 19:28:02 +01:00
parent b54281bdea
commit 07c523a13d

View File

@ -8,11 +8,9 @@ back!(::typeof(σ), Δ, x) = Δ .* σ(x).*(1.-σ(x))
relu(x) = max(0, x) relu(x) = max(0, x)
back!(::typeof(relu), Δ, x) = Δ .* (x .> 0) back!(::typeof(relu), Δ, x) = Δ .* (x .> 0)
# TODO: correct behaviour with batches softmax(xs) = exp.(xs) ./ sum(exp.(xs), 2)
softmax(xs) = exp.(xs) ./ sum(exp.(xs))
# TODO: correct behaviour with batches flatten(xs) = reshape(xs, size(xs, 1), :)
flatten(xs) = reshape(xs, length(xs))
infer(::typeof(softmax), x) = x infer(::typeof(softmax), x) = x
infer(::typeof(tanh), x) = x infer(::typeof(tanh), x) = x