Class: DNN::Activations::Softplus
- Inherits:
-
Layers::Layer
- Object
- Layers::Layer
- DNN::Activations::Softplus
- 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
50 51 52 |
# File 'lib/dnn/core/activations.rb', line 50 def backward(dout) dout * (1 / (1 + NMath.exp(-@x))) end |
#forward(x) ⇒ Object
45 46 47 48 |
# File 'lib/dnn/core/activations.rb', line 45 def forward(x) @x = x NMath.log(1 + NMath.exp(x)) end |