From 74fa0c35dd75437a8107fd98169a02ba3d5c785a Mon Sep 17 00:00:00 2001 From: Dhairya Gandhi Date: Thu, 9 Jul 2020 15:36:56 +0530 Subject: [PATCH] replace Base.tanh with faster tanh --- src/layers/basic.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/layers/basic.jl b/src/layers/basic.jl index b9e2922310..380ea2659d 100644 --- a/src/layers/basic.jl +++ b/src/layers/basic.jl @@ -113,6 +113,7 @@ Dense(W, b) = Dense(W, b, identity) function Dense(in::Integer, out::Integer, σ = identity; initW = glorot_uniform, initb = zeros) + σ = typeof(σ) <: typeof(tanh) ? SLEEFPriates.tanh : σ return Dense(initW(out, in), initb(out), σ) end