lib/dnn/core/activations.rb in ruby-dnn-0.4.1 vs lib/dnn/core/activations.rb in ruby-dnn-0.4.2

- old
+ new

@@ -3,15 +3,15 @@ Layer = Layers::Layer OutputLayer = Layers::OutputLayer class Sigmoid < Layer def forward(x) - @out = 1.0 / (1 + NMath.exp(-x)) + @out = 1 / (1 + NMath.exp(-x)) end def backward(dout) - dout * (1.0 - @out) * @out + dout * (1 - @out) * @out end end class Tanh < Layer @@ -43,9 +43,11 @@ end class LeakyReLU < Layer include Xumo + + attr_reader :alpha def initialize(alpha = 0.3) @alpha = alpha end