Class: DNN::Activations::Softsign
- Inherits:
-
Layers::Layer
- Object
- Layers::Layer
- DNN::Activations::Softsign
- 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
32 33 34 |
# File 'lib/dnn/core/activations.rb', line 32 def backward(dy) dy * (1 / (1 + @x.abs) ** 2) end |
#forward(x) ⇒ Object
27 28 29 30 |
# File 'lib/dnn/core/activations.rb', line 27 def forward(x) @x = x x / (1 + x.abs) end |