Class: DNN::Activations::Tanh
- Inherits:
-
Layers::Layer
- Object
- Layers::Layer
- DNN::Activations::Tanh
- 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
24 25 26 |
# File 'lib/dnn/core/activations.rb', line 24 def backward(dout) dout * (1 - @out**2) end |
#forward(x) ⇒ Object
20 21 22 |
# File 'lib/dnn/core/activations.rb', line 20 def forward(x) @out = NMath.tanh(x) end |