Class: DNN::Activations::ReLU
- Inherits:
-
Layers::Layer
- Object
- Layers::Layer
- DNN::Activations::ReLU
- Defined in:
- lib/dnn/core/activations.rb
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
77 78 79 80 81 |
# File 'lib/dnn/core/activations.rb', line 77 def backward(dout) @x[@x > 0] = 1 @x[@x <= 0] = 0 dout * @x end |
#forward(x) ⇒ Object
71 72 73 74 75 |
# File 'lib/dnn/core/activations.rb', line 71 def forward(x) @x = x.clone x[x < 0] = 0 x end |