Class: DNN::Activations::Swish
- Inherits:
-
Layers::Layer
- Object
- Layers::Layer
- DNN::Activations::Swish
- 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
64 65 66 |
# File 'lib/dnn/core/activations.rb', line 64 def backward(dout) dout * (@out + (1 / (1 + NMath.exp(-@x))) * (1 - @out)) end |
#forward(x) ⇒ Object
59 60 61 62 |
# File 'lib/dnn/core/activations.rb', line 59 def forward(x) @x = x @out = x * (1 / (1 + NMath.exp(-x))) end |