Class: DNN::Activations::Swish
- Inherits:
-
Layers::Layer
- Object
- Layers::Layer
- DNN::Activations::Swish
- Defined in:
- lib/dnn/core/activations.rb
Instance Attribute Summary
Attributes inherited from Layers::Layer
Instance Method Summary collapse
Methods inherited from Layers::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
56 57 58 |
# File 'lib/dnn/core/activations.rb', line 56 def backward(dy) dy * (@y + (1 / (1 + Xumo::NMath.exp(-@x))) * (1 - @y)) end |
#forward(x) ⇒ Object
51 52 53 54 |
# File 'lib/dnn/core/activations.rb', line 51 def forward(x) @x = x @y = x * (1 / (1 + Xumo::NMath.exp(-x))) end |