Skip to content

Commit

Permalink
pre-alloc dA as zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
klensink committed Feb 6, 2018
1 parent 5bb807f commit de6680d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/activations/tanhActivation.jl
Expand Up @@ -20,11 +20,9 @@ export tanhActivation
function tanhActivation(Y::Array{T,2},doDerivative::Bool=false) where {T <: Number}

A = tanh.(Y)
dA = similar(Y)
dA = zeros(A)
if doDerivative
dA .= one(T) .- A.^2
else
fill!(dA, zero(T))
end
return A, dA
end

0 comments on commit de6680d

Please sign in to comment.