Class: DNN::Layers::Sigmoid
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods inherited from Layer
#build, #built?, call, #call, from_hash, #initialize, #load_hash, #output_shape, #to_hash
Constructor Details
This class inherits a constructor from DNN::Layers::Layer
Instance Method Details
#backward(dy) ⇒ Object
9 10 11 |
# File 'lib/dnn/core/activations.rb', line 9 def backward(dy) dy * (1 - @y) * @y end |
#forward(x) ⇒ Object
5 6 7 |
# File 'lib/dnn/core/activations.rb', line 5 def forward(x) @y = 1 / (1 + Xumo::NMath.exp(-x)) end |