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?, #initialize, #output_shape, #to_hash
Constructor Details
This class inherits a constructor from DNN::Layers::Layer
Instance Method Details
#backward(dout) ⇒ Object
34 35 36 |
# File 'lib/dnn/core/activations.rb', line 34 def backward(dout) dout * (1 / (1 + @x.abs)**2) end |
#forward(x) ⇒ Object
29 30 31 32 |
# File 'lib/dnn/core/activations.rb', line 29 def forward(x) @x = x x / (1 + x.abs) end |