Class: DNN::Layers::Softsign
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods inherited from 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
30 31 32 |
# File 'lib/dnn/core/activations.rb', line 30 def backward(dy) dy * (1 / (1 + @x.abs)**2) end |
#forward(x) ⇒ Object
25 26 27 28 |
# File 'lib/dnn/core/activations.rb', line 25 def forward(x) @x = x x / (1 + x.abs) end |