lib/dnn/core/activations.rb in ruby-dnn-0.9.0 vs lib/dnn/core/activations.rb in ruby-dnn-0.9.1

- old
+ new

@@ -11,12 +11,10 @@ end end class Tanh < Layers::Layer - NMath = Xumo::NMath - def forward(x) @out = NMath.tanh(x) end def backward(dout) @@ -36,12 +34,10 @@ end end class Softplus < Layers::Layer - NMath = Xumo::NMath - def forward(x) @x = x NMath.log(1 + NMath.exp(x)) end @@ -50,12 +46,10 @@ end end class Swish < Layers::Layer - NMath = Xumo::NMath - def forward(x) @x = x @out = x * (1 / (1 + NMath.exp(-x))) end @@ -109,11 +103,9 @@ end end class ELU < Layers::Layer - NMath = Xumo::NMath - attr_reader :alpha def self.load_hash(hash) self.new(hash[:alpha]) end