Class: DNN::Activations::Sigmoid

Inherits:
Layers::Layer show all
Defined in:
lib/dnn/core/activations.rb

Constant Summary collapse

NMath =
Xumo::NMath

Instance Method Summary collapse

Methods inherited from Layers::Layer

#build, #built?, #initialize, #prev_layer, #shape, #to_hash

Constructor Details

This class inherits a constructor from DNN::Layers::Layer

Instance Method Details

#backward(dout) ⇒ Object



11
12
13
# File 'lib/dnn/core/activations.rb', line 11

def backward(dout)
  dout * (1 - @out) * @out
end

#forward(x) ⇒ Object



7
8
9
# File 'lib/dnn/core/activations.rb', line 7

def forward(x)
  @out = 1 / (1 + NMath.exp(-x))
end